huge refactoring to better fit what we agreed on
authorMarcel Hlopko <marcel.hlopko@gmail.com>
Tue, 25 Jun 2013 22:11:10 +0200
changeset 106 eac4098d544d
parent 105 8293977e9a30
child 107 772814d560da
huge refactoring to better fit what we agreed on
web/app/assets/javascripts/settings/configurations.js
web/app/assets/javascripts/settings/operating_systems.js
web/app/assets/stylesheets/settings/configurations.css.scss
web/app/assets/stylesheets/settings/operating_systems.css.scss
web/app/controllers/compare_controller.rb
web/app/controllers/imports_controller.rb
web/app/controllers/results_controller.rb
web/app/controllers/settings/benchmark_configurations_controller.rb
web/app/controllers/settings/operating_systems_controller.rb
web/app/controllers/settings/runtimes_controller.rb
web/app/helpers/compare_helper.rb
web/app/helpers/settings/benchmark_configurations_helper.rb
web/app/helpers/settings/benchmark_infos_helper.rb
web/app/helpers/settings/operating_systems_helper.rb
web/app/helpers/settings/runtimes_helper.rb
web/app/models/benchmark_batch.rb
web/app/models/benchmark_configuration.rb
web/app/models/benchmark_result.rb
web/app/models/compare_query.rb
web/app/models/import_query.rb
web/app/models/language.rb
web/app/models/operating_system.rb
web/app/models/runtime.rb
web/app/views/compare/index.html.erb
web/app/views/imports/show_file_import.html.erb
web/app/views/imports/show_post_import.html.erb
web/app/views/imports/show_text_import.html.erb
web/app/views/index/_compare_table.html.erb
web/app/views/index/_timeline_table.html.erb
web/app/views/index/index.html.erb
web/app/views/results/_results_nav.html.erb
web/app/views/results/impl_results.html.erb
web/app/views/results/index.html.erb
web/app/views/settings/_settings_nav.html.erb
web/app/views/settings/benchmark_configurations/_form.html.erb
web/app/views/settings/benchmark_configurations/_table.html.erb
web/app/views/settings/benchmark_configurations/index.html.erb
web/app/views/settings/benchmark_configurations/show.html.erb
web/app/views/settings/languages/index.html.erb
web/app/views/settings/languages/show.html.erb
web/app/views/settings/operating_systems/_form.html.erb
web/app/views/settings/operating_systems/_table.html.erb
web/app/views/settings/operating_systems/index.html.erb
web/app/views/settings/operating_systems/show.html.erb
web/app/views/settings/runtimes/_form.html.erb
web/app/views/settings/runtimes/_table.html.erb
web/app/views/settings/runtimes/index.html.erb
web/app/views/settings/runtimes/show.html.erb
web/config/routes.rb
web/db/migrate/20130624210546_create_benchmark_configurations.rb
web/db/migrate/20130624214019_rename_language_implementations_to_runtimes.rb
web/db/migrate/20130624215029_create_operating_systems.rb
web/db/migrate/20130624215124_drop_benchmark_parameters_table.rb
web/db/migrate/20130625193900_rename_configurations_to_benchmark_configurations.rb
web/db/migrate/20130625200629_remove_performed_at_from_benchmark_results.rb
web/db/migrate/20130625200737_change_performed_at_to_datetime_on_benchmark_batches.rb
web/db/schema.rb
web/erd.pdf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/assets/javascripts/settings/configurations.js	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/assets/javascripts/settings/operating_systems.js	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/assets/stylesheets/settings/configurations.css.scss	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,3 @@
+// Place all the styles related to the Settings::Configurations controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/assets/stylesheets/settings/operating_systems.css.scss	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,3 @@
+// Place all the styles related to the Settings::OperatingSystems controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
--- a/web/app/controllers/compare_controller.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/controllers/compare_controller.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -1,13 +1,13 @@
 class CompareController < ApplicationController
   def index
     @compare_query = CompareQuery.new
-    @implementations = []
+    @runtimes = []
     @benchmark_info = nil
   end
 
   def filter
     @compare_query = CompareQuery.new(compare_query_params)
-    @implementations = @compare_query.filtered_implementations
+    @runtimes = @compare_query.filtered_runtimes
     @benchmark_info = @compare_query.benchmark_info
     render "index"
   end
--- a/web/app/controllers/imports_controller.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/controllers/imports_controller.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -11,7 +11,7 @@
   end
 
   def show_post_import
-    @impls = LanguageImplementation.all
+    @runtimes = Runtime.all
   end
 
   def text_import
@@ -43,11 +43,11 @@
   def push_import
     if request.content_type == "application/json"     
       @import_query = JsonImportQuery.new(
-        language_implementation_id: params[:lang_impl_id],
+        configuration_id: params[:configuration_id],
         json: params[:import])
     else
       @import_query = TextImportQuery.new(
-        language_implementation_id: params[:lang_impl_id],
+        configuration_id: params[:configuration_id],
         text: params[:import])
     end
 
@@ -61,15 +61,11 @@
 
   private
 
-  def push_import_params
-    params.require(:data).permit!
-  end
-
   def text_import_params
-    params.require(:text_import_query).permit(:text, :performed_at, :language_implementation_id)
+    params.require(:text_import_query).permit(:text)
   end
 
   def file_import_params
-    params.require(:file_import_query).permit(:file, :performed_at, :language_implementation_id)
+    params.require(:file_import_query).permit(:file)
   end
 end
--- a/web/app/controllers/results_controller.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/controllers/results_controller.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -2,8 +2,8 @@
   def index
   end
 
-  def impl_results
-    @impl = LanguageImplementation.find(params[:id])
+  def runtime_results
+    @runtime = Runtime.find(params[:id])
   end
 
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/controllers/settings/benchmark_configurations_controller.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,50 @@
+class Settings::BenchmarkConfigurationsController < SettingsController
+  def index
+    @benchmark_configuration = BenchmarkConfiguration.new
+  end
+
+  def show
+    @benchmark_configuration = BenchmarkConfiguration.find(params[:id])
+  end
+
+  def create
+    @benchmark_configuration = BenchmarkConfiguration.new(benchmark_configuration_params) 
+
+    if @benchmark_configuration.save
+      flash[:success] = "Configuration #{@benchmark_configuration.name} successfully created"
+      redirect_to action: :index
+    else
+      flash.now[:failure] = "There were some errors" 
+      render "index"
+    end
+  end
+
+  def update
+    if @benchmark_configuration.update_attributes(benchmark_configuration_params)
+      flash[:success] = "Configuration #{@benchmark_configuration.name} successfully updated"
+      redirect_to action: :index
+    else
+      flash.now[:failure] = "There were some errors" 
+      render "show"
+    end
+  end
+
+  def destroy
+    @benchmark_configuration = BenchmarkConfiguration.find(params[:id])
+
+    if @benchmark_configuration.destroy
+      flash[:success] = "Configuration #{@benchmark_configuration.name} successfully deleted"
+    else
+      flash[:error] = "Could not delete #{@benchmark_configuration.name} configuration"
+    end
+
+    redirect_to action: :index
+  end
+
+  private
+
+  def benchmark_configuration_params
+    strong_params = params.require(:benchmark_configuration).permit(:runtime_id, :operating_system_id)
+    strong_params.merge(language_id: Runtime.find(strong_params[:runtime_id]).language.id)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/controllers/settings/operating_systems_controller.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,49 @@
+class Settings::OperatingSystemsController < SettingsController
+  def index
+    @operating_system = OperatingSystem.new
+  end
+
+  def show
+    @operating_system = OperatingSystem.find(params[:id])
+  end
+
+  def create
+    @operating_system = OperatingSystem.new(operating_system_params) 
+
+    if @operating_system.save
+      flash[:success] = "Operating system #{@operating_system.name} successfully created"
+      redirect_to action: :index
+    else
+      flash.now[:failure] = "There were some errors" 
+      render "index"
+    end
+  end
+
+  def update
+    if @operating_system.update_attributes(operating_system_params)
+      flash[:success] = "Operating system #{@operating_system.name} successfully updated"
+      redirect_to action: :index
+    else
+      flash.now[:failure] = "There were some errors" 
+      render "show"
+    end
+  end
+
+  def destroy
+    @operating_system = OperatingSystem.find(params[:id])
+
+    if @operating_system.destroy
+      flash[:success] = "Operating system #{@operating_system.name} successfully deleted"
+    else
+      flash[:error] = "Could not delete #{@operating_system.name} operating_system"
+    end
+
+    redirect_to action: :index
+  end
+
+  private
+
+  def operating_system_params
+    params.require(:operating_system).permit(:name)
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/controllers/settings/runtimes_controller.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,51 @@
+class Settings::RuntimesController < SettingsController
+
+  def index
+    @runtime = Runtime.new
+  end
+
+  def show
+    @runtime = Runtime.find(params[:id])
+  end
+
+  def create
+    @runtime = Runtime.new(runtime_params)
+
+    if @runtime.save
+      flash[:success] = "Runtime #{@runtime.name} successfully created"
+      redirect_to action: :index
+    else
+      flash.now[:failure] = "There were some errors" 
+      render "index"
+    end
+  end
+  def update
+    @runtime = Runtime.find(params[:id])
+
+    if @runtime.update_attributes(runtime_params)
+      flash[:success] = "Runtime #{@runtime.name} successfully updated"
+      redirect_to action: :index
+    else
+      flash.now[:failure] = "There were some errors" 
+      render "index"
+    end
+  end
+
+  def destroy
+    @runtime = Runtime.find(params[:id])
+
+    if @runtime.destroy
+      flash[:success] = "Runtime #{@runtime.name} successfully deleted"
+    else
+      flash[:error] = "Could not delete #{@runtime.name} runtime"
+    end
+
+    redirect_to action: :index
+  end
+
+  private
+
+  def runtime_params
+    params.require(:runtime).permit(:name, :language_id)
+  end
+end
--- a/web/app/helpers/compare_helper.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/helpers/compare_helper.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -1,12 +1,12 @@
 module CompareHelper
 
-  def comparing_impls_headline(impls)
-    if impls.empty?
+  def comparing_runtimes_headline(runtimes)
+    if runtimes.empty?
       "Nothing to compare"
-    elsif impls.size == 1
-      "Showing #{impls.first.name}"
+    elsif runtimes.size == 1
+      "Showing #{runtimes.first.name}"
     else
-      "Comparing #{impls.map(&:name)[0..-2].join(", ")} and #{impls[-1].name}"
+      "Comparing #{runtimes.map(&:name)[0..-2].join(", ")} and #{runtimes[-1].name}"
     end
   end
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/helpers/settings/benchmark_configurations_helper.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,9 @@
+module Settings::BenchmarkConfigurationsHelper
+  def all_configurations
+    BenchmarkConfiguration.all
+  end
+
+  def all_configurations_options
+    all_configurations.map { |c| [c.name, c.id] }
+  end
+end
--- a/web/app/helpers/settings/benchmark_infos_helper.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/helpers/settings/benchmark_infos_helper.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -4,7 +4,7 @@
     BenchmarkInfo.all
   end
 
-  def benchmark_options
+  def all_benchmarks_options
     all_benchmarks.map { |l| [l.name, l.id] }
   end
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/helpers/settings/operating_systems_helper.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,11 @@
+module Settings::OperatingSystemsHelper
+
+  def all_operating_systems
+    OperatingSystem.all
+  end
+
+  def all_operating_systems_options
+    all_operating_systems.map { |l| [l.name, l.id] }
+  end
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/helpers/settings/runtimes_helper.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,21 @@
+module Settings::RuntimesHelper
+
+  def all_runtimes
+    Runtime.all
+  end
+
+  def all_runtimes_options
+    all_runtimes.map { |r| [r.name, r.id.to_s] }
+  end
+
+  def all_dates_when_performed(runtimeOrRuntimes)
+    if runtimeOrRuntimes.kind_of?(Runtime)
+      runtimeOrRuntimes.all_dates_when_performed
+    elsif runtimeOrRuntimes.kind_of?(Enumerable) || runtimeOrRuntimes.kind_of?(ActiveRecord::Relation)
+      SortedSet.new(runtimeOrRuntimes.map(&:all_dates_when_performed).flatten).to_a
+    else
+      raise "Unexpected argument type: #{runtimeOrRuntimes.class}"
+    end
+  end
+  
+end
--- a/web/app/models/benchmark_batch.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/models/benchmark_batch.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -11,7 +11,7 @@
 class BenchmarkBatch < ActiveRecord::Base
 
   has_many :benchmark_results, inverse_of: :benchmark_batch
-  belongs_to :language_implementation, dependent: :destroy, inverse_of: :benchmark_batches
+  belongs_to :benchmark_configuration, dependent: :destroy, inverse_of: :benchmark_batches
 
   validates_presence_of :performed_at
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/benchmark_configuration.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,12 @@
+class BenchmarkConfiguration < ActiveRecord::Base
+
+  has_many :benchmark_batches, inverse_of: :benchmark_configuration
+  belongs_to :language, dependent: :destroy, inverse_of: :benchmark_configurations
+  belongs_to :runtime, dependent: :destroy, inverse_of: :benchmark_configurations
+  belongs_to :operating_system, dependent: :destroy, inverse_of: :benchmark_configurations
+
+  def name
+    "#{runtime.name} (#{language.name}) on #{operating_system.name}"
+  end
+
+end
--- a/web/app/models/benchmark_result.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/models/benchmark_result.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -4,7 +4,6 @@
 #
 #  id                         :integer          not null, primary key
 #  benchmark_info_id          :integer
-#  language_implementation_id :integer
 #  performed_at               :datetime
 #  created_at                 :datetime
 #  updated_at                 :datetime
--- a/web/app/models/compare_query.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/models/compare_query.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -1,15 +1,15 @@
 class CompareQuery
   include ActiveModel::Model
 
-  attr_accessor :benchmark_id, :implementations
+  attr_accessor :benchmark_id, :runtimes
 
   def initialize(*args)
     super
-    @implementations ||= {}
+    @runtimes ||= {}
   end
 
-  def filtered_implementations
-    LanguageImplementation.where(id: impls_to_array_of_ids)
+  def filtered_runtimes
+    Runtime.where(id: runtimes_to_array_of_ids)
   end
 
   def benchmark_info
@@ -18,7 +18,7 @@
 
   private
 
-  def impls_to_array_of_ids
-    implementations.keys
+  def runtimes_to_array_of_ids
+    runtimes.keys
   end
 end
--- a/web/app/models/import_query.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/models/import_query.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -1,14 +1,12 @@
 class ImportQuery
   include ActiveModel::Model
  
-  attr_accessor :language_implementation_id, :performed_at
-
-  validates_presence_of :language_implementation_id
+  attr_accessor :configuration_id
 
   def store!
+    raise "fixme"
     batch = BenchmarkBatch.create!(
-      performed_at: performed_at_ensured,
-      language_implementation_id: language_implementation_id)
+      configuration_id: configuration_id)
     data_from_json["outcomes"].each do |b|
       b_params = b_to_params(b)
 
--- a/web/app/models/language.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/models/language.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -10,7 +10,8 @@
 
 class Language < ActiveRecord::Base
 
-  has_many :language_implementations, inverse_of: :language
+  has_many :runtimes, inverse_of: :language
+  has_many :benchmark_configurations, inverse_of: :language
 
   validates_presence_of :name
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/operating_system.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,5 @@
+class OperatingSystem < ActiveRecord::Base
+
+  has_many :benchmark_configurations, inverse_of: :operating_system
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/models/runtime.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,51 @@
+# == Schema Information
+#
+#
+#  id          :integer          not null, primary key
+#  name        :string(255)
+#  language_id :integer
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
+class Runtime < ActiveRecord::Base
+
+  belongs_to :language, dependent: :destroy, inverse_of: :runtimes
+  has_many :benchmark_configurations, inverse_of: :runtime
+
+  validates_presence_of :language_id, :name
+
+  def all_benchmark_infos
+    result = Set.new
+    benchmark_batches.each do |batch|
+      batch.benchmark_results.each { |r| result.add r.benchmark_info }
+    end
+    result
+  end
+
+  def all_dates_when_performed
+    SortedSet.new(benchmark_batches.map(&:performed_at).flatten).to_a
+  end
+
+  def results_at(time)
+    batch = benchmark_batches.where(performed_at: time).first
+    all_benchmark_infos.map do |info|
+      batch.result_for(info)
+    end
+  end
+
+  def results_of(benchmark_info, time)
+    batch_with_given_date = benchmark_batches
+    .where(performed_at: time)
+    .first
+
+    if batch_with_given_date
+      batch_with_given_date
+      .benchmark_results(benchmark_info: benchmark_info)
+      .first
+    else
+      nil
+    end
+  end
+
+end
--- a/web/app/views/compare/index.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/compare/index.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -6,8 +6,8 @@
       url: filter_compare_index_path,
       builder: CalipelFormBuilder do |f| %> 
       <%= f.fieldset_item "Comparing" do %>
-        <%= f.select_field_item :benchmark_id, benchmark_options %>
-        <%= f.checkboxes_item :implementations, language_impls_options %>
+        <%= f.select_field_item :benchmark_id, all_benchmarks_options %>
+        <%= f.checkboxes_item :runtimes, all_runtimes_options %>
         <%= f.submit_item "Compare" %>
       <% end %>
     <% end %>
@@ -15,17 +15,17 @@
 </div>
 
 <div class="span9">
-  <% unless @implementations.empty? %>
+  <% unless @runtimes.empty? %>
     <h1>
       Comparison for 
       <%= @benchmark_info.name %>
     </h1>
     <p>
-      <%= comparing_impls_headline(@implementations) %>
+      <%= comparing_runtimes_headline(@runtimes) %>
     </p>
 
     <%= render "index/compare_table", 
-      impls: @implementations, 
+      runtimes: @runtimes, 
       benchmark_info: @benchmark_info %>
   <% end %>
 </div>
--- a/web/app/views/imports/show_file_import.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/imports/show_file_import.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -6,8 +6,6 @@
   html: { multipart: true, class: "form-horizontal" } do |f| %>  
 
   <%= f.fieldset_item "Upload file with data" do %>
-    <%= f.date_field_item :performed_at %>
-    <%= f.select_field_item :language_implementation_id, language_impls_options %>
     <%= f.file_field_item :file %>
     <%= f.submit_item "Import" %>
   <% end %>
--- a/web/app/views/imports/show_post_import.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/imports/show_post_import.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -3,20 +3,20 @@
 <legend>Upload via HTTP POST</legend>
 
 <p>
-  Benchmark data are required to be sent using POST method in the <code>data</code>
+  Benchmark data are required to be sent using POST method in the <code>import</code>
   parameter. Both <strong>x-www-form-urlencoded</strong> and <strong>JSON</strong>
   content types are supported. Example <strong>curl</strong> parameters:
 </p>
 
 <pre>
-  curl '<%= push_imports_url(lang_impl_id: @impls.first.id) %>'  \
+  curl '<%= push_imports_url(configuration_id: 1234) %>'  \
     --compressed \
     -H 'Content-Type: application/x-www-form-urlencoded' \
     --data-urlencode 'import={"outcomes": [{"benchmark": {"class": "BenchmarkMicro","selector": "ackermann"},"times": [1579,1453,1422,1406,1437]}]}'
 </pre>
 
 <pre>
-  curl '<%= push_imports_url(lang_impl_id: @impls.first.id) %>'  \
+  curl '<%= push_imports_url(configuration_id: 1234) %>'  \
     --compressed \
     -H 'Content-Type: application/json' \
     --data '{"outcomes": [{"benchmark": {"class": "BenchmarkMicro","selector": "ackermann"},"times": [1579,1453,1422,1406,1437]}]}'
@@ -28,16 +28,16 @@
 
 <table class="table">
   <tr>
-    <th>Language Implementation</th>
+    <th>Runtime</th>
     <th>URL</th>
   </tr>
-  <% @impls.each do |impl| %> 
+  <% @runtimes.each do |runtime| %> 
     <tr>
       <td>
-        <%= impl.name %>
+        <%= runtime.name %>
       </td>
       <td>
-        <%= link_to push_imports_url(lang_impl_id: impl.id) %>
+        <%= link_to push_imports_url(runtime_id: runtime.id) %>
       </td>
     </tr>
     <% end %>
--- a/web/app/views/imports/show_text_import.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/imports/show_text_import.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -6,8 +6,6 @@
   html: { class: "form-horizontal" } do |f| %>  
 
   <%= f.fieldset_item "Paste text directly" do %>
-    <%= f.date_field_item :performed_at %>
-    <%= f.select_field_item :language_implementation_id, language_impls_options %>
     <%= f.text_area_item :text, class: "span4", size: "30x10" %>
     <%= f.submit_item "Import" %>
   <% end %>
--- a/web/app/views/index/_compare_table.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/index/_compare_table.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -5,19 +5,19 @@
       <thead>
         <tr>
           <th>Měsíc</th>
-          <% impls.each do |impl| %> 
-            <th><%= impl.name %></th>
+          <% runtimes.each do |runtime| %> 
+            <th><%= runtime.name %></th>
           <% end %>
         </tr>
       </thead>
       <tbody>
-        <% all_dates_when_performed(impls).each do |date| %>
+        <% all_dates_when_performed(runtimes).each do |date| %>
           <tr>
             <%= content_tag :th, 
               (make_chart ? date_to_millis(date) : t(date)), 
               'data-timestamp' => date_to_millis(date) %>
-            <% impls.each do |impl| %>
-              <td><%= impl.results_of(benchmark_info, date).try(:min_duration) %></td>
+            <% runtimes.each do |runtime| %>
+              <td><%= runtime.results_of(benchmark_info, date).try(:min_duration) %></td>
             <% end %>
           </tr>
         <% end %>
--- a/web/app/views/index/_timeline_table.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/index/_timeline_table.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -5,18 +5,18 @@
       <thead>
         <tr>
           <th>Month</th>
-          <% impl.all_benchmark_infos.each do |info| %> 
+          <% runtime.all_benchmark_infos.each do |info| %> 
             <th><%= info.name %></th>
           <% end %>
         </tr>
       </thead>
       <tbody>
-        <% all_dates_when_performed(impl).each do |date| %>
+        <% all_dates_when_performed(runtime).each do |date| %>
           <tr>
             <%= content_tag :th, 
               (make_chart ? date_to_millis(date) : t(date)), 
               'data-timestamp' => date_to_millis(date) %>
-            <% impl.results_at(date).each do |result| %>
+            <% runtime.results_at(date).each do |result| %>
               <td><%= result.try(:min_duration) %></td>
             <% end %>
           </tr>
--- a/web/app/views/index/index.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/index/index.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -8,11 +8,11 @@
     Simple micro-benchmarking framework inspired by SUnit a Caliper
   </P>
   <h2>Latest Test Results</h2>
-
+<% if @current_results.present? %>
   <p>
     Showing latest results for 
-    <%= @current_results.language_implementation.name %> 
-    (<%= @current_results.language_implementation.language.name %>)
+    <%= @current_results.runtime.name %> 
+    (<%= @current_results.runtime.language.name %>)
     performed at
     <%= t @current_results.performed_at %>
   </p>
@@ -23,12 +23,14 @@
 
   <p>
     Showing all results for 
-    <%= @current_results.language_implementation.name %> 
-    (<%= @current_results.language_implementation.language.name %>)
+    <%= @current_results.runtime.name %> 
+    (<%= @current_results.runtime.language.name %>)
   </p>
 
   <%= render 'timeline_table', 
-    impl: @current_results.language_implementation, 
+    runtime: @current_results.runtime, 
     make_chart: true %>
 
+<% end %>
+
 </div>
--- a/web/app/views/results/_results_nav.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/results/_results_nav.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -4,10 +4,10 @@
       <% all_languages.each do |lang| %>
         <li class="nav-header"><%= lang.name %></li>
         <ul class="nav nav-list">
-          <% lang.language_implementations.each do |impl| %>
-            <%= nav_tab(impl.name, 
+          <% lang.runtimes.each do |runtime| %>
+            <%= nav_tab(runtime.name, 
                         current_tab: current_tab, 
-                        class: "special") { link_to(impl.name, impl_results_path(id: impl.id)) } %>
+                        class: "special") { link_to(runtime.name, runtime_results_path(id: runtime.id)) } %>
           <% end %>
         </ul>
       <% end %>
--- a/web/app/views/results/impl_results.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/results/impl_results.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -1,13 +1,13 @@
-<%= currently_viewing_results_of @impl.name %>
+<%= currently_viewing_results_of @runtime.name %>
 
-<h1><%= @impl.language.name %></h1>
-<h2><%= @impl.name %></h2>
+<h1><%= @runtime.language.name %></h1>
+<h2><%= @runtime.name %></h2>
 
 <div id="results-accordion" class="accordion">
 
-  <%= render 'index/timeline_table', impl: @impl %>
+  <%= render 'index/timeline_table', runtime: @runtime %>
 
-  <% @impl.benchmark_batches.each do |result| %> 
+  <% @runtime.benchmark_batches.each do |result| %> 
 
     <div class="accordion-group">
       <div class="accordion-heading">
--- a/web/app/views/results/index.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/results/index.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -1,4 +1,4 @@
 <%= currently_viewing_results_of "nothing" %>
 
 <h1>Benchmark Results</h1>
-<p>Select language implementation from the left panel</p>
+<p>Select language runtime from the left panel</p>
--- a/web/app/views/settings/_settings_nav.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/settings/_settings_nav.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -4,9 +4,15 @@
     <%= nav_tab("languages", 
                 current_tab: current_tab, 
                 class: "special") { link_to("Languages", settings_languages_path) } %>
-    <%= nav_tab("language_implementations", 
+    <%= nav_tab("runtimes", 
+                current_tab: current_tab, 
+                class: "special") { link_to("Runtimes", settings_runtimes_path) } %>
+    <%= nav_tab("operating_systems", 
                 current_tab: current_tab, 
-                class: "special") { link_to("Language Implementations", settings_language_implementations_path) } %>
+                class: "special") { link_to("Operating Systems", settings_operating_systems_path) } %>
+    <%= nav_tab("configurations", 
+                current_tab: current_tab, 
+                class: "special") { link_to("Configurations", settings_benchmark_configurations_path) } %>
     <%= nav_tab("benchmarks", 
                 current_tab: current_tab, 
                 class: "special") { link_to("Benchmarks", settings_benchmark_infos_path) } %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/benchmark_configurations/_form.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,9 @@
+<%= form_for [:settings, benchmark_configuration], 
+  builder: CalipelFormBuilder,
+  html: { class: "form-horizontal" } do |f| %>
+  <%= f.fieldset_item heading do %>
+    <%= f.select_field_item :runtime_id, all_runtimes_options %>
+    <%= f.select_field_item :operating_system_id, all_operating_systems_options %>
+    <%= f.submit_item %>
+  <% end %>
+<% end %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/benchmark_configurations/_table.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,16 @@
+<table class="table">
+  <tr>
+    <th>Configuration</th>
+    <th>Operations</th>
+  </tr>
+  <% benchmark_configurations.each do |configuration| %> 
+    <tr>
+      <td><%= link_to configuration.name, [:settings, configuration] %></td>
+      <td>
+        <%= link_to( [:settings, configuration], 
+                    method: :delete,
+                    class: "btn btn-danger") { "#{glyph(:trash)} Delete".html_safe } %>
+      </td>
+    </tr>
+  <% end %>
+</table>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/benchmark_configurations/index.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,11 @@
+<%= currently_setting "configurations" %>
+
+<h1>Configurations</h1>
+
+<%= render 'form', 
+  benchmark_configuration: @benchmark_configuration, 
+  heading: "Create configuration" %>
+
+<% if all_configurations.present? %>
+  <%= render 'table', benchmark_configurations: all_configurations %>
+<% end %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/benchmark_configurations/show.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,8 @@
+<%= currently_setting "configurations" %>
+
+<h1><%= @benchmark_configuration.name %> configuration</h1>
+
+<%= render 'form', 
+  benchmark_configuration: @benchmark_configuration, 
+  heading: "Edit configuration #{@benchmark_configuration.name}" %>
+
--- a/web/app/views/settings/languages/index.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/settings/languages/index.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -2,12 +2,10 @@
 
 <h1>Languages</h1>
 
-<% if all_languages.present? %>
-  <%= render 'settings/languages/table', languages: all_languages %>
-<% end %>
+<%= render 'form', 
+  language: @language, 
+  heading: "Create language #{@language.name}" %>
 
-<hr/>
-
-<%= render 'settings/languages/form', 
-  language: @language,
-  heading: "Create new language" %>
+<% if all_languages.present? %>
+  <%= render 'table', languages: all_languages %>
+<% end %>
--- a/web/app/views/settings/languages/show.html.erb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/app/views/settings/languages/show.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -6,8 +6,8 @@
   language: @language, 
   heading: "Edit language #{@language.name}" %>
 
-<% if @language.language_implementations.present? %>
-  <%= render 'settings/language_implementations/table', 
-    impls: @language.language_implementations %>
+<% if @language.runtimes.present? %>
+  <%= render 'settings/runtimes/table', 
+    runtimes: @language.runtimes %>
 <% end %>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/operating_systems/_form.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,8 @@
+<%= form_for [:settings, @operating_system], 
+  builder: CalipelFormBuilder,
+  html: { class: "form-horizontal" } do |f| %>
+  <%= f.fieldset_item heading do %>
+    <%= f.text_field_item :name %>
+    <%= f.submit_item %>
+  <% end %>
+<% end %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/operating_systems/_table.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,16 @@
+<table class="table">
+  <tr>
+    <th>Operating systems</th>
+    <th>Operations</th>
+  </tr>
+  <% operating_systems.each do |os| %> 
+    <tr>
+      <td><%= link_to os.name, [:settings, os] %></td>
+      <td>
+        <%= link_to( [:settings, os], 
+                    method: :delete,
+                    class: "btn btn-danger") { "#{glyph(:trash)} Delete".html_safe } %>
+      </td>
+    </tr>
+  <% end %>
+</table>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/operating_systems/index.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,11 @@
+<%= currently_setting "operating_systems" %>
+
+<h1>Operating Systems</h1>
+
+<%= render 'form', 
+  language: @operating_system, 
+  heading: "Create operating system #{@operating_system.name}" %>
+
+<% if all_operating_systems.present? %>
+  <%= render 'table', operating_systems: all_operating_systems %>
+<% end %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/operating_systems/show.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,7 @@
+<%= currently_setting "operating_systems" %>
+
+<h1><%= @operating_system.name %> operating_system</h1>
+
+<%= render 'form', 
+  operating_system: @operating_system, 
+  heading: "Edit operating system #{@operating_system.name}" %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/runtimes/_form.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,9 @@
+<%= form_for [:settings, @runtime], 
+  builder: CalipelFormBuilder,
+  html: { class: "form-horizontal" } do |f| %>
+  <%= f.fieldset_item( heading || "Create new runtime" ) do %>
+    <%= f.text_field_item :name %>
+    <%= f.select_field_item :language_id, all_languages_options %>
+    <%= f.submit_item %>
+  <% end %>
+<% end %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/runtimes/_table.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,19 @@
+<table class="table">
+  <tr>
+    <th>Runtime</th>
+    <th>Language</th>
+    <th>Operations</th>
+  </tr>
+  <% runtimes.each do |runtime| %> 
+    <tr>
+      <td><%= link_to runtime.name, [:settings, runtime] %></td>
+      <td><%= runtime.language.name %></td>
+      <td>
+        <%= link_to( [:settings, runtime], 
+                    method: :delete,
+                    class: "btn btn-danger") { "#{glyph(:trash)} Delete".html_safe } %>
+      </td>
+    </tr>
+  <% end %>
+</table>
+<p class="muted">*Benchmark results are expected to be pushed as 'data' POST parameter</p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/runtimes/index.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,11 @@
+<%= currently_setting "runtimes" %>
+
+<h1>Runtimes</h1>
+
+<%= render 'form', 
+  runtime: @runtime, 
+  heading: "Create new #{@runtime.name}" %>
+
+<% if all_runtimes.present? %>
+  <%= render 'table', runtimes: all_runtimes %>
+<% end %>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/app/views/settings/runtimes/show.html.erb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,7 @@
+<%= currently_setting "runtimes" %>
+
+<h1><%= @runtime.name %> runtime</h1>
+
+<%= render 'form', 
+  runtime: @runtime, 
+  heading: "Edit runtime #{@runtime.name}" %>
--- a/web/config/routes.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/config/routes.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -14,13 +14,13 @@
       get "file-import", action: :show_file_import, as: 'new_file'
       post "file-import", action: :file_import, as: 'file'
       get "post-import", action: :show_post_import, as: 'new_post'
-      post ":lang_impl_id/push-import", action: :push_import, as: 'push'
+      post ":configuration_id/push-import", action: :push_import, as: 'push'
     end
   end
 
   resources :results, only: :index do
     collection do
-      get "implementation/:id", action: :impl_results, as: 'impl'
+      get "runtime/:id", action: :runtime_results, as: 'runtime'
     end
   end
 
@@ -30,8 +30,10 @@
 
   namespace "settings" do
     resources :languages, except: [:new]    
-    resources :language_implementations, except: [:new]    
+    resources :runtimes, except: [:new]    
+    resources :operating_systems, except: [:new]    
     resources :benchmark_infos, except: [:new]    
+    resources :benchmark_configurations, except: [:new]    
   end
 
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130624210546_create_benchmark_configurations.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,11 @@
+class CreateBenchmarkConfigurations < ActiveRecord::Migration
+  def change
+    create_table :configurations do |t|
+      t.integer :language_id
+      t.integer :runtime_id
+      t.integer :operating_system_id
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130624214019_rename_language_implementations_to_runtimes.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,11 @@
+class RenameLanguageImplementationsToRuntimes < ActiveRecord::Migration
+  def up
+    rename_table :language_implementations, :runtimes
+    rename_column :benchmark_batches, :language_implementation_id, :configuration_id
+  end
+
+  def down
+    rename_table :runtimes, :language_implementations
+    rename_column :benchmark_batches, :configuration_id, :language_implementation_id
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130624215029_create_operating_systems.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,9 @@
+class CreateOperatingSystems < ActiveRecord::Migration
+  def change
+    create_table :operating_systems do |t|
+      t.string :name
+
+      t.timestamps
+    end
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130624215124_drop_benchmark_parameters_table.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,5 @@
+class DropBenchmarkParametersTable < ActiveRecord::Migration
+  def change
+    drop_table :benchmark_parameters
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130625193900_rename_configurations_to_benchmark_configurations.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,5 @@
+class RenameConfigurationsToBenchmarkConfigurations < ActiveRecord::Migration
+  def change
+    rename_table :configurations, :benchmark_configurations
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130625200629_remove_performed_at_from_benchmark_results.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,5 @@
+class RemovePerformedAtFromBenchmarkResults < ActiveRecord::Migration
+  def change
+    remove_column :benchmark_results, :performed_at, :datetime
+  end
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/db/migrate/20130625200737_change_performed_at_to_datetime_on_benchmark_batches.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -0,0 +1,9 @@
+class ChangePerformedAtToDatetimeOnBenchmarkBatches < ActiveRecord::Migration
+  def up
+    change_column :benchmark_batches, :performed_at, :datetime
+  end
+
+  def down
+    change_column :benchmark_batches, :performed_at, :date
+  end
+end
--- a/web/db/schema.rb	Mon Jun 24 22:59:28 2013 +0200
+++ b/web/db/schema.rb	Tue Jun 25 22:11:10 2013 +0200
@@ -11,13 +11,21 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 20130622064337) do
+ActiveRecord::Schema.define(version: 20130625200737) do
 
   create_table "benchmark_batches", force: true do |t|
-    t.date     "performed_at"
+    t.datetime "performed_at"
     t.datetime "created_at"
     t.datetime "updated_at"
-    t.integer  "language_implementation_id"
+    t.integer  "configuration_id"
+  end
+
+  create_table "benchmark_configurations", force: true do |t|
+    t.integer  "language_id"
+    t.integer  "runtime_id"
+    t.integer  "operating_system_id"
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   create_table "benchmark_durations", force: true do |t|
@@ -35,33 +43,30 @@
     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.datetime "performed_at"
     t.datetime "created_at"
     t.datetime "updated_at"
     t.integer  "benchmark_batch_id"
   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
 
+  create_table "operating_systems", force: true do |t|
+    t.string   "name"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
+  create_table "runtimes", force: true do |t|
+    t.string   "name"
+    t.integer  "language_id"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
 end
Binary file web/erd.pdf has changed