├── log
└── .keep
├── app
├── mailers
│ └── .keep
├── models
│ ├── .keep
│ ├── concerns
│ │ └── .keep
│ ├── phrase.rb
│ ├── query_result.rb
│ ├── page.rb
│ ├── result.rb
│ ├── run.rb
│ └── query.rb
├── assets
│ ├── images
│ │ └── .keep
│ ├── javascripts
│ │ ├── bootstrap.js.coffee
│ │ ├── pages.js.coffee
│ │ ├── phrases.js.coffee
│ │ ├── queries.js.coffee
│ │ ├── runs.js.coffee
│ │ ├── query_results.js.coffee
│ │ ├── util
│ │ │ └── throttle.js.coffee
│ │ ├── application.js
│ │ └── results.js.coffee
│ └── stylesheets
│ │ ├── runs.css.scss
│ │ ├── pages.css.scss
│ │ ├── phrases.css.scss
│ │ ├── queries.css.scss
│ │ ├── results.css.scss
│ │ ├── query_results.css.scss
│ │ ├── application.css
│ │ ├── scaffolds.css.scss
│ │ └── bootstrap_and_overrides.css.less
├── controllers
│ ├── concerns
│ │ └── .keep
│ ├── application_controller.rb
│ ├── runs_controller.rb
│ ├── pages_controller.rb
│ ├── queries_controller.rb
│ ├── phrases_controller.rb
│ ├── results_controller.rb
│ └── query_results_controller.rb
├── views
│ ├── querys
│ │ └── index.html.erb
│ ├── runs
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── edit.html.erb
│ │ ├── new.html.erb
│ │ ├── _form.html.erb
│ │ ├── show.html.erb
│ │ └── index.html.erb
│ ├── phrases
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── edit.html.erb
│ │ ├── new.html.erb
│ │ ├── _form.html.erb
│ │ ├── show.html.erb
│ │ └── index.html.erb
│ ├── queries
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── edit.html.erb
│ │ ├── new.html.erb
│ │ ├── _form.html.erb
│ │ ├── show.html.erb
│ │ └── index.html.erb
│ ├── pages
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── new.html.erb
│ │ ├── edit.html.erb
│ │ ├── _form.html.erb
│ │ ├── show.html.erb
│ │ └── index.html.erb
│ ├── results
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── edit.html.erb
│ │ ├── new.html.erb
│ │ ├── _form.html.erb
│ │ ├── show.html.erb
│ │ └── index.html.erb
│ ├── query_results
│ │ ├── show.json.jbuilder
│ │ ├── index.json.jbuilder
│ │ ├── new.html.erb
│ │ ├── edit.html.erb
│ │ ├── _form.html.erb
│ │ ├── show.html.erb
│ │ └── index.html.erb
│ └── layouts
│ │ └── application.html.erb
└── helpers
│ ├── pages_helper.rb
│ ├── runs_helper.rb
│ ├── phrases_helper.rb
│ ├── queries_helper.rb
│ ├── results_helper.rb
│ ├── application_helper.rb
│ └── query_results_helper.rb
├── lib
├── assets
│ └── .keep
└── tasks
│ └── .keep
├── public
├── favicon.ico
├── robots.txt
├── 500.html
├── 422.html
└── 404.html
├── test
├── helpers
│ ├── .keep
│ ├── pages_helper_test.rb
│ ├── runs_helper_test.rb
│ ├── phrases_helper_test.rb
│ ├── queries_helper_test.rb
│ ├── results_helper_test.rb
│ └── query_results_helper_test.rb
├── mailers
│ └── .keep
├── models
│ ├── .keep
│ ├── run_test.rb
│ ├── page_test.rb
│ ├── query_test.rb
│ ├── phrase_test.rb
│ ├── result_test.rb
│ └── query_result_test.rb
├── controllers
│ ├── .keep
│ ├── runs_controller_test.rb
│ ├── phrases_controller_test.rb
│ ├── queries_controller_test.rb
│ ├── pages_controller_test.rb
│ ├── results_controller_test.rb
│ └── query_results_controller_test.rb
├── fixtures
│ ├── .keep
│ ├── phrases.yml
│ ├── runs.yml
│ ├── queries.yml
│ ├── query_results.yml
│ ├── results.yml
│ └── pages.yml
├── integration
│ └── .keep
└── test_helper.rb
├── vendor
└── assets
│ ├── javascripts
│ └── .keep
│ └── stylesheets
│ └── .keep
├── bin
├── rake
├── bundle
└── rails
├── config.ru
├── config
├── environment.rb
├── initializers
│ ├── session_store.rb
│ ├── filter_parameter_logging.rb
│ ├── mime_types.rb
│ ├── backtrace_silencers.rb
│ ├── wrap_parameters.rb
│ ├── inflections.rb
│ └── secret_token.rb
├── boot.rb
├── locales
│ ├── en.bootstrap.yml
│ └── en.yml
├── database.yml
├── application.rb
├── environments
│ ├── development.rb
│ ├── test.rb
│ └── production.rb
└── routes.rb
├── db
├── migrate
│ ├── 20131129155621_add_phrase_id_to_queries.rb
│ ├── 20131201175606_add_weight_to_phrase.rb
│ ├── 20131129135155_create_runs.rb
│ ├── 20131129134633_create_phrases.rb
│ ├── 20131129135717_create_queries.rb
│ ├── 20131129135959_create_pages.rb
│ ├── 20131129162126_create_query_results.rb
│ └── 20131129145128_create_results.rb
├── schema.rb
└── seeds.rb
├── Rakefile
├── .gitignore
├── README.rdoc
├── Gemfile
└── Gemfile.lock
/log/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/mailers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/fixtures/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/views/querys/index.html.erb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/assets/stylesheets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/helpers/pages_helper.rb:
--------------------------------------------------------------------------------
1 | module PagesHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/runs_helper.rb:
--------------------------------------------------------------------------------
1 | module RunsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/phrases_helper.rb:
--------------------------------------------------------------------------------
1 | module PhrasesHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/queries_helper.rb:
--------------------------------------------------------------------------------
1 | module QueriesHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/results_helper.rb:
--------------------------------------------------------------------------------
1 | module ResultsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/models/phrase.rb:
--------------------------------------------------------------------------------
1 | class Phrase < ActiveRecord::Base
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/query_results_helper.rb:
--------------------------------------------------------------------------------
1 | module QueryResultsHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/views/runs/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! @run, :root_url, :description, :created_at, :updated_at
2 |
--------------------------------------------------------------------------------
/app/views/phrases/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! @phrase, :text, :description, :created_at, :updated_at
2 |
--------------------------------------------------------------------------------
/app/views/queries/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! @query, :run_id, :url, :response, :created_at, :updated_at
2 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/test/helpers/pages_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PagesHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/test/helpers/runs_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class RunsHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/app/views/pages/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! @page, :wiki_id, :article_id, :title, :url, :lang, :created_at, :updated_at
2 |
--------------------------------------------------------------------------------
/test/helpers/phrases_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PhrasesHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/test/helpers/queries_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class QueriesHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/test/helpers/results_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class ResultsHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/app/views/results/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! @result, :page_id, :phrase_id, :score, :comment, :who, :created_at, :updated_at
2 |
--------------------------------------------------------------------------------
/test/helpers/query_results_helper_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class QueryResultsHelperTest < ActionView::TestCase
4 | end
5 |
--------------------------------------------------------------------------------
/app/views/query_results/show.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.extract! @query_result, :query_id, :page_id, :result_id, :position, :created_at, :updated_at
2 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/bootstrap.js.coffee:
--------------------------------------------------------------------------------
1 | jQuery ->
2 | $("a[rel~=popover], .has-popover").popover()
3 | $("a[rel~=tooltip], .has-tooltip").tooltip()
4 |
--------------------------------------------------------------------------------
/app/views/runs/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array!(@runs) do |run|
2 | json.extract! run, :root_url, :description
3 | json.url run_url(run, format: :json)
4 | end
5 |
--------------------------------------------------------------------------------
/test/models/run_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class RunTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../../config/application', __FILE__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/test/models/page_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PageTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/models/query_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class QueryTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/models/phrase_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PhraseTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/models/result_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class ResultTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/app/views/phrases/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array!(@phrases) do |phrase|
2 | json.extract! phrase, :text, :description
3 | json.url phrase_url(phrase, format: :json)
4 | end
5 |
--------------------------------------------------------------------------------
/app/views/queries/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array!(@queries) do |query|
2 | json.extract! query, :run_id, :url, :response
3 | json.url query_url(query, format: :json)
4 | end
5 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/test/models/query_result_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class QueryResultTest < ActiveSupport::TestCase
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/app/views/pages/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array!(@pages) do |page|
2 | json.extract! page, :wiki_id, :article_id, :title, :url, :lang
3 | json.url page_url(page, format: :json)
4 | end
5 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Evaluator::Application.initialize!
6 |
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Evaluator::Application.config.session_store :cookie_store, key: '_evaluator_session'
4 |
--------------------------------------------------------------------------------
/db/migrate/20131129155621_add_phrase_id_to_queries.rb:
--------------------------------------------------------------------------------
1 | class AddPhraseIdToQueries < ActiveRecord::Migration
2 | def change
3 | add_column :queries, :phrase_id, :integer
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20131201175606_add_weight_to_phrase.rb:
--------------------------------------------------------------------------------
1 | class AddWeightToPhrase < ActiveRecord::Migration
2 | def change
3 | add_column :phrases, :weight, :float, :default => 1
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/app/views/results/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array!(@results) do |result|
2 | json.extract! result, :page_id, :phrase_id, :score, :comment, :who
3 | json.url result_url(result, format: :json)
4 | end
5 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/runs.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Runs controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/pages.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Pages controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/phrases.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Phrases controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/queries.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Queries controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/results.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Results controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/query_results.css.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the QueryResults controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/views/query_results/index.json.jbuilder:
--------------------------------------------------------------------------------
1 | json.array!(@query_results) do |query_result|
2 | json.extract! query_result, :query_id, :page_id, :result_id, :position
3 | json.url query_result_url(query_result, format: :json)
4 | end
5 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/test/fixtures/phrases.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2 |
3 | one:
4 | text: MyString
5 | description: MyText
6 |
7 | two:
8 | text: MyString
9 | description: MyText
10 |
--------------------------------------------------------------------------------
/test/fixtures/runs.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2 |
3 | one:
4 | root_url: MyString
5 | description: MyText
6 |
7 | two:
8 | root_url: MyString
9 | description: MyText
10 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 | # Mime::Type.register_alias "text/html", :iphone
6 |
--------------------------------------------------------------------------------
/app/assets/javascripts/pages.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/phrases.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/queries.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/runs.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/models/query_result.rb:
--------------------------------------------------------------------------------
1 | class QueryResult < ActiveRecord::Base
2 | belongs_to :page
3 | belongs_to :result
4 | belongs_to :query
5 |
6 | def score
7 | (2**-position) * (result.score or 0) * (result.phrase.weight)
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20131129135155_create_runs.rb:
--------------------------------------------------------------------------------
1 | class CreateRuns < ActiveRecord::Migration
2 | def change
3 | create_table :runs do |t|
4 | t.string :root_url
5 | t.text :description
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/app/assets/javascripts/query_results.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/views/pages/new.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Page -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/runs/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Run -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/runs/new.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Run -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/db/migrate/20131129134633_create_phrases.rb:
--------------------------------------------------------------------------------
1 | class CreatePhrases < ActiveRecord::Migration
2 | def change
3 | create_table :phrases do |t|
4 | t.string :text
5 | t.text :description
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/app/models/page.rb:
--------------------------------------------------------------------------------
1 | class Page < ActiveRecord::Base
2 |
3 | def self.find_or_new(articleJson)
4 | page = Page.find_by_url(articleJson[:url])
5 | if page == nil
6 | page = Page.create articleJson
7 | end
8 | return page
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/app/views/pages/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Page -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/phrases/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Phrase -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/phrases/new.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Phrase -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/queries/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Query -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/queries/new.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Query -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/results/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Result -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/results/new.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Result -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/test/fixtures/queries.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2 |
3 | one:
4 | run_id: 1
5 | url: MyString
6 | response: MyText
7 |
8 | two:
9 | run_id: 1
10 | url: MyString
11 | response: MyText
12 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Evaluator::Application.load_tasks
7 |
--------------------------------------------------------------------------------
/app/views/query_results/new.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = QueryResult -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/app/views/query_results/edit.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = QueryResult -%>
2 |
5 | <%= render :partial => 'form' %>
6 |
--------------------------------------------------------------------------------
/db/migrate/20131129135717_create_queries.rb:
--------------------------------------------------------------------------------
1 | class CreateQueries < ActiveRecord::Migration
2 | def change
3 | create_table :queries do |t|
4 | t.integer :run_id
5 | t.string :url
6 | t.text :response
7 |
8 | t.timestamps
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/test/fixtures/query_results.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2 |
3 | one:
4 | query_id: 1
5 | page_id: 1
6 | result_id: 1
7 | position: 1
8 |
9 | two:
10 | query_id: 1
11 | page_id: 1
12 | result_id: 1
13 | position: 1
14 |
--------------------------------------------------------------------------------
/db/migrate/20131129135959_create_pages.rb:
--------------------------------------------------------------------------------
1 | class CreatePages < ActiveRecord::Migration
2 | def change
3 | create_table :pages do |t|
4 | t.integer :wiki_id
5 | t.integer :article_id
6 | t.string :title
7 | t.string :url
8 | t.string :lang
9 |
10 | t.timestamps
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/test/fixtures/results.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2 |
3 | one:
4 | page_id: 1
5 | phrase_id: 1
6 | score: 1.5
7 | comment: MyText
8 | who: MyString
9 |
10 | two:
11 | page_id: 1
12 | phrase_id: 1
13 | score: 1.5
14 | comment: MyText
15 | who: MyString
16 |
--------------------------------------------------------------------------------
/db/migrate/20131129162126_create_query_results.rb:
--------------------------------------------------------------------------------
1 | class CreateQueryResults < ActiveRecord::Migration
2 | def change
3 | create_table :query_results do |t|
4 | t.integer :query_id
5 | t.integer :page_id
6 | t.integer :result_id
7 | t.integer :position
8 |
9 | t.timestamps
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/test/fixtures/pages.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2 |
3 | one:
4 | wiki_id: 1
5 | article_id: 1
6 | title: MyString
7 | url: MyString
8 | lang: MyString
9 |
10 | two:
11 | wiki_id: 1
12 | article_id: 1
13 | title: MyString
14 | url: MyString
15 | lang: MyString
16 |
--------------------------------------------------------------------------------
/db/migrate/20131129145128_create_results.rb:
--------------------------------------------------------------------------------
1 | class CreateResults < ActiveRecord::Migration
2 | def change
3 | create_table :results do |t|
4 | t.integer :page_id
5 | t.integer :phrase_id
6 | t.float :score, default: 0, null: false
7 | t.text :comment
8 | t.string :who
9 |
10 | t.timestamps
11 | end
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/app/assets/javascripts/util/throttle.js.coffee:
--------------------------------------------------------------------------------
1 | class Throttle
2 | constructor: (@_delay, @_reduce) ->
3 | @_queue = []
4 | @_pending = false
5 |
6 | put: (ev) ->
7 | @_queue.push(ev)
8 | if !@_pending
9 | @_pending = true
10 | window.setTimeout(( => @reduce()), @_delay)
11 |
12 | reduce: ->
13 | @_reduce(@_queue)
14 | @_pending = false
15 | @_queue = []
16 |
17 | window.Throttle = Throttle
18 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/app/models/result.rb:
--------------------------------------------------------------------------------
1 | class Result < ActiveRecord::Base
2 | belongs_to :page
3 | belongs_to :phrase
4 | validates :page_id, presence: true
5 | validates :phrase_id, presence: true
6 |
7 | def self.find_or_create(o)
8 | result = Result.find(:first,
9 | :conditions => { :page_id => o[:page].id, :phrase_id => o[:phrase].id }
10 | )
11 | if result == nil
12 | result = Result.create({ :page_id => o[:page].id, :phrase_id => o[:phrase].id })
13 | end
14 | return result
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
18 | # vim swp files
19 | *.swp
20 |
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV["RAILS_ENV"] ||= "test"
2 | require File.expand_path('../../config/environment', __FILE__)
3 | require 'rails/test_help'
4 |
5 | class ActiveSupport::TestCase
6 | ActiveRecord::Migration.check_pending!
7 |
8 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9 | #
10 | # Note: You'll currently still have to declare fixtures explicitly in integration tests
11 | # -- they do not yet inherit this setting
12 | fixtures :all
13 |
14 | # Add more helper methods to be used by all tests here...
15 | end
16 |
--------------------------------------------------------------------------------
/app/models/run.rb:
--------------------------------------------------------------------------------
1 | class Run < ActiveRecord::Base
2 | has_many :queries
3 | validates :root_url, presence: true
4 |
5 | def self.do(url, description)
6 | run = Run.create(:root_url=>url, :description => description)
7 | run.save!
8 | for phrase in Phrase.all
9 | q = run.queries.create(
10 | :url => "#{url}?#{ { query: phrase.text }.to_query }",
11 | :phrase => phrase,
12 | )
13 | q.execute
14 | end
15 | return run
16 | end
17 |
18 | def score
19 | queries.map{|x| x.score}.inject(0, :+)
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/config/locales/en.bootstrap.yml:
--------------------------------------------------------------------------------
1 | # Sample localization file for English. Add more files in this directory for other locales.
2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3 |
4 | en:
5 | helpers:
6 | actions: "Actions"
7 | links:
8 | back: "Back"
9 | cancel: "Cancel"
10 | confirm: "Are you sure?"
11 | destroy: "Delete"
12 | new: "New"
13 | edit: "Edit"
14 | titles:
15 | edit: "Edit %{model}"
16 | save: "Save %{model}"
17 | new: "New %{model}"
18 | delete: "Delete %{model}"
19 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/README.rdoc:
--------------------------------------------------------------------------------
1 | == README
2 |
3 | This README would normally document whatever steps are necessary to get the
4 | application up and running.
5 |
6 | Things you may want to cover:
7 |
8 | * Ruby version
9 |
10 | * System dependencies
11 |
12 | * Configuration
13 |
14 | * Database creation
15 |
16 | * Database initialization
17 |
18 | * How to run the test suite
19 |
20 | * Services (job queues, cache servers, search engines, etc.)
21 |
22 | * Deployment instructions
23 |
24 | * ...
25 |
26 |
27 | Please feel free to use a different markup language if you do not plan to run
28 | rake doc:app .
29 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the top of the
9 | * compiled file, but it's generally better to create a new file per style scope.
10 | *
11 | *= require_self
12 | *= require_tree .
13 | */
14 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # SQLite version 3.x
2 | # gem install sqlite3
3 | #
4 | # Ensure the SQLite 3 gem is defined in your Gemfile
5 | # gem 'sqlite3'
6 | development:
7 | adapter: sqlite3
8 | database: db/development.sqlite3
9 | pool: 5
10 | timeout: 5000
11 |
12 | # Warning: The database defined as "test" will be erased and
13 | # re-generated from your development database when you run "rake".
14 | # Do not set this db to the same as development or production.
15 | test:
16 | adapter: sqlite3
17 | database: db/test.sqlite3
18 | pool: 5
19 | timeout: 5000
20 |
21 | production:
22 | adapter: sqlite3
23 | database: db/production.sqlite3
24 | pool: 5
25 | timeout: 5000
26 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rake secret` to generate a secure secret key.
9 |
10 | # Make sure your secret_key_base is kept private
11 | # if you're sharing your code publicly.
12 | Evaluator::Application.config.secret_key_base = 'e92ba00e83f7d7ae80d2f05d8cea376e06dee8931199d8b12d7193bf3d2403c8c56fb939a240fde218e05089e597de517eb4da0d79b12be64a78b8da1d6636c9'
13 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/app/views/runs/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @run, :html => { :class => 'form-horizontal' } do |f| %>
2 |
3 | <%= f.label :root_url, :class => 'control-label' %>
4 |
5 | <%= f.text_field :root_url, :class => 'text_field' %>
6 |
7 |
8 |
9 | <%= f.label :description, :class => 'control-label' %>
10 |
11 | <%= f.text_field :description, :class => 'text_field' %>
12 |
13 |
14 |
15 |
16 | <%= f.submit nil, :class => 'btn btn-primary' %>
17 | <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
18 | runs_path, :class => 'btn' %>
19 |
20 | <% end %>
21 |
--------------------------------------------------------------------------------
/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file.
9 | //
10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require jquery
14 | //= require jquery_ujs
15 | //= require twitter/bootstrap
16 | //= require bootstrap-slider
17 | //= require turbolinks
18 | //= require_tree .
19 | //= require_tree ./util/
20 |
--------------------------------------------------------------------------------
/app/assets/javascripts/results.js.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
5 | $ ->
6 | $('.score-slider').each (i,e) =>
7 | throttle = new Throttle 200, (arr) =>
8 | value = slider.slider("getValue")
9 | url = $(e).data('update-url')
10 | attribute = $(e).data('update-attribute')
11 | data = {}
12 | data[attribute] = value
13 | $.ajax(url,
14 | type: "PUT"
15 | dataType: "json"
16 | data: data)
17 | .done( => console.log('done') )
18 | .always( => console.log('always') )
19 | .fail( => console.log('fail') )
20 | slider = $(e).slider()
21 | slider.on "slide", =>
22 | throttle.put(null)
23 |
--------------------------------------------------------------------------------
/app/models/query.rb:
--------------------------------------------------------------------------------
1 | require 'open-uri'
2 |
3 | class Query < ActiveRecord::Base
4 | belongs_to :run
5 | belongs_to :phrase
6 | has_many :query_results
7 |
8 | def execute()
9 | self.response= open(self.url).read
10 | self.save!
11 | parsed = JSON.parse(self.response)
12 | pos = 0
13 | for articleJson in parsed['articles']
14 | page = Page.find_or_new(
15 | :wiki_id => articleJson['wikiId'],
16 | :article_id => articleJson['articleId'],
17 | :url => articleJson['url'],
18 | :lang => articleJson['lang'],
19 | )
20 | result = Result.find_or_create(
21 | :page => page,
22 | :phrase => self.phrase,
23 | )
24 | pos += 1
25 | self.query_results.create(
26 | :page => page,
27 | :result => result,
28 | :position => pos,
29 | )
30 | end
31 | end
32 |
33 | def score
34 | query_results.map{|x| x.score}.inject(0, :+)
35 | end
36 | end
37 |
--------------------------------------------------------------------------------
/app/views/phrases/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @phrase, :html => { :class => 'form-horizontal' } do |f| %>
2 |
3 | <%= f.label :text, :class => 'control-label' %>
4 |
5 | <%= f.text_field :text, :class => 'text_field' %>
6 |
7 |
8 |
9 | <%= f.label :description, :class => 'control-label' %>
10 |
11 | <%= f.text_field :description, :class => 'text_field' %>
12 |
13 |
14 |
15 | <%= f.label :weight, :class => 'control-label' %>
16 |
17 | <%= f.text_field :weight, :class => 'text_field' %>
18 |
19 |
20 |
21 |
22 | <%= f.submit nil, :class => 'btn btn-primary' %>
23 | <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
24 | phrases_path, :class => 'btn' %>
25 |
26 | <% end %>
27 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(:default, Rails.env)
8 |
9 | module Evaluator
10 | class Application < Rails::Application
11 | # Settings in config/environments/* take precedence over those specified here.
12 | # Application configuration should go into files in config/initializers
13 | # -- all .rb files in that directory are automatically loaded.
14 |
15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17 | # config.time_zone = 'Central Time (US & Canada)'
18 |
19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21 | # config.i18n.default_locale = :de
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/app/views/phrases/show.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Phrase -%>
2 |
5 |
6 |
7 | <%= model_class.human_attribute_name(:text) %>:
8 | <%= @phrase.text %>
9 | <%= model_class.human_attribute_name(:description) %>:
10 | <%= @phrase.description %>
11 | <%= model_class.human_attribute_name(:weight) %>:
12 | <%= @phrase.weight %>
13 |
14 |
15 |
16 | <%= link_to t('.back', :default => t("helpers.links.back")),
17 | phrases_path, :class => 'btn' %>
18 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
19 | edit_phrase_path(@phrase), :class => 'btn' %>
20 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
21 | phrase_path(@phrase),
22 | :method => 'delete',
23 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
24 | :class => 'btn btn-danger' %>
25 |
26 |
--------------------------------------------------------------------------------
/app/views/queries/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @query, :html => { :class => 'form-horizontal' } do |f| %>
2 |
3 | <%= f.label :run_id, :class => 'control-label' %>
4 |
5 | <%= f.text_field :run_id, :class => 'text_field' %>
6 |
7 |
8 |
9 | <%= f.label :url, :class => 'control-label' %>
10 |
11 | <%= f.text_field :url, :class => 'text_field' %>
12 |
13 |
14 |
15 | <%= f.label :response, :class => 'control-label' %>
16 |
17 | <%= f.text_field :response, :class => 'text_field' %>
18 |
19 |
20 |
21 | <%= f.label :phrase_id, :class => 'control-label' %>
22 |
23 | <%= f.text_field :phrase_id, :class => 'text_field' %>
24 |
25 |
26 |
27 |
28 | <%= f.submit nil, :class => 'btn btn-primary' %>
29 | <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
30 | queries_path, :class => 'btn' %>
31 |
32 | <% end %>
33 |
--------------------------------------------------------------------------------
/app/views/query_results/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @query_result, :html => { :class => 'form-horizontal' } do |f| %>
2 |
3 | <%= f.label :query_id, :class => 'control-label' %>
4 |
5 | <%= f.text_field :query_id, :class => 'text_field' %>
6 |
7 |
8 |
9 | <%= f.label :page_id, :class => 'control-label' %>
10 |
11 | <%= f.text_field :page_id, :class => 'text_field' %>
12 |
13 |
14 |
15 | <%= f.label :result_id, :class => 'control-label' %>
16 |
17 | <%= f.text_field :result_id, :class => 'text_field' %>
18 |
19 |
20 |
21 | <%= f.label :position, :class => 'control-label' %>
22 |
23 | <%= f.text_field :position, :class => 'text_field' %>
24 |
25 |
26 |
27 |
28 | <%= f.submit nil, :class => 'btn btn-primary' %>
29 | <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
30 | query_results_path, :class => 'btn' %>
31 |
32 | <% end %>
33 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Evaluator::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports and disable caching.
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send.
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger.
20 | config.active_support.deprecation = :log
21 |
22 | # Raise an error on page load if there are pending migrations
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 | end
30 |
--------------------------------------------------------------------------------
/test/controllers/runs_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class RunsControllerTest < ActionController::TestCase
4 | setup do
5 | @run = runs(:one)
6 | end
7 |
8 | test "should get index" do
9 | get :index
10 | assert_response :success
11 | assert_not_nil assigns(:runs)
12 | end
13 |
14 | test "should get new" do
15 | get :new
16 | assert_response :success
17 | end
18 |
19 | test "should create run" do
20 | assert_difference('Run.count') do
21 | post :create, run: { description: @run.description, root_url: @run.root_url }
22 | end
23 |
24 | assert_redirected_to run_path(assigns(:run))
25 | end
26 |
27 | test "should show run" do
28 | get :show, id: @run
29 | assert_response :success
30 | end
31 |
32 | test "should get edit" do
33 | get :edit, id: @run
34 | assert_response :success
35 | end
36 |
37 | test "should update run" do
38 | patch :update, id: @run, run: { description: @run.description, root_url: @run.root_url }
39 | assert_redirected_to run_path(assigns(:run))
40 | end
41 |
42 | test "should destroy run" do
43 | assert_difference('Run.count', -1) do
44 | delete :destroy, id: @run
45 | end
46 |
47 | assert_redirected_to runs_path
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/app/views/queries/show.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Query -%>
2 |
5 |
6 |
7 | <%= model_class.human_attribute_name(:run_id) %>:
8 | <%= @query.run_id %>
9 | <%= model_class.human_attribute_name(:url) %>:
10 | <%= @query.url %>
11 | <%= model_class.human_attribute_name(:response) %>:
12 | <%= @query.response %>
13 | <%= model_class.human_attribute_name(:phrase_id) %>:
14 | <%= @query.phrase_id %>
15 |
16 |
17 |
18 | <%= link_to t('.back', :default => t("helpers.links.back")),
19 | queries_path, :class => 'btn' %>
20 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
21 | edit_query_path(@query), :class => 'btn' %>
22 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
23 | query_path(@query),
24 | :method => 'delete',
25 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
26 | :class => 'btn btn-danger' %>
27 |
28 |
--------------------------------------------------------------------------------
/test/controllers/phrases_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PhrasesControllerTest < ActionController::TestCase
4 | setup do
5 | @phrase = phrases(:one)
6 | end
7 |
8 | test "should get index" do
9 | get :index
10 | assert_response :success
11 | assert_not_nil assigns(:phrases)
12 | end
13 |
14 | test "should get new" do
15 | get :new
16 | assert_response :success
17 | end
18 |
19 | test "should create phrase" do
20 | assert_difference('Phrase.count') do
21 | post :create, phrase: { description: @phrase.description, text: @phrase.text }
22 | end
23 |
24 | assert_redirected_to phrase_path(assigns(:phrase))
25 | end
26 |
27 | test "should show phrase" do
28 | get :show, id: @phrase
29 | assert_response :success
30 | end
31 |
32 | test "should get edit" do
33 | get :edit, id: @phrase
34 | assert_response :success
35 | end
36 |
37 | test "should update phrase" do
38 | patch :update, id: @phrase, phrase: { description: @phrase.description, text: @phrase.text }
39 | assert_redirected_to phrase_path(assigns(:phrase))
40 | end
41 |
42 | test "should destroy phrase" do
43 | assert_difference('Phrase.count', -1) do
44 | delete :destroy, id: @phrase
45 | end
46 |
47 | assert_redirected_to phrases_path
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/test/controllers/queries_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class QueriesControllerTest < ActionController::TestCase
4 | setup do
5 | @query = queries(:one)
6 | end
7 |
8 | test "should get index" do
9 | get :index
10 | assert_response :success
11 | assert_not_nil assigns(:queries)
12 | end
13 |
14 | test "should get new" do
15 | get :new
16 | assert_response :success
17 | end
18 |
19 | test "should create query" do
20 | assert_difference('Query.count') do
21 | post :create, query: { response: @query.response, run_id: @query.run_id, url: @query.url }
22 | end
23 |
24 | assert_redirected_to query_path(assigns(:query))
25 | end
26 |
27 | test "should show query" do
28 | get :show, id: @query
29 | assert_response :success
30 | end
31 |
32 | test "should get edit" do
33 | get :edit, id: @query
34 | assert_response :success
35 | end
36 |
37 | test "should update query" do
38 | patch :update, id: @query, query: { response: @query.response, run_id: @query.run_id, url: @query.url }
39 | assert_redirected_to query_path(assigns(:query))
40 | end
41 |
42 | test "should destroy query" do
43 | assert_difference('Query.count', -1) do
44 | delete :destroy, id: @query
45 | end
46 |
47 | assert_redirected_to queries_path
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/scaffolds.css.scss:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #fff;
3 | color: #333;
4 | font-family: verdana, arial, helvetica, sans-serif;
5 | font-size: 13px;
6 | line-height: 18px;
7 | }
8 |
9 | p, ol, ul, td {
10 | font-family: verdana, arial, helvetica, sans-serif;
11 | font-size: 13px;
12 | line-height: 18px;
13 | }
14 |
15 | pre {
16 | background-color: #eee;
17 | padding: 10px;
18 | font-size: 11px;
19 | }
20 |
21 | a {
22 | color: #000;
23 | &:visited {
24 | color: #666;
25 | }
26 | &:hover {
27 | color: #fff;
28 | background-color: #000;
29 | }
30 | }
31 |
32 | div {
33 | &.field, &.actions {
34 | margin-bottom: 10px;
35 | }
36 | }
37 |
38 | #notice {
39 | color: green;
40 | }
41 |
42 | .field_with_errors {
43 | padding: 2px;
44 | background-color: red;
45 | display: table;
46 | }
47 |
48 | #error_explanation {
49 | width: 450px;
50 | border: 2px solid red;
51 | padding: 7px;
52 | padding-bottom: 0;
53 | margin-bottom: 20px;
54 | background-color: #f0f0f0;
55 | h2 {
56 | text-align: left;
57 | font-weight: bold;
58 | padding: 5px 5px 5px 15px;
59 | font-size: 12px;
60 | margin: -7px;
61 | margin-bottom: 0px;
62 | background-color: #c00;
63 | color: #fff;
64 | }
65 | ul li {
66 | font-size: 12px;
67 | list-style: square;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/bootstrap_and_overrides.css.less:
--------------------------------------------------------------------------------
1 | @import "twitter/bootstrap/bootstrap";
2 | @import "twitter/bootstrap/responsive";
3 |
4 | // Set the correct sprite paths
5 | @iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
6 | @iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");
7 |
8 | // Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
9 | @fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
10 | @fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
11 | @fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
12 | @fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
13 | @fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
14 |
15 | // Font Awesome
16 | @import "fontawesome/font-awesome";
17 |
18 | // Glyphicons
19 | //@import "twitter/bootstrap/sprites.less";
20 |
21 | // Your custom LESS stylesheets goes here
22 | //
23 | // Since bootstrap was imported above you have access to its mixins which
24 | // you may use and inherit here
25 | //
26 | // If you'd like to override bootstrap's own variables, you can do so here as well
27 | // See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
28 | //
29 | // Example:
30 | // @linkColor: #ff0000;
31 |
32 | @import "bootstrap-slider.css";
33 |
--------------------------------------------------------------------------------
/app/views/query_results/show.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = QueryResult -%>
2 |
5 |
6 |
7 | <%= model_class.human_attribute_name(:query_id) %>:
8 | <%= @query_result.query_id %>
9 | <%= model_class.human_attribute_name(:page_id) %>:
10 | <%= @query_result.page_id %>
11 | <%= model_class.human_attribute_name(:result_id) %>:
12 | <%= @query_result.result_id %>
13 | <%= model_class.human_attribute_name(:position) %>:
14 | <%= @query_result.position %>
15 |
16 |
17 |
18 | <%= link_to t('.back', :default => t("helpers.links.back")),
19 | query_results_path, :class => 'btn' %>
20 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
21 | edit_query_result_path(@query_result), :class => 'btn' %>
22 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
23 | query_result_path(@query_result),
24 | :method => 'delete',
25 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
26 | :class => 'btn btn-danger' %>
27 |
28 |
--------------------------------------------------------------------------------
/app/views/pages/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @page, :html => { :class => 'form-horizontal' } do |f| %>
2 |
3 | <%= f.label :wiki_id, :class => 'control-label' %>
4 |
5 | <%= f.text_field :wiki_id, :class => 'text_field' %>
6 |
7 |
8 |
9 | <%= f.label :article_id, :class => 'control-label' %>
10 |
11 | <%= f.text_field :article_id, :class => 'text_field' %>
12 |
13 |
14 |
15 | <%= f.label :title, :class => 'control-label' %>
16 |
17 | <%= f.text_field :title, :class => 'text_field' %>
18 |
19 |
20 |
21 | <%= f.label :url, :class => 'control-label' %>
22 |
23 | <%= f.text_field :url, :class => 'text_field' %>
24 |
25 |
26 |
27 | <%= f.label :lang, :class => 'control-label' %>
28 |
29 | <%= f.text_field :lang, :class => 'text_field' %>
30 |
31 |
32 |
33 |
34 | <%= f.submit nil, :class => 'btn btn-primary' %>
35 | <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
36 | pages_path, :class => 'btn' %>
37 |
38 | <% end %>
39 |
--------------------------------------------------------------------------------
/test/controllers/pages_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class PagesControllerTest < ActionController::TestCase
4 | setup do
5 | @page = pages(:one)
6 | end
7 |
8 | test "should get index" do
9 | get :index
10 | assert_response :success
11 | assert_not_nil assigns(:pages)
12 | end
13 |
14 | test "should get new" do
15 | get :new
16 | assert_response :success
17 | end
18 |
19 | test "should create page" do
20 | assert_difference('Page.count') do
21 | post :create, page: { article_id: @page.article_id, lang: @page.lang, title: @page.title, url: @page.url, wiki_id: @page.wiki_id }
22 | end
23 |
24 | assert_redirected_to page_path(assigns(:page))
25 | end
26 |
27 | test "should show page" do
28 | get :show, id: @page
29 | assert_response :success
30 | end
31 |
32 | test "should get edit" do
33 | get :edit, id: @page
34 | assert_response :success
35 | end
36 |
37 | test "should update page" do
38 | patch :update, id: @page, page: { article_id: @page.article_id, lang: @page.lang, title: @page.title, url: @page.url, wiki_id: @page.wiki_id }
39 | assert_redirected_to page_path(assigns(:page))
40 | end
41 |
42 | test "should destroy page" do
43 | assert_difference('Page.count', -1) do
44 | delete :destroy, id: @page
45 | end
46 |
47 | assert_redirected_to pages_path
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/app/views/pages/show.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Page -%>
2 |
5 |
6 |
7 | <%= model_class.human_attribute_name(:wiki_id) %>:
8 | <%= @page.wiki_id %>
9 | <%= model_class.human_attribute_name(:article_id) %>:
10 | <%= @page.article_id %>
11 | <%= model_class.human_attribute_name(:title) %>:
12 | <%= @page.title %>
13 | <%= model_class.human_attribute_name(:url) %>:
14 | <%= @page.url %>
15 | <%= model_class.human_attribute_name(:lang) %>:
16 | <%= @page.lang %>
17 |
18 |
19 |
20 | <%= link_to t('.back', :default => t("helpers.links.back")),
21 | pages_path, :class => 'btn' %>
22 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
23 | edit_page_path(@page), :class => 'btn' %>
24 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
25 | page_path(@page),
26 | :method => 'delete',
27 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
28 | :class => 'btn btn-danger' %>
29 |
30 |
--------------------------------------------------------------------------------
/app/views/results/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%= form_for @result, :html => { :class => 'form-horizontal' } do |f| %>
2 |
3 | <%= f.label :page_id, :class => 'control-label' %>
4 |
5 | <%= f.text_field :page_id, :class => 'text_field' %>
6 |
7 |
8 |
9 | <%= f.label :phrase_id, :class => 'control-label' %>
10 |
11 | <%= f.text_field :phrase_id, :class => 'text_field' %>
12 |
13 |
14 |
15 | <%= f.label :score, :class => 'control-label' %>
16 |
17 | <%= f.text_field :score, :class => 'text_field' %>
18 |
19 |
20 |
21 | <%= f.label :comment, :class => 'control-label' %>
22 |
23 | <%= f.text_field :comment, :class => 'text_field' %>
24 |
25 |
26 |
27 | <%= f.label :who, :class => 'control-label' %>
28 |
29 | <%= f.text_field :who, :class => 'text_field' %>
30 |
31 |
32 |
33 |
34 | <%= f.submit nil, :class => 'btn btn-primary' %>
35 | <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
36 | results_path, :class => 'btn' %>
37 |
38 | <% end %>
39 |
--------------------------------------------------------------------------------
/test/controllers/results_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class ResultsControllerTest < ActionController::TestCase
4 | setup do
5 | @result = results(:one)
6 | end
7 |
8 | test "should get index" do
9 | get :index
10 | assert_response :success
11 | assert_not_nil assigns(:results)
12 | end
13 |
14 | test "should get new" do
15 | get :new
16 | assert_response :success
17 | end
18 |
19 | test "should create result" do
20 | assert_difference('Result.count') do
21 | post :create, result: { comment: @result.comment, page_id: @result.page_id, phrase_id: @result.phrase_id, score: @result.score, who: @result.who }
22 | end
23 |
24 | assert_redirected_to result_path(assigns(:result))
25 | end
26 |
27 | test "should show result" do
28 | get :show, id: @result
29 | assert_response :success
30 | end
31 |
32 | test "should get edit" do
33 | get :edit, id: @result
34 | assert_response :success
35 | end
36 |
37 | test "should update result" do
38 | patch :update, id: @result, result: { comment: @result.comment, page_id: @result.page_id, phrase_id: @result.phrase_id, score: @result.score, who: @result.who }
39 | assert_redirected_to result_path(assigns(:result))
40 | end
41 |
42 | test "should destroy result" do
43 | assert_difference('Result.count', -1) do
44 | delete :destroy, id: @result
45 | end
46 |
47 | assert_redirected_to results_path
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
We're sorry, but something went wrong.
54 |
55 | If you are the application owner check the logs for more information.
56 |
57 |
58 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4 | gem 'rails', '4.0.0'
5 |
6 | # Use sqlite3 as the database for Active Record
7 | gem 'sqlite3'
8 |
9 | # Use SCSS for stylesheets
10 | gem 'sass-rails', '~> 4.0.0'
11 |
12 | # Use Uglifier as compressor for JavaScript assets
13 | gem 'uglifier', '>= 1.3.0'
14 |
15 | # Use CoffeeScript for .js.coffee assets and views
16 | gem 'coffee-rails', '~> 4.0.0'
17 |
18 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes
19 | # gem 'therubyracer', platforms: :ruby
20 |
21 | # Use jquery as the JavaScript library
22 | gem 'jquery-rails'
23 |
24 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
25 | gem 'turbolinks'
26 |
27 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
28 | gem 'jbuilder', '~> 1.2'
29 |
30 | gem "therubyracer"
31 | gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
32 | gem "twitter-bootstrap-rails"
33 | gem "bootstrap-slider-rails"
34 |
35 | group :doc do
36 | # bundle exec rake doc:rails generates the API under doc/api.
37 | gem 'sdoc', require: false
38 | end
39 |
40 | # Use ActiveModel has_secure_password
41 | # gem 'bcrypt-ruby', '~> 3.0.0'
42 |
43 | # Use unicorn as the app server
44 | # gem 'unicorn'
45 |
46 | # Use Capistrano for deployment
47 | # gem 'capistrano', group: :development
48 |
49 | # Use debugger
50 | # gem 'debugger', group: [:development, :test]
51 |
--------------------------------------------------------------------------------
/app/views/results/show.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Result -%>
2 |
6 |
7 |
8 | <%= model_class.human_attribute_name(:page_id) %>:
9 | <%= @result.page_id %> (<%= link_to @result.page.url, @result.page.url %>)
10 | <%= model_class.human_attribute_name(:phrase_id) %>:
11 | <%= @result.phrase_id %> (<%= @result.phrase.text %>)
12 | <%= model_class.human_attribute_name(:score) %>:
13 | <%= @result.score %>
14 | <%= model_class.human_attribute_name(:comment) %>:
15 | <%= @result.comment %>
16 | <%= model_class.human_attribute_name(:who) %>:
17 | <%= @result.who %>
18 |
19 |
20 |
21 | <%= link_to t('.back', :default => t("helpers.links.back")),
22 | results_path, :class => 'btn' %>
23 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
24 | edit_result_path(@result), :class => 'btn' %>
25 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
26 | result_path(@result),
27 | :method => 'delete',
28 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
29 | :class => 'btn btn-danger' %>
30 |
31 |
--------------------------------------------------------------------------------
/app/views/runs/show.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Run -%>
2 |
5 |
6 |
7 | <%= model_class.human_attribute_name(:root_url) %>:
8 | <%= @run.root_url %>
9 | <%= model_class.human_attribute_name(:score) %>:
10 | <%= @run.score %>
11 | <%= model_class.human_attribute_name(:description) %>:
12 | <%= @run.description %>
13 |
14 | query breakedown:
15 |
16 | <% @run.queries.each do |query| %>
17 |
18 |
19 | <%= query.phrase.text %>:
20 |
21 |
22 | <%= query.score %>
23 |
24 |
25 | <% query.query_results.each do |query_result| %>
26 |
27 | <%= query_result.result.page.url %>
28 | <%= query_result.result.score %>
29 |
30 | <% end %>
31 |
32 |
33 | <% end %>
34 |
35 |
36 | <%= link_to t('.back', :default => t("helpers.links.back")),
37 | runs_path, :class => 'btn' %>
38 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
39 | run_path(@run),
40 | :method => 'delete',
41 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
42 | :class => 'btn btn-danger' %>
43 |
44 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
The change you wanted was rejected.
54 |
Maybe you tried to change something you didn't have access to.
55 |
56 | If you are the application owner check the logs for more information.
57 |
58 |
59 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
The page you were looking for doesn't exist.
54 |
You may have mistyped the address or the page may have moved.
55 |
56 | If you are the application owner check the logs for more information.
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/views/runs/index.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Run -%>
2 |
5 |
6 |
7 |
8 | <%= model_class.human_attribute_name(:id) %>
9 | <%= model_class.human_attribute_name(:root_url) %>
10 | <%= model_class.human_attribute_name(:description) %>
11 | <%= model_class.human_attribute_name(:created_at) %>
12 | <%=t '.actions', :default => t("helpers.actions") %>
13 |
14 |
15 |
16 | <% @runs.each do |run| %>
17 |
18 | <%= link_to run.id, run_path(run) %>
19 | <%= run.root_url %>
20 | <%= run.description %>
21 | <%=l run.created_at %>
22 |
23 | <%= link_to t('.show', :default => t("helpers.links.show")),
24 | run_path(run), :class => 'btn btn-mini' %>
25 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
26 | run_path(run),
27 | :method => :delete,
28 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
29 | :class => 'btn btn-mini btn-danger' %>
30 |
31 |
32 | <% end %>
33 |
34 |
35 |
36 | <%= link_to t('.new', :default => t("helpers.links.new")),
37 | new_run_path,
38 | :class => 'btn btn-primary' %>
39 |
--------------------------------------------------------------------------------
/test/controllers/query_results_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class QueryResultsControllerTest < ActionController::TestCase
4 | setup do
5 | @query_result = query_results(:one)
6 | end
7 |
8 | test "should get index" do
9 | get :index
10 | assert_response :success
11 | assert_not_nil assigns(:query_results)
12 | end
13 |
14 | test "should get new" do
15 | get :new
16 | assert_response :success
17 | end
18 |
19 | test "should create query_result" do
20 | assert_difference('QueryResult.count') do
21 | post :create, query_result: { page_id: @query_result.page_id, position: @query_result.position, query_id: @query_result.query_id, result_id: @query_result.result_id }
22 | end
23 |
24 | assert_redirected_to query_result_path(assigns(:query_result))
25 | end
26 |
27 | test "should show query_result" do
28 | get :show, id: @query_result
29 | assert_response :success
30 | end
31 |
32 | test "should get edit" do
33 | get :edit, id: @query_result
34 | assert_response :success
35 | end
36 |
37 | test "should update query_result" do
38 | patch :update, id: @query_result, query_result: { page_id: @query_result.page_id, position: @query_result.position, query_id: @query_result.query_id, result_id: @query_result.result_id }
39 | assert_redirected_to query_result_path(assigns(:query_result))
40 | end
41 |
42 | test "should destroy query_result" do
43 | assert_difference('QueryResult.count', -1) do
44 | delete :destroy, id: @query_result
45 | end
46 |
47 | assert_redirected_to query_results_path
48 | end
49 | end
50 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Evaluator::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static asset server for tests with Cache-Control for performance.
16 | config.serve_static_assets = true
17 | config.static_cache_control = "public, max-age=3600"
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Print deprecation notices to the stderr.
35 | config.active_support.deprecation = :stderr
36 | end
37 |
--------------------------------------------------------------------------------
/app/views/phrases/index.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Phrase -%>
2 |
5 |
6 |
7 |
8 | <%= model_class.human_attribute_name(:id) %>
9 | <%= model_class.human_attribute_name(:text) %>
10 | <%= model_class.human_attribute_name(:description) %>
11 | <%= model_class.human_attribute_name(:weight) %>
12 | <%= model_class.human_attribute_name(:created_at) %>
13 | <%=t '.actions', :default => t("helpers.actions") %>
14 |
15 |
16 |
17 | <% @phrases.each do |phrase| %>
18 |
19 | <%= link_to phrase.id, phrase_path(phrase) %>
20 | <%= phrase.text %>
21 | <%= phrase.description %>
22 | <%= phrase.weight %>
23 | <%=l phrase.created_at %>
24 |
25 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
26 | edit_phrase_path(phrase), :class => 'btn btn-mini' %>
27 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
28 | phrase_path(phrase),
29 | :method => :delete,
30 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
31 | :class => 'btn btn-mini btn-danger' %>
32 |
33 |
34 | <% end %>
35 |
36 |
37 |
38 | <%= link_to t('.new', :default => t("helpers.links.new")),
39 | new_phrase_path,
40 | :class => 'btn btn-primary' %>
41 |
--------------------------------------------------------------------------------
/app/views/queries/index.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Query -%>
2 |
5 |
6 |
7 |
8 | <%= model_class.human_attribute_name(:id) %>
9 | <%= model_class.human_attribute_name(:run_id) %>
10 | <%= model_class.human_attribute_name(:url) %>
11 | <%= model_class.human_attribute_name(:response) %>
12 | <%= model_class.human_attribute_name(:phrase_id) %>
13 | <%= model_class.human_attribute_name(:created_at) %>
14 | <%=t '.actions', :default => t("helpers.actions") %>
15 |
16 |
17 |
18 | <% @queries.each do |query| %>
19 |
20 | <%= link_to query.id, query_path(query) %>
21 | <%= query.run_id %>
22 | <%= query.url %>
23 | <%= query.response %>
24 | <%= query.phrase_id %>
25 | <%=l query.created_at %>
26 |
27 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
28 | edit_query_path(query), :class => 'btn btn-mini' %>
29 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
30 | query_path(query),
31 | :method => :delete,
32 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
33 | :class => 'btn btn-mini btn-danger' %>
34 |
35 |
36 | <% end %>
37 |
38 |
39 |
40 | <%= link_to t('.new', :default => t("helpers.links.new")),
41 | new_query_path,
42 | :class => 'btn btn-primary' %>
43 |
--------------------------------------------------------------------------------
/app/views/pages/index.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Page -%>
2 |
5 |
6 |
7 |
8 | <%= model_class.human_attribute_name(:id) %>
9 | <%= model_class.human_attribute_name(:wiki_id) %>
10 | <%= model_class.human_attribute_name(:article_id) %>
11 | <%= model_class.human_attribute_name(:title) %>
12 | <%= model_class.human_attribute_name(:url) %>
13 | <%= model_class.human_attribute_name(:lang) %>
14 | <%= model_class.human_attribute_name(:created_at) %>
15 | <%=t '.actions', :default => t("helpers.actions") %>
16 |
17 |
18 |
19 | <% @pages.each do |page| %>
20 |
21 | <%= link_to page.id, page_path(page) %>
22 | <%= page.wiki_id %>
23 | <%= page.article_id %>
24 | <%= page.title %>
25 | <%= page.url %>
26 | <%= page.lang %>
27 | <%=l page.created_at %>
28 |
29 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
30 | edit_page_path(page), :class => 'btn btn-mini' %>
31 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
32 | page_path(page),
33 | :method => :delete,
34 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
35 | :class => 'btn btn-mini btn-danger' %>
36 |
37 |
38 | <% end %>
39 |
40 |
41 |
42 | <%= link_to t('.new', :default => t("helpers.links.new")),
43 | new_page_path,
44 | :class => 'btn btn-primary' %>
45 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Evaluator::Application.routes.draw do
2 | resources :query_results
3 |
4 | resources :results
5 |
6 | resources :pages
7 |
8 | resources :queries
9 |
10 | resources :runs
11 |
12 | resources :phrases
13 |
14 | # The priority is based upon order of creation: first created -> highest priority.
15 | # See how all your routes lay out with "rake routes".
16 |
17 | # You can have the root of your site routed with "root"
18 | # root 'welcome#index'
19 |
20 | # Example of regular route:
21 | # get 'products/:id' => 'catalog#view'
22 |
23 | # Example of named route that can be invoked with purchase_url(id: product.id)
24 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
25 |
26 | # Example resource route (maps HTTP verbs to controller actions automatically):
27 | # resources :products
28 |
29 | # Example resource route with options:
30 | # resources :products do
31 | # member do
32 | # get 'short'
33 | # post 'toggle'
34 | # end
35 | #
36 | # collection do
37 | # get 'sold'
38 | # end
39 | # end
40 |
41 | # Example resource route with sub-resources:
42 | # resources :products do
43 | # resources :comments, :sales
44 | # resource :seller
45 | # end
46 |
47 | # Example resource route with more complex sub-resources:
48 | # resources :products do
49 | # resources :comments
50 | # resources :sales do
51 | # get 'recent', on: :collection
52 | # end
53 | # end
54 |
55 | # Example resource route with concerns:
56 | # concern :toggleable do
57 | # post 'toggle'
58 | # end
59 | # resources :posts, concerns: :toggleable
60 | # resources :photos, concerns: :toggleable
61 |
62 | # Example resource route within a namespace:
63 | # namespace :admin do
64 | # # Directs /admin/products/* to Admin::ProductsController
65 | # # (app/controllers/admin/products_controller.rb)
66 | # resources :products
67 | # end
68 | end
69 |
--------------------------------------------------------------------------------
/app/views/query_results/index.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = QueryResult -%>
2 |
5 |
6 |
7 |
8 | <%= model_class.human_attribute_name(:id) %>
9 | <%= model_class.human_attribute_name(:query_id) %>
10 | <%= model_class.human_attribute_name(:page_id) %>
11 | <%= model_class.human_attribute_name(:result_id) %>
12 | <%= model_class.human_attribute_name(:position) %>
13 | <%= model_class.human_attribute_name(:created_at) %>
14 | <%=t '.actions', :default => t("helpers.actions") %>
15 |
16 |
17 |
18 | <% @query_results.each do |query_result| %>
19 |
20 | <%= link_to query_result.id, query_result_path(query_result) %>
21 | <%= query_result.query.phrase.text %>
22 | <%= query_result.page.url %>
23 | <%= link_to 'link', result_path(query_result.result) %>score:<%= query_result.result.score %>
24 | <%= query_result.position %>
25 | <%=l query_result.created_at %>
26 |
27 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
28 | edit_query_result_path(query_result), :class => 'btn btn-mini' %>
29 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
30 | query_result_path(query_result),
31 | :method => :delete,
32 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
33 | :class => 'btn btn-mini btn-danger' %>
34 |
35 |
36 | <% end %>
37 |
38 |
39 |
40 | <%= link_to t('.new', :default => t("helpers.links.new")),
41 | new_query_result_path,
42 | :class => 'btn btn-primary' %>
43 |
--------------------------------------------------------------------------------
/app/controllers/runs_controller.rb:
--------------------------------------------------------------------------------
1 | class RunsController < ApplicationController
2 | before_action :set_run, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /runs
5 | # GET /runs.json
6 | def index
7 | @runs = Run.all
8 | end
9 |
10 | # GET /runs/1
11 | # GET /runs/1.json
12 | def show
13 | end
14 |
15 | # GET /runs/new
16 | def new
17 | @run = Run.new
18 | end
19 |
20 | # GET /runs/1/edit
21 | def edit
22 | end
23 |
24 | # POST /runs
25 | # POST /runs.json
26 | def create
27 | @run = Run.do(run_params[:root_url], run_params[:description])
28 |
29 | respond_to do |format|
30 | if @run.save
31 | format.html { redirect_to @run, notice: 'Run was successfully created.' }
32 | format.json { render action: 'show', status: :created, location: @run }
33 | else
34 | format.html { render action: 'new' }
35 | format.json { render json: @run.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /runs/1
41 | # PATCH/PUT /runs/1.json
42 | def update
43 | respond_to do |format|
44 | if @run.update(run_params)
45 | format.html { redirect_to @run, notice: 'Run was successfully updated.' }
46 | format.json { head :no_content }
47 | else
48 | format.html { render action: 'edit' }
49 | format.json { render json: @run.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /runs/1
55 | # DELETE /runs/1.json
56 | def destroy
57 | @run.destroy
58 | respond_to do |format|
59 | format.html { redirect_to runs_url }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_run
67 | @run = Run.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def run_params
72 | params.require(:run).permit(:root_url, :description)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/controllers/pages_controller.rb:
--------------------------------------------------------------------------------
1 | class PagesController < ApplicationController
2 | before_action :set_page, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /pages
5 | # GET /pages.json
6 | def index
7 | @pages = Page.all
8 | end
9 |
10 | # GET /pages/1
11 | # GET /pages/1.json
12 | def show
13 | end
14 |
15 | # GET /pages/new
16 | def new
17 | @page = Page.new
18 | end
19 |
20 | # GET /pages/1/edit
21 | def edit
22 | end
23 |
24 | # POST /pages
25 | # POST /pages.json
26 | def create
27 | @page = Page.new(page_params)
28 |
29 | respond_to do |format|
30 | if @page.save
31 | format.html { redirect_to @page, notice: 'Page was successfully created.' }
32 | format.json { render action: 'show', status: :created, location: @page }
33 | else
34 | format.html { render action: 'new' }
35 | format.json { render json: @page.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /pages/1
41 | # PATCH/PUT /pages/1.json
42 | def update
43 | respond_to do |format|
44 | if @page.update(page_params)
45 | format.html { redirect_to @page, notice: 'Page was successfully updated.' }
46 | format.json { head :no_content }
47 | else
48 | format.html { render action: 'edit' }
49 | format.json { render json: @page.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /pages/1
55 | # DELETE /pages/1.json
56 | def destroy
57 | @page.destroy
58 | respond_to do |format|
59 | format.html { redirect_to pages_url }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_page
67 | @page = Page.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def page_params
72 | params.require(:page).permit(:wiki_id, :article_id, :title, :url, :lang)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/controllers/queries_controller.rb:
--------------------------------------------------------------------------------
1 | class QueriesController < ApplicationController
2 | before_action :set_query, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /queries
5 | # GET /queries.json
6 | def index
7 | @queries = Query.all
8 | end
9 |
10 | # GET /queries/1
11 | # GET /queries/1.json
12 | def show
13 | end
14 |
15 | # GET /queries/new
16 | def new
17 | @query = Query.new
18 | end
19 |
20 | # GET /queries/1/edit
21 | def edit
22 | end
23 |
24 | # POST /queries
25 | # POST /queries.json
26 | def create
27 | @query = Query.new(query_params)
28 |
29 | respond_to do |format|
30 | if @query.save
31 | format.html { redirect_to @query, notice: 'Query was successfully created.' }
32 | format.json { render action: 'show', status: :created, location: @query }
33 | else
34 | format.html { render action: 'new' }
35 | format.json { render json: @query.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /queries/1
41 | # PATCH/PUT /queries/1.json
42 | def update
43 | respond_to do |format|
44 | if @query.update(query_params)
45 | format.html { redirect_to @query, notice: 'Query was successfully updated.' }
46 | format.json { head :no_content }
47 | else
48 | format.html { render action: 'edit' }
49 | format.json { render json: @query.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /queries/1
55 | # DELETE /queries/1.json
56 | def destroy
57 | @query.destroy
58 | respond_to do |format|
59 | format.html { redirect_to queries_url }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_query
67 | @query = Query.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def query_params
72 | params.require(:query).permit(:run_id, :url, :response)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/controllers/phrases_controller.rb:
--------------------------------------------------------------------------------
1 | class PhrasesController < ApplicationController
2 | before_action :set_phrase, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /phrases
5 | # GET /phrases.json
6 | def index
7 | @phrases = Phrase.all
8 | end
9 |
10 | # GET /phrases/1
11 | # GET /phrases/1.json
12 | def show
13 | end
14 |
15 | # GET /phrases/new
16 | def new
17 | @phrase = Phrase.new
18 | end
19 |
20 | # GET /phrases/1/edit
21 | def edit
22 | end
23 |
24 | # POST /phrases
25 | # POST /phrases.json
26 | def create
27 | @phrase = Phrase.new(phrase_params)
28 |
29 | respond_to do |format|
30 | if @phrase.save
31 | format.html { redirect_to @phrase, notice: 'Phrase was successfully created.' }
32 | format.json { render action: 'show', status: :created, location: @phrase }
33 | else
34 | format.html { render action: 'new' }
35 | format.json { render json: @phrase.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /phrases/1
41 | # PATCH/PUT /phrases/1.json
42 | def update
43 | respond_to do |format|
44 | if @phrase.update(phrase_params)
45 | format.html { redirect_to @phrase, notice: 'Phrase was successfully updated.' }
46 | format.json { head :no_content }
47 | else
48 | format.html { render action: 'edit' }
49 | format.json { render json: @phrase.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /phrases/1
55 | # DELETE /phrases/1.json
56 | def destroy
57 | @phrase.destroy
58 | respond_to do |format|
59 | format.html { redirect_to phrases_url }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_phrase
67 | @phrase = Phrase.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def phrase_params
72 | params.require(:phrase).permit(:text, :description)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/controllers/results_controller.rb:
--------------------------------------------------------------------------------
1 | class ResultsController < ApplicationController
2 | before_action :set_result, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /results
5 | # GET /results.json
6 | def index
7 | @results = Result.all(:order => "phrase_id")
8 | end
9 |
10 | # GET /results/1
11 | # GET /results/1.json
12 | def show
13 | end
14 |
15 | # GET /results/new
16 | def new
17 | @result = Result.new
18 | end
19 |
20 | # GET /results/1/edit
21 | def edit
22 | end
23 |
24 | # POST /results
25 | # POST /results.json
26 | def create
27 | @result = Result.new(result_params)
28 |
29 | respond_to do |format|
30 | if @result.save
31 | format.html { redirect_to @result, notice: 'Result was successfully created.' }
32 | format.json { render action: 'show', status: :created, location: @result }
33 | else
34 | format.html { render action: 'new' }
35 | format.json { render json: @result.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /results/1
41 | # PATCH/PUT /results/1.json
42 | def update
43 | respond_to do |format|
44 | if @result.update(result_params)
45 | format.html { redirect_to @result, notice: 'Result was successfully updated.' }
46 | format.json { head :no_content }
47 | else
48 | format.html { render action: 'edit' }
49 | format.json { render json: @result.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /results/1
55 | # DELETE /results/1.json
56 | def destroy
57 | @result.destroy
58 | respond_to do |format|
59 | format.html { redirect_to results_url }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_result
67 | @result = Result.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def result_params
72 | params.require(:result).permit(:page_id, :phrase_id, :score, :comment, :who)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20131201175606) do
15 |
16 | create_table "pages", force: true do |t|
17 | t.integer "wiki_id"
18 | t.integer "article_id"
19 | t.string "title"
20 | t.string "url"
21 | t.string "lang"
22 | t.datetime "created_at"
23 | t.datetime "updated_at"
24 | end
25 |
26 | create_table "phrases", force: true do |t|
27 | t.string "text"
28 | t.text "description"
29 | t.datetime "created_at"
30 | t.datetime "updated_at"
31 | t.float "weight", default: 1.0
32 | end
33 |
34 | create_table "queries", force: true do |t|
35 | t.integer "run_id"
36 | t.string "url"
37 | t.text "response"
38 | t.datetime "created_at"
39 | t.datetime "updated_at"
40 | t.integer "phrase_id"
41 | end
42 |
43 | create_table "query_results", force: true do |t|
44 | t.integer "query_id"
45 | t.integer "page_id"
46 | t.integer "result_id"
47 | t.integer "position"
48 | t.datetime "created_at"
49 | t.datetime "updated_at"
50 | end
51 |
52 | create_table "results", force: true do |t|
53 | t.integer "page_id"
54 | t.integer "phrase_id"
55 | t.float "score", default: 0.0, null: false
56 | t.text "comment"
57 | t.string "who"
58 | t.datetime "created_at"
59 | t.datetime "updated_at"
60 | end
61 |
62 | create_table "runs", force: true do |t|
63 | t.string "root_url"
64 | t.text "description"
65 | t.datetime "created_at"
66 | t.datetime "updated_at"
67 | end
68 |
69 | end
70 |
--------------------------------------------------------------------------------
/app/controllers/query_results_controller.rb:
--------------------------------------------------------------------------------
1 | class QueryResultsController < ApplicationController
2 | before_action :set_query_result, only: [:show, :edit, :update, :destroy]
3 |
4 | # GET /query_results
5 | # GET /query_results.json
6 | def index
7 | @query_results = QueryResult.all
8 | end
9 |
10 | # GET /query_results/1
11 | # GET /query_results/1.json
12 | def show
13 | end
14 |
15 | # GET /query_results/new
16 | def new
17 | @query_result = QueryResult.new
18 | end
19 |
20 | # GET /query_results/1/edit
21 | def edit
22 | end
23 |
24 | # POST /query_results
25 | # POST /query_results.json
26 | def create
27 | @query_result = QueryResult.new(query_result_params)
28 |
29 | respond_to do |format|
30 | if @query_result.save
31 | format.html { redirect_to @query_result, notice: 'Query result was successfully created.' }
32 | format.json { render action: 'show', status: :created, location: @query_result }
33 | else
34 | format.html { render action: 'new' }
35 | format.json { render json: @query_result.errors, status: :unprocessable_entity }
36 | end
37 | end
38 | end
39 |
40 | # PATCH/PUT /query_results/1
41 | # PATCH/PUT /query_results/1.json
42 | def update
43 | respond_to do |format|
44 | if @query_result.update(query_result_params)
45 | format.html { redirect_to @query_result, notice: 'Query result was successfully updated.' }
46 | format.json { head :no_content }
47 | else
48 | format.html { render action: 'edit' }
49 | format.json { render json: @query_result.errors, status: :unprocessable_entity }
50 | end
51 | end
52 | end
53 |
54 | # DELETE /query_results/1
55 | # DELETE /query_results/1.json
56 | def destroy
57 | @query_result.destroy
58 | respond_to do |format|
59 | format.html { redirect_to query_results_url }
60 | format.json { head :no_content }
61 | end
62 | end
63 |
64 | private
65 | # Use callbacks to share common setup or constraints between actions.
66 | def set_query_result
67 | @query_result = QueryResult.find(params[:id])
68 | end
69 |
70 | # Never trust parameters from the scary internet, only allow the white list through.
71 | def query_result_params
72 | params.require(:query_result).permit(:query_id, :page_id, :result_id, :position)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/app/views/results/index.html.erb:
--------------------------------------------------------------------------------
1 | <%- model_class = Result -%>
2 |
5 |
6 |
7 |
8 | <%= model_class.human_attribute_name(:id) %>
9 | <%= model_class.human_attribute_name(:page_id) %>
10 | <%= model_class.human_attribute_name(:phrase_id) %>
11 | <%= model_class.human_attribute_name(:score) %>
12 | <%= model_class.human_attribute_name(:comment) %>
13 | <%= model_class.human_attribute_name(:who) %>
14 | <%= model_class.human_attribute_name(:created_at) %>
15 | <%=t '.actions', :default => t("helpers.actions") %>
16 |
17 |
18 |
19 | <% @results.each do |result| %>
20 |
21 | <%= link_to result.id, result_path(result) %>
22 |
23 | <%= result.page.url %>
24 |
25 | <%= result.phrase.text %>
26 |
37 | <%= result.comment %>
38 | <%= result.who %>
39 | <%=l result.created_at %>
40 |
41 | <%= link_to t('.edit', :default => t("helpers.links.edit")),
42 | edit_result_path(result), :class => 'btn btn-mini' %>
43 | <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
44 | result_path(result),
45 | :method => :delete,
46 | :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
47 | :class => 'btn btn-mini btn-danger' %>
48 |
49 |
50 | <% end %>
51 |
52 |
53 |
54 | <%= link_to t('.new', :default => t("helpers.links.new")),
55 | new_result_path,
56 | :class => 'btn btn-primary' %>
57 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Evaluator::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both thread web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application
18 | # Add `rack-cache` to your Gemfile before enabling this.
19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20 | # config.action_dispatch.rack_cache = true
21 |
22 | # Disable Rails's static asset server (Apache or nginx will already do this).
23 | config.serve_static_assets = false
24 |
25 | # Compress JavaScripts and CSS.
26 | config.assets.js_compressor = :uglifier
27 | # config.assets.css_compressor = :sass
28 |
29 | # Do not fallback to assets pipeline if a precompiled asset is missed.
30 | config.assets.compile = false
31 |
32 | # Generate digests for assets URLs.
33 | config.assets.digest = true
34 |
35 | # Version of your assets, change this if you want to expire all your assets.
36 | config.assets.version = '1.0'
37 |
38 | # Specifies the header that your server uses for sending files.
39 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41 |
42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43 | # config.force_ssl = true
44 |
45 | # Set to :debug to see everything in the log.
46 | config.log_level = :info
47 |
48 | # Prepend all log lines with the following tags.
49 | # config.log_tags = [ :subdomain, :uuid ]
50 |
51 | # Use a different logger for distributed setups.
52 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53 |
54 | # Use a different cache store in production.
55 | # config.cache_store = :mem_cache_store
56 |
57 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58 | # config.action_controller.asset_host = "http://assets.example.com"
59 |
60 | # Precompile additional assets.
61 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62 | # config.assets.precompile += %w( search.js )
63 |
64 | # Ignore bad email addresses and do not raise email delivery errors.
65 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66 | # config.action_mailer.raise_delivery_errors = false
67 |
68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69 | # the I18n.default_locale when a translation can not be found).
70 | config.i18n.fallbacks = true
71 |
72 | # Send deprecation notices to registered listeners.
73 | config.active_support.deprecation = :notify
74 |
75 | # Disable automatic flushing of the log to improve performance.
76 | # config.autoflush_log = false
77 |
78 | # Use default logging formatter so that PID and timestamp are not suppressed.
79 | config.log_formatter = ::Logger::Formatter.new
80 | end
81 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
9 | phrases = [
10 | { 'text' => 'Brad Pitt', 'description' => 'person', 'weight' => 1},
11 | { 'text' => 'Paris Hilton', 'description' => 'person', 'weight' => 1},
12 | { 'text' => 'George Clooney', 'description' => 'person', 'weight' => 1},
13 | { 'text' => 'George Clooney actor', 'description' => 'person', 'weight' => 1},
14 | { 'text' => 'Steven Spielberg', 'description' => 'person', 'weight' => 1},
15 | { 'text' => 'Token Black', 'description' => 'character', 'weight' => 0.8},
16 | { 'text' => 'King Arthur', 'description' => 'character', 'weight' => 0.8},
17 | { 'text' => 'Brad Pitt Fight Club', 'description' => 'character', 'weight' => 0.8},
18 | { 'text' => 'Gipsy Danger', 'description' => 'character', 'weight' => 0.8},
19 | { 'text' => 'MacGyver', 'description' => 'character', 'weight' => 0.8},
20 | { 'text' => 'Alien ', 'description' => 'character', 'weight' => 0.8},
21 | { 'text' => 'Bernard Black', 'description' => 'character', 'weight' => 0.8},
22 | { 'text' => 'Darth Vader', 'description' => 'character', 'weight' => 0.8},
23 | { 'text' => 'Sookie Stackhouse ', 'description' => 'character', 'weight' => 0.8},
24 | { 'text' => 'Eric Cartman', 'description' => 'character', 'weight' => 0.8},
25 | { 'text' => 'Elena Gilbert ', 'description' => 'character', 'weight' => 0.8},
26 | { 'text' => 'friends The last one', 'description' => 'tv episodes', 'weight' => 0.5},
27 | { 'text' => 'Bad Boys Supernatural', 'description' => 'tv episodes', 'weight' => 0.5},
28 | { 'text' => '24 8am 9am', 'description' => 'tv episodes', 'weight' => 0.5},
29 | { 'text' => 'Friends s01e01', 'description' => 'tv episodes', 'weight' => 0.5},
30 | { 'text' => 'Scary Movie 3', 'description' => 'movie', 'weight' => 0.8},
31 | { 'text' => 'The Thing movie', 'description' => 'movie', 'weight' => 0.8},
32 | { 'text' => 'Ocean 11', 'description' => 'movie', 'weight' => 0.8},
33 | { 'text' => 'Grudge', 'description' => 'movie', 'weight' => 0.8},
34 | { 'text' => 'The american history X', 'description' => 'movie', 'weight' => 0.8},
35 | { 'text' => 'The american history X', 'description' => 'movie', 'weight' => 0.8},
36 | { 'text' => 'How I Learned to Stop Worrying and Love the Bomb', 'description' => 'movie', 'weight' => 0.8},
37 | { 'text' => 'How I Learned to Stop Worrying and Love the Bomb', 'description' => 'movie', 'weight' => 0.8},
38 | { 'text' => 'Too fast and furious ', 'description' => 'movie', 'weight' => 0.8},
39 | { 'text' => 'King Arthur', 'description' => 'movie', 'weight' => 0.8},
40 | { 'text' => 'Friends', 'description' => 'tv series', 'weight' => 2},
41 | { 'text' => 'The Office', 'description' => 'tv series', 'weight' => 2},
42 | { 'text' => 'The Office tv', 'description' => 'tv series', 'weight' => 2},
43 | { 'text' => 'south park', 'description' => 'tv series', 'weight' => 2},
44 | { 'text' => 'Vampire Diaries', 'description' => 'tv series', 'weight' => 2},
45 | { 'text' => 'Agents of S.H.I.E.L.D', 'description' => 'tv series', 'weight' => 2},
46 | { 'text' => 'How I Met Your Mother', 'description' => 'tv series', 'weight' => 2},
47 | { 'text' => 'Almost Human', 'description' => 'tv series', 'weight' => 2},
48 | ]
49 |
50 | for phraseHash in phrases
51 | p = Phrase.find_by_text(phraseHash['text'])
52 | if p == nil
53 | Phrase.create phraseHash
54 | end
55 | end
56 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | <%= content_for?(:title) ? yield(:title) : "Evaluator" %>
8 | <%= csrf_meta_tags %>
9 |
10 |
11 |
14 |
15 | <%= stylesheet_link_tag "application", :media => "all" %>
16 |
17 |
18 |
19 | <%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
20 |
21 |
22 |
23 | <%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
24 |
25 |
26 |
27 | <%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
28 |
29 |
30 |
31 | <%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
32 |
33 |
34 |
35 | <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
36 |
37 | <%= javascript_include_tag "application" %>
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
Evaluator
50 |
51 |
52 | <%= link_to "Runs", runs_path %>
53 | <%= link_to "Phrases", phrases_path %>
54 | <%= link_to "Results", results_path %>
55 | <%= link_to "Pages", pages_path %>
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
74 |
75 |
76 | <%= bootstrap_flash %>
77 | <%= yield %>
78 |
79 |
80 |
81 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actionmailer (4.0.0)
5 | actionpack (= 4.0.0)
6 | mail (~> 2.5.3)
7 | actionpack (4.0.0)
8 | activesupport (= 4.0.0)
9 | builder (~> 3.1.0)
10 | erubis (~> 2.7.0)
11 | rack (~> 1.5.2)
12 | rack-test (~> 0.6.2)
13 | activemodel (4.0.0)
14 | activesupport (= 4.0.0)
15 | builder (~> 3.1.0)
16 | activerecord (4.0.0)
17 | activemodel (= 4.0.0)
18 | activerecord-deprecated_finders (~> 1.0.2)
19 | activesupport (= 4.0.0)
20 | arel (~> 4.0.0)
21 | activerecord-deprecated_finders (1.0.3)
22 | activesupport (4.0.0)
23 | i18n (~> 0.6, >= 0.6.4)
24 | minitest (~> 4.2)
25 | multi_json (~> 1.3)
26 | thread_safe (~> 0.1)
27 | tzinfo (~> 0.3.37)
28 | arel (4.0.1)
29 | atomic (1.1.14)
30 | bootstrap-slider-rails (1.9.0)
31 | railties (>= 3.2, < 5.0)
32 | builder (3.1.4)
33 | coffee-rails (4.0.1)
34 | coffee-script (>= 2.2.0)
35 | railties (>= 4.0.0, < 5.0)
36 | coffee-script (2.2.0)
37 | coffee-script-source
38 | execjs
39 | coffee-script-source (1.6.3)
40 | commonjs (0.2.7)
41 | erubis (2.7.0)
42 | execjs (2.0.2)
43 | hike (1.2.3)
44 | i18n (0.6.5)
45 | jbuilder (1.5.2)
46 | activesupport (>= 3.0.0)
47 | multi_json (>= 1.2.0)
48 | jquery-rails (3.0.4)
49 | railties (>= 3.0, < 5.0)
50 | thor (>= 0.14, < 2.0)
51 | json (1.8.1)
52 | less (2.4.0)
53 | commonjs (~> 0.2.7)
54 | less-rails (2.4.2)
55 | actionpack (>= 3.1)
56 | less (~> 2.4.0)
57 | libv8 (3.16.14.3)
58 | mail (2.5.4)
59 | mime-types (~> 1.16)
60 | treetop (~> 1.4.8)
61 | mime-types (1.25.1)
62 | minitest (4.7.5)
63 | multi_json (1.8.2)
64 | polyglot (0.3.3)
65 | rack (1.5.2)
66 | rack-test (0.6.2)
67 | rack (>= 1.0)
68 | rails (4.0.0)
69 | actionmailer (= 4.0.0)
70 | actionpack (= 4.0.0)
71 | activerecord (= 4.0.0)
72 | activesupport (= 4.0.0)
73 | bundler (>= 1.3.0, < 2.0)
74 | railties (= 4.0.0)
75 | sprockets-rails (~> 2.0.0)
76 | railties (4.0.0)
77 | actionpack (= 4.0.0)
78 | activesupport (= 4.0.0)
79 | rake (>= 0.8.7)
80 | thor (>= 0.18.1, < 2.0)
81 | rake (10.1.0)
82 | rdoc (3.12.2)
83 | json (~> 1.4)
84 | ref (1.0.5)
85 | sass (3.2.12)
86 | sass-rails (4.0.1)
87 | railties (>= 4.0.0, < 5.0)
88 | sass (>= 3.1.10)
89 | sprockets-rails (~> 2.0.0)
90 | sdoc (0.3.20)
91 | json (>= 1.1.3)
92 | rdoc (~> 3.10)
93 | sprockets (2.10.1)
94 | hike (~> 1.2)
95 | multi_json (~> 1.0)
96 | rack (~> 1.0)
97 | tilt (~> 1.1, != 1.3.0)
98 | sprockets-rails (2.0.1)
99 | actionpack (>= 3.0)
100 | activesupport (>= 3.0)
101 | sprockets (~> 2.8)
102 | sqlite3 (1.3.8)
103 | therubyracer (0.12.0)
104 | libv8 (~> 3.16.14.0)
105 | ref
106 | thor (0.18.1)
107 | thread_safe (0.1.3)
108 | atomic
109 | tilt (1.4.1)
110 | treetop (1.4.15)
111 | polyglot
112 | polyglot (>= 0.3.1)
113 | turbolinks (1.3.1)
114 | coffee-rails
115 | twitter-bootstrap-rails (2.2.8)
116 | actionpack (>= 3.1)
117 | execjs
118 | rails (>= 3.1)
119 | railties (>= 3.1)
120 | tzinfo (0.3.38)
121 | uglifier (2.3.1)
122 | execjs (>= 0.3.0)
123 | json (>= 1.8.0)
124 |
125 | PLATFORMS
126 | ruby
127 |
128 | DEPENDENCIES
129 | bootstrap-slider-rails
130 | coffee-rails (~> 4.0.0)
131 | jbuilder (~> 1.2)
132 | jquery-rails
133 | less-rails
134 | rails (= 4.0.0)
135 | sass-rails (~> 4.0.0)
136 | sdoc
137 | sqlite3
138 | therubyracer
139 | turbolinks
140 | twitter-bootstrap-rails
141 | uglifier (>= 1.3.0)
142 |
--------------------------------------------------------------------------------