add some models
authorMarcel Hlopko <marcel.hlopko@gmail.com>
Tue, 18 Jun 2013 22:49:22 +0200
changeset 44 0429d91be03e
parent 43 a2606a0342cf
child 45 0d84fd72f51c
add some models
web/Gemfile
web/Gemfile.lock
web/app/models/benchmark_duration.rb
web/app/models/benchmark_info.rb
web/app/models/benchmark_parameter.rb
web/app/models/benchmark_result.rb
web/app/models/language.rb
web/app/models/language_implementation.rb
web/app/views/index/_main_nav.html.erb
web/app/views/index/index.html.erb
web/db/migrate/20130618184126_create_languages.rb
web/db/migrate/20130618184159_create_language_implementations.rb
web/db/migrate/20130618184811_create_benchmark_results.rb
web/db/migrate/20130618184841_create_benchmark_parameters.rb
web/db/migrate/20130618184928_create_benchmark_durations.rb
web/db/migrate/20130618185142_create_benchmark_infos.rb
web/db/schema.rb
web/erd.pdf
web/test/fixtures/benchmark_durations.yml
web/test/fixtures/benchmark_infos.yml
web/test/fixtures/benchmark_parameters.yml
web/test/fixtures/benchmark_results.yml
web/test/fixtures/language_implementations.yml
web/test/fixtures/languages.yml
web/test/models/benchmark_duration_test.rb
web/test/models/benchmark_info_test.rb
web/test/models/benchmark_parameters_test.rb
web/test/models/benchmark_result_test.rb
web/test/models/language_implementation_test.rb
web/test/models/language_test.rb
--- a/web/Gemfile	Tue Jun 18 20:34:39 2013 +0200
+++ b/web/Gemfile	Tue Jun 18 22:49:22 2013 +0200
@@ -19,6 +19,8 @@
   gem 'pry-doc', '~> 0.4.6'
   gem 'pry-remote', '~> 0.1.7'
   gem 'pry-debugger', '~> 0.2.2'
+  gem 'rails-erd', '~> 1.1.0'
+  gem 'annotate', '~> 2.5.0'
 end
 
 group :test do
--- a/web/Gemfile.lock	Tue Jun 18 20:34:39 2013 +0200
+++ b/web/Gemfile.lock	Tue Jun 18 22:49:22 2013 +0200
@@ -25,6 +25,8 @@
       multi_json (~> 1.3)
       thread_safe (~> 0.1)
       tzinfo (~> 0.3.37)
+    annotate (2.5.0)
+      rake
     arel (4.0.0)
     atomic (1.1.9)
     builder (3.1.4)
@@ -34,6 +36,7 @@
       net-sftp (>= 2.0.0)
       net-ssh (>= 2.0.14)
       net-ssh-gateway (>= 1.1.0)
+    choice (0.1.6)
     coderay (1.0.9)
     coffee-rails (4.0.0)
       coffee-script (>= 2.2.0)
@@ -111,6 +114,11 @@
       bundler (>= 1.3.0, < 2.0)
       railties (= 4.0.0.rc1)
       sprockets-rails (~> 2.0.0.rc4)
+    rails-erd (1.1.0)
+      activerecord (>= 3.0)
+      activesupport (>= 3.0)
+      choice (~> 0.1.6)
+      ruby-graphviz (~> 1.0.4)
     railties (4.0.0.rc1)
       actionpack (= 4.0.0.rc1)
       activesupport (= 4.0.0.rc1)
@@ -131,6 +139,7 @@
       rspec-core (~> 2.13.0)
       rspec-expectations (~> 2.13.0)
       rspec-mocks (~> 2.13.0)
+    ruby-graphviz (1.0.9)
     rvm-capistrano (1.3.1)
       capistrano (>= 2.0.0)
     sass (3.2.9)
@@ -179,6 +188,7 @@
   ruby
 
 DEPENDENCIES
+  annotate (~> 2.5.0)
   capistrano (~> 2.15.4)
   jbuilder (~> 1.0.1)
   jquery-rails (~> 3.0.1)
@@ -189,6 +199,7 @@
   pry-doc (~> 0.4.6)
   pry-remote (~> 0.1.7)
   rails (~> 4.0.0.RC1)
+  rails-erd (~> 1.1.0)
   rspec-rails (~> 2.13.2)
   rvm-capistrano (~> 1.3.1)
   sass-rails (~> 4.0.0.RC1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/benchmark_duration.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,16 @@
+# == Schema Information
+#
+# Table name: benchmark_durations
+#
+#  id                  :integer          not null, primary key
+#  benchmark_result_id :integer
+#  duration            :integer
+#  created_at          :datetime
+#  updated_at          :datetime
+#
+
+class BenchmarkDuration < ActiveRecord::Base
+
+  belongs_to :benchmark_result, dependent: :destroy, inverse_of: :benchmark_durations
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/benchmark_info.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,17 @@
+# == Schema Information
+#
+# Table name: benchmark_infos
+#
+#  id          :integer          not null, primary key
+#  class       :string(255)
+#  selector    :string(255)
+#  description :text
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
+class BenchmarkInfo < ActiveRecord::Base
+
+  has_many :benchmark_results, inverse_of: :benchmark_info
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/benchmark_parameter.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,17 @@
+# == Schema Information
+#
+# Table name: benchmark_parameters
+#
+#  id                  :integer          not null, primary key
+#  benchmark_result_id :integer
+#  name                :string(255)
+#  value               :string(255)
+#  created_at          :datetime
+#  updated_at          :datetime
+#
+
+class BenchmarkParameter < ActiveRecord::Base
+
+  belongs_to :benchmark_result, dependent: :destroy, inverse_of: :benchmark_parameters
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/benchmark_result.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,19 @@
+# == Schema Information
+#
+# Table name: benchmark_results
+#
+#  id                         :integer          not null, primary key
+#  benchmark_info_id          :integer
+#  language_implementation_id :integer
+#  created_at                 :datetime
+#  updated_at                 :datetime
+#
+
+class BenchmarkResult < ActiveRecord::Base
+
+  belongs_to :language_implementation, dependent: :destroy, inverse_of: :benchmark_results
+  belongs_to :benchmark_info, dependent: :destroy, inverse_of: :benchmark_results
+  has_many :benchmark_durations, inverse_of: :benchmark_result
+  has_many :benchmark_parameters, inverse_of: :benchmark_result
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/language.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,15 @@
+# == Schema Information
+#
+# Table name: languages
+#
+#  id         :integer          not null, primary key
+#  name       :string(255)
+#  created_at :datetime
+#  updated_at :datetime
+#
+
+class Language < ActiveRecord::Base
+
+  has_many :language_implementations, inverse_of: :language
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/language_implementation.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,17 @@
+# == Schema Information
+#
+# Table name: language_implementations
+#
+#  id          :integer          not null, primary key
+#  name        :string(255)
+#  language_id :integer
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
+class LanguageImplementation < ActiveRecord::Base
+
+  belongs_to :language, dependent: :destroy, inverse_of: :language_implementations
+  has_many :benchmark_results, inverse_of: :language_implementation
+
+end
--- a/web/app/views/index/_main_nav.html.erb	Tue Jun 18 20:34:39 2013 +0200
+++ b/web/app/views/index/_main_nav.html.erb	Tue Jun 18 22:49:22 2013 +0200
@@ -7,7 +7,10 @@
           <ul class="nav">
             <%= nav_tab("index", 
                         current_tab: current_tab, 
-                        class: "special") { link_to("index", root_path) } %>
+                        class: "special") { link_to("Home", root_path) } %>
+            <%= nav_tab("Datasets", 
+                        current_tab: current_tab, 
+                        class: "special") { link_to("Languages", languages_path) } %>
             <%= nav_tab("about", 
                         current_tab: current_tab, 
                         class: "special") { link_to("About", '#') } %>
--- a/web/app/views/index/index.html.erb	Tue Jun 18 20:34:39 2013 +0200
+++ b/web/app/views/index/index.html.erb	Tue Jun 18 22:49:22 2013 +0200
@@ -1,3 +1,8 @@
 <%= currently_at "index" %>
 
-improving every day :)
+<h1>Calipel</h1>
+<p>
+Simple micro-benchmarking framework inspired by SUnit a Caliper
+</P>
+
+<h2>Current Test Results</h2>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130618184126_create_languages.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,9 @@
+class CreateLanguages < ActiveRecord::Migration
+  def change
+    create_table :languages do |t|
+      t.string :name
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130618184159_create_language_implementations.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,10 @@
+class CreateLanguageImplementations < ActiveRecord::Migration
+  def change
+    create_table :language_implementations do |t|
+      t.string :name
+      t.integer :language_id
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130618184811_create_benchmark_results.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,11 @@
+class CreateBenchmarkResults < ActiveRecord::Migration
+  def change
+    create_table :benchmark_results do |t|
+      t.integer :benchmark_info_id
+      t.integer :language_implementation_id
+      t.datetime :performed_at
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130618184841_create_benchmark_parameters.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,11 @@
+class CreateBenchmarkParameters < ActiveRecord::Migration
+  def change
+    create_table :benchmark_parameters do |t|
+      t.integer :benchmark_result_id
+      t.string :name
+      t.string :value
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130618184928_create_benchmark_durations.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,10 @@
+class CreateBenchmarkDurations < ActiveRecord::Migration
+  def change
+    create_table :benchmark_durations do |t|
+      t.integer :benchmark_result_id
+      t.integer :duration
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130618185142_create_benchmark_infos.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,11 @@
+class CreateBenchmarkInfos < ActiveRecord::Migration
+  def change
+    create_table :benchmark_infos do |t|
+      t.string :class
+      t.string :selector
+      t.text :description
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/schema.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,60 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema.define(version: 20130618185142) do
+
+  create_table "benchmark_durations", force: true do |t|
+    t.integer  "benchmark_result_id"
+    t.integer  "duration"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  create_table "benchmark_infos", force: true do |t|
+    t.string   "class"
+    t.string   "selector"
+    t.text     "description"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  create_table "benchmark_parameters", force: true do |t|
+    t.integer  "benchmark_result_id"
+    t.string   "name"
+    t.string   "value"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  create_table "benchmark_results", force: true do |t|
+    t.integer  "benchmark_info_id"
+    t.integer  "language_implementation_id"
+    t.datetime "performed_at"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  create_table "language_implementations", force: true do |t|
+    t.string   "name"
+    t.integer  "language_id"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  create_table "languages", force: true do |t|
+    t.string   "name"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+end
Binary file web/erd.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/fixtures/benchmark_durations.yml	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,20 @@
+# == Schema Information
+#
+# Table name: benchmark_durations
+#
+#  id                  :integer          not null, primary key
+#  benchmark_result_id :integer
+#  duration            :integer
+#  created_at          :datetime
+#  updated_at          :datetime
+#
+
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+  benchmark_result_id: 1
+  duration: 1
+
+two:
+  benchmark_result_id: 1
+  duration: 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/fixtures/benchmark_infos.yml	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,21 @@
+# == Schema Information
+#
+# Table name: benchmark_infos
+#
+#  id          :integer          not null, primary key
+#  class       :string(255)
+#  selector    :string(255)
+#  description :text
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+  class: MyString
+  selector: MyString
+
+two:
+  class: MyString
+  selector: MyString
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/fixtures/benchmark_parameters.yml	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,23 @@
+# == Schema Information
+#
+# Table name: benchmark_parameters
+#
+#  id                  :integer          not null, primary key
+#  benchmark_result_id :integer
+#  name                :string(255)
+#  value               :string(255)
+#  created_at          :datetime
+#  updated_at          :datetime
+#
+
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+  benchmark_result_id: 1
+  name: MyString
+  value: MyString
+
+two:
+  benchmark_result_id: 1
+  name: MyString
+  value: MyString
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/fixtures/benchmark_results.yml	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,18 @@
+# == Schema Information
+#
+# Table name: benchmark_results
+#
+#  id                         :integer          not null, primary key
+#  benchmark_info_id          :integer
+#  language_implementation_id :integer
+#  created_at                 :datetime
+#  updated_at                 :datetime
+#
+
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+  benchmark_id: 1
+
+two:
+  benchmark_id: 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/fixtures/language_implementations.yml	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,20 @@
+# == Schema Information
+#
+# Table name: language_implementations
+#
+#  id          :integer          not null, primary key
+#  name        :string(255)
+#  language_id :integer
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+  name: MyString
+  language_id: 1
+
+two:
+  name: MyString
+  language_id: 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/fixtures/languages.yml	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,17 @@
+# == Schema Information
+#
+# Table name: languages
+#
+#  id         :integer          not null, primary key
+#  name       :string(255)
+#  created_at :datetime
+#  updated_at :datetime
+#
+
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+  name: MyString
+
+two:
+  name: MyString
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/models/benchmark_duration_test.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class BenchmarkDurationTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/models/benchmark_info_test.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class BenchmarkInfoTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/models/benchmark_parameters_test.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class BenchmarkParametersTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/models/benchmark_result_test.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class BenchmarkResultTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/models/language_implementation_test.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class LanguageImplementationTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/models/language_test.rb	Tue Jun 18 22:49:22 2013 +0200
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class LanguageTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end