rankit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.markdown +59 -0
  3. data/Rakefile +34 -0
  4. data/app/assets/javascripts/rankit/application.js +15 -0
  5. data/app/assets/stylesheets/rankit/application.css +13 -0
  6. data/app/controllers/rankit/application_controller.rb +7 -0
  7. data/app/controllers/rankit/comments_controller.rb +32 -0
  8. data/app/controllers/rankit/devise/sessions_controller.rb +3 -0
  9. data/app/controllers/rankit/rankables_controller.rb +48 -0
  10. data/app/controllers/rankit/scores_controller.rb +27 -0
  11. data/app/helpers/rankit/application_helper.rb +4 -0
  12. data/app/models/rankit/comment.rb +7 -0
  13. data/app/models/rankit/rankable.rb +26 -0
  14. data/app/models/rankit/score.rb +18 -0
  15. data/app/models/rankit/user.rb +10 -0
  16. data/app/views/layouts/rankit/application.html.haml +24 -0
  17. data/app/views/rankit/comments/_comment.html.haml +3 -0
  18. data/app/views/rankit/comments/index.html.haml +6 -0
  19. data/app/views/rankit/comments/new.html.haml +10 -0
  20. data/app/views/rankit/devise/sessions/new.html.haml +16 -0
  21. data/app/views/rankit/devise/shared/_links.erb +25 -0
  22. data/app/views/rankit/rankables/_form.html.haml +7 -0
  23. data/app/views/rankit/rankables/_rankable.html.haml +7 -0
  24. data/app/views/rankit/rankables/edit.html.haml +6 -0
  25. data/app/views/rankit/rankables/index.html.haml +9 -0
  26. data/app/views/rankit/rankables/new.html.haml +6 -0
  27. data/app/views/rankit/scores/edit.html.haml +10 -0
  28. data/config/cucumber.yml +8 -0
  29. data/config/initializers/devise.rb +13 -0
  30. data/config/locales/devise.en.yml +58 -0
  31. data/config/routes.rb +10 -0
  32. data/db/migrate/20121002035444_create_rankit_users.rb +10 -0
  33. data/db/migrate/20121002071154_create_rankit_rankables.rb +12 -0
  34. data/db/migrate/20121002203001_create_rankit_scores.rb +11 -0
  35. data/db/migrate/20121002224650_create_rankit_comments.rb +12 -0
  36. data/lib/rankit.rb +9 -0
  37. data/lib/rankit/devise/failure_app.rb +9 -0
  38. data/lib/rankit/engine.rb +5 -0
  39. data/lib/rankit/version.rb +3 -0
  40. data/lib/tasks/rankit_tasks.rake +4 -0
  41. metadata +251 -0
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,59 @@
1
+ # Rankit
2
+
3
+ Post stuff, rank it, let others rank, comment
4
+
5
+ # Install
6
+
7
+ Gemfile:
8
+
9
+ gem 'rankit'
10
+
11
+ Shell:
12
+
13
+ bundle install
14
+
15
+ # Usage
16
+
17
+ Mount the engine
18
+
19
+ routes.rb:
20
+
21
+ YourApp::Application.routes.draw do
22
+ mount Rankit::Engine, :at => "/rankit"
23
+ end
24
+
25
+ Copy its migrations
26
+
27
+ bundle exec rake rankit:install:migrations
28
+
29
+ Run them
30
+
31
+ bundle exec rake db:migrate
32
+
33
+ Create a seed file with a test user
34
+
35
+ db/seed.rb
36
+
37
+ user = Rankit::User.new :email => 'test@example.com'
38
+ user.password = '12345'
39
+ user.password_confirmation = '12345'
40
+
41
+ user.save
42
+
43
+ Seed the database
44
+
45
+ bundle exec rake db:seed
46
+
47
+ Start the server
48
+
49
+ bundle exec rails server
50
+
51
+ Go to `127.0.0.1:3000/rankit/users/sign_in`, login and enjoy.
52
+
53
+ # About the Author
54
+
55
+ [Crowd Interactive](http://www.crowdint.com) is a leading Ruby and Rails consultancy
56
+ firm based in Mexico currently doing business with startups in the United States.
57
+ We specialize in building and growing your existing development team, by adding
58
+ engineers onsite or offsite. We pick our clients carefully, as we only work with
59
+ companies we believe in. Find out more about us on our [website](http://www.crowdint.com).
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Rankit'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ require 'rspec/core/rake_task'
24
+ RSpec::Core::RakeTask.new(:spec)
25
+
26
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
27
+ load 'rails/tasks/engine.rake'
28
+
29
+ task :cucumber => 'app:cucumber'
30
+ task :default => [:spec, :cucumber]
31
+
32
+ Bundler::GemHelper.install_tasks
33
+
34
+
@@ -0,0 +1,15 @@
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
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
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
+ */
@@ -0,0 +1,7 @@
1
+ module Rankit
2
+ class ApplicationController < ActionController::Base
3
+ def after_sign_out_path_for(resource_or_scope)
4
+ rankit.new_user_session_path
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ require_dependency "rankit/application_controller"
2
+
3
+ module Rankit
4
+ class CommentsController < ApplicationController
5
+ before_filter :authenticate_user!, :load_rankable
6
+
7
+ def index
8
+ @comments = @rankable.comments.order('created_at DESC')
9
+ end
10
+
11
+ def new
12
+ @comment = Rankit::Comment.new
13
+ end
14
+
15
+ def create
16
+ @comment = @rankable.comments.build(comment_params)
17
+ @comment.user = current_user
18
+ if @comment.save
19
+ redirect_to rankit.rankable_comments_path(@rankable)
20
+ end
21
+ end
22
+
23
+ private
24
+ def load_rankable
25
+ @rankable = Rankit::Rankable.find(params[:rankable_id])
26
+ end
27
+
28
+ def comment_params
29
+ params.require(:comment).permit(:comment)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ class Rankit::Devise::SessionsController < Devise::SessionsController
2
+ layout 'rankit/application'
3
+ end
@@ -0,0 +1,48 @@
1
+ require_dependency "rankit/application_controller"
2
+
3
+ module Rankit
4
+ class RankablesController < ApplicationController
5
+ before_filter :authenticate_user!
6
+ before_filter :load_rankable, :only => [ :edit, :update, :destroy ]
7
+
8
+ def index
9
+ @rankables = Rankable.all
10
+ end
11
+
12
+ def new
13
+ @rankable = Rankable.new
14
+ end
15
+
16
+ def create
17
+ @rankable = Rankable.new(rankable_params)
18
+ @rankable.creator = current_user
19
+ if @rankable.save
20
+ redirect_to(rankit.rankables_path)
21
+ end
22
+ end
23
+
24
+ def edit
25
+ end
26
+
27
+ def update
28
+ @rankable.update_attributes rankable_params
29
+ if @rankable.save
30
+ redirect_to rankit.rankables_path, :notice => 'Rankable was updated succesfully'
31
+ end
32
+ end
33
+
34
+ def destroy
35
+ @rankable.destroy
36
+ redirect_to rankit.rankables_path, :notice => 'Rankable was deleted succesfully'
37
+ end
38
+
39
+ private
40
+ def rankable_params
41
+ params.require(:rankable).permit(:name, :description)
42
+ end
43
+
44
+ def load_rankable
45
+ @rankable = Rankit::Rankable.find(params[:id])
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,27 @@
1
+ require_dependency "rankit/application_controller"
2
+
3
+ module Rankit
4
+ class ScoresController < ApplicationController
5
+ before_filter :authenticate_user!
6
+ before_filter :load_rankable
7
+
8
+ def edit
9
+ @score = Rankit::Score.find_or_create_by_rankable_id_and_ranker_id(@rankable.id, current_user.id)
10
+ end
11
+
12
+ def update
13
+ @score = current_user.scores.find_by_rankable_id(@rankable.id)
14
+ @score.update_attributes(score_params)
15
+ redirect_to rankables_path, :notice => 'Your rank has been recorded'
16
+ end
17
+
18
+ private
19
+ def load_rankable
20
+ @rankable = Rankit::Rankable.find(params[:rankable_id])
21
+ end
22
+
23
+ def score_params
24
+ params.require(:score).permit(:score)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ module Rankit
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module Rankit
2
+ class Comment < ActiveRecord::Base
3
+ attr_accessible :comment, :rankable_id, :user_email, :user_id
4
+
5
+ cached_belongs_to :user, :caches => :email
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ module Rankit
2
+ class Rankable < ActiveRecord::Base
3
+ include ActiveModel::ForbiddenAttributesProtection
4
+
5
+ has_many :scores
6
+ has_many :comments
7
+
8
+ belongs_to :creator, :class_name => 'User'
9
+
10
+ attr_accessible :description, :name
11
+
12
+ before_save :recalculate_average_score
13
+
14
+ def average_score!
15
+ (scores.average(:score) || 0) * 100
16
+ end
17
+
18
+ def average_score
19
+ self[:average_score] / 100.0
20
+ end
21
+
22
+ def recalculate_average_score
23
+ self.average_score = average_score!
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ module Rankit
2
+ class Score < ActiveRecord::Base
3
+ include ActiveModel::ForbiddenAttributesProtection
4
+
5
+ belongs_to :rankable
6
+
7
+ after_save :update_rankable_score
8
+
9
+ SCORE_RANGE = (0..5)
10
+
11
+ attr_accessible :rankable_id, :ranker_id, :score
12
+
13
+ def update_rankable_score
14
+ rankable.recalculate_average_score
15
+ rankable.save
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ module Rankit
2
+ class User < ActiveRecord::Base
3
+ attr_accessible :email
4
+
5
+ has_many :scores, :foreign_key => 'ranker_id'
6
+ has_many :comments
7
+
8
+ devise :database_authenticatable, :timeoutable
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title Rankit
5
+ = stylesheet_link_tag "//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css", :media => :all
6
+ = stylesheet_link_tag "rankit/application", :media => "all"
7
+ = javascript_include_tag "rankit/application"
8
+ = csrf_meta_tags
9
+ %body
10
+ .container
11
+ .row
12
+ .navbar
13
+ .navbar-inner
14
+ = link_to 'Rankit', rankit.root_path, :class => "brand"
15
+ %ul.nav
16
+ %li= link_to 'Sign out', rankit.destroy_user_session_path if current_user
17
+ .row
18
+ - if flash[:notice]
19
+ .alert.alert-success
20
+ = flash[:notice]
21
+ - if flash[:alert]
22
+ .alert
23
+ = flash[:alert]
24
+ = yield
@@ -0,0 +1,3 @@
1
+ = content_tag_for :tr, comment do
2
+ %td= comment.user_email
3
+ %td= comment.comment
@@ -0,0 +1,6 @@
1
+ %h1 Comments for #{@rankable.name}
2
+
3
+ = link_to 'New Comment', rankit.new_rankable_comment_path(@rankable), :class => 'btn btn-primary btn-small'
4
+
5
+ %table.table.table-striped
6
+ = render @comments
@@ -0,0 +1,10 @@
1
+ %h1 New comment for #{@rankable.name}
2
+
3
+ .row
4
+ .span5
5
+ = form_for [:rankable, @comment] do |f|
6
+ = f.label :comment
7
+ = f.text_area :comment, :class => 'span5', :rows => 5
8
+ .form-actions
9
+ = f.submit :class => 'btn btn-primary'
10
+ = link_to 'Cancel', rankit.rankables_path, :class => 'btn'
@@ -0,0 +1,16 @@
1
+ %h2 Sign in
2
+ = form_for(resource, :as => resource_name, :url => rankit.user_session_path) do |f|
3
+ %div
4
+ = f.label :email
5
+ %br/
6
+ = f.email_field :email
7
+ %div
8
+ = f.label :password
9
+ %br/
10
+ = f.password_field :password
11
+ - if devise_mapping.rememberable?
12
+ %div
13
+ = f.check_box :remember_me
14
+ = f.label :remember_me
15
+ %div= f.submit "Sign in", :class => "btn"
16
+ = render "devise/shared/links"
@@ -0,0 +1,25 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Sign in", rankit.new_session_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Sign up", rankit.new_registration_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10
+ <%= link_to "Forgot your password?", rankit.new_password_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", rankit.new_confirmation_path(resource_name) %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", rankit.new_unlock_path(resource_name) %><br />
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.omniauthable? %>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to "Sign in with #{provider.to_s.titleize}", rankit.omniauth_authorize_path(resource_name, provider) %><br />
24
+ <% end -%>
25
+ <% end -%>
@@ -0,0 +1,7 @@
1
+ = f.label :name
2
+ = f.text_field :name, :class => 'span5'
3
+ = f.label :description
4
+ = f.text_area :description, :class => 'span5', :rows => 10
5
+ .form-actions
6
+ = f.submit :class => 'btn btn-primary'
7
+ = link_to 'Cancel', rankit.rankables_path, :class => 'btn'
@@ -0,0 +1,7 @@
1
+ = content_tag_for :tr, rankable do
2
+ %td= rankable.name
3
+ %td= rankable.average_score
4
+ %td= link_to 'Edit', rankit.edit_rankable_path(rankable), :class => 'btn btn-small'
5
+ %td= link_to 'Delete', rankit.rankable_path(rankable), :method => :delete, :class => 'btn btn-small', :confirm => 'Are you sure?'
6
+ %td= link_to 'Score', rankit.edit_rankable_score_path(rankable), :class => 'btn btn-small'
7
+ %td= link_to 'Comments', rankit.rankable_comments_path(rankable), :class => 'btn btn-small'
@@ -0,0 +1,6 @@
1
+ %h1 Edit Rankables
2
+
3
+ .row
4
+ .span5
5
+ = form_for @rankable do |f|
6
+ = render 'form', { :f => f }
@@ -0,0 +1,9 @@
1
+ %h1 Rankables
2
+
3
+ .row
4
+ .span12= link_to 'New rankable', rankit.new_rankable_path, :class => 'btn btn-small btn-primary'
5
+
6
+ .row
7
+ .span12
8
+ %table.table
9
+ = render @rankables
@@ -0,0 +1,6 @@
1
+ %h1 New Rankable
2
+
3
+ .row
4
+ .span5
5
+ = form_for @rankable do |f|
6
+ = render 'form', { :f => f }
@@ -0,0 +1,10 @@
1
+ %h1 Rank for #{@rankable.name}
2
+
3
+ .row
4
+ .span5
5
+ = form_for [:rankable, @score] do |f|
6
+ = f.label :score
7
+ = f.select :score, Rankit::Score::SCORE_RANGE
8
+ .form-actions
9
+ = f.submit :class => 'btn btn-primary'
10
+ = link_to 'Cancel', rankit.rankables_path, :class => 'btn'
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -0,0 +1,13 @@
1
+ require 'devise'
2
+ Devise.setup do |config|
3
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
4
+ require 'devise/orm/active_record'
5
+ config.case_insensitive_keys = [ :email ]
6
+ config.strip_whitespace_keys = [ :email ]
7
+ config.skip_session_storage = [:http_auth]
8
+ config.stretches = Rails.env.test? ? 1 : 10
9
+ config.reconfirmable = true
10
+ config.reset_password_within = 6.hours
11
+ config.sign_out_via = :get
12
+ config.warden { |manager| manager.failure_app = Rankit::Devise::FailureApp }
13
+ end
@@ -0,0 +1,58 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ errors:
5
+ messages:
6
+ expired: "has expired, please request a new one"
7
+ not_found: "not found"
8
+ already_confirmed: "was already confirmed, please try signing in"
9
+ not_locked: "was not locked"
10
+ not_saved:
11
+ one: "1 error prohibited this %{resource} from being saved:"
12
+ other: "%{count} errors prohibited this %{resource} from being saved:"
13
+
14
+ devise:
15
+ failure:
16
+ already_authenticated: 'You are already signed in.'
17
+ unauthenticated: 'You need to sign in or sign up before continuing.'
18
+ unconfirmed: 'You have to confirm your account before continuing.'
19
+ locked: 'Your account is locked.'
20
+ invalid: 'Invalid email or password.'
21
+ invalid_token: 'Invalid authentication token.'
22
+ timeout: 'Your session expired, please sign in again to continue.'
23
+ inactive: 'Your account was not activated yet.'
24
+ sessions:
25
+ signed_in: 'Signed in successfully.'
26
+ signed_out: 'Signed out successfully.'
27
+ passwords:
28
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
+ updated: 'Your password was changed successfully. You are now signed in.'
30
+ updated_not_active: 'Your password was changed successfully.'
31
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
32
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
33
+ confirmations:
34
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
35
+ send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
36
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
37
+ registrations:
38
+ signed_up: 'Welcome! You have signed up successfully.'
39
+ signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
40
+ signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
41
+ signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
42
+ updated: 'You updated your account successfully.'
43
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
44
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
45
+ unlocks:
46
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
47
+ unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
48
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
49
+ omniauth_callbacks:
50
+ success: 'Successfully authenticated from %{kind} account.'
51
+ failure: 'Could not authenticate you from %{kind} because "%{reason}".'
52
+ mailer:
53
+ confirmation_instructions:
54
+ subject: 'Confirmation instructions'
55
+ reset_password_instructions:
56
+ subject: 'Reset password instructions'
57
+ unlock_instructions:
58
+ subject: 'Unlock Instructions'
@@ -0,0 +1,10 @@
1
+ Rankit::Engine.routes.draw do
2
+ devise_for :users, :class_name => 'Rankit::User', :module => 'rankit/devise'
3
+
4
+ resources :rankables do
5
+ resource :score, :only => [ :edit, :update ]
6
+ resources :comments, :only => [ :index, :new, :create ]
7
+ end
8
+
9
+ root :to => 'rankables#index'
10
+ end
@@ -0,0 +1,10 @@
1
+ class CreateRankitUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :rankit_users do |t|
4
+ t.string :email
5
+ t.string :encrypted_password
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateRankitRankables < ActiveRecord::Migration
2
+ def change
3
+ create_table :rankit_rankables do |t|
4
+ t.integer :creator_id
5
+ t.string :name
6
+ t.text :description
7
+ t.integer :average_score
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ class CreateRankitScores < ActiveRecord::Migration
2
+ def change
3
+ create_table :rankit_scores do |t|
4
+ t.integer :ranker_id
5
+ t.integer :rankable_id
6
+ t.integer :score
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ class CreateRankitComments < ActiveRecord::Migration
2
+ def change
3
+ create_table :rankit_comments do |t|
4
+ t.integer :rankable_id
5
+ t.integer :user_id
6
+ t.string :user_email
7
+ t.text :comment
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ require "rankit/engine"
2
+ require 'devise'
3
+ require 'cached_belongs_to'
4
+ require 'haml-rails'
5
+ require 'strong_parameters'
6
+
7
+ module Rankit
8
+ autoload :Devise, 'rankit/devise/failure_app'
9
+ end
@@ -0,0 +1,9 @@
1
+ module Rankit
2
+ module Devise
3
+ class FailureApp < ::Devise::FailureApp
4
+ def redirect_url
5
+ rankit.new_user_session_path
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Rankit
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Rankit
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Rankit
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :rankit do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,251 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rankit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Padilla
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.8
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.8
30
+ - !ruby/object:Gem::Dependency
31
+ name: strong_parameters
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: devise
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.1'
62
+ - !ruby/object:Gem::Dependency
63
+ name: haml-rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '0.3'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '0.3'
78
+ - !ruby/object:Gem::Dependency
79
+ name: cached_belongs_to
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.0.3
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.0.3
94
+ - !ruby/object:Gem::Dependency
95
+ name: sqlite3
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rspec-rails
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '2.11'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '2.11'
126
+ - !ruby/object:Gem::Dependency
127
+ name: cucumber-rails
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: '1.3'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '1.3'
142
+ - !ruby/object:Gem::Dependency
143
+ name: database_cleaner
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: launchy
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ description: Post stuff, rank it, let others rank, comment
175
+ email:
176
+ - david@crowdint.com
177
+ executables: []
178
+ extensions: []
179
+ extra_rdoc_files: []
180
+ files:
181
+ - app/assets/javascripts/rankit/application.js
182
+ - app/assets/stylesheets/rankit/application.css
183
+ - app/controllers/rankit/application_controller.rb
184
+ - app/controllers/rankit/comments_controller.rb
185
+ - app/controllers/rankit/devise/sessions_controller.rb
186
+ - app/controllers/rankit/rankables_controller.rb
187
+ - app/controllers/rankit/scores_controller.rb
188
+ - app/helpers/rankit/application_helper.rb
189
+ - app/models/rankit/comment.rb
190
+ - app/models/rankit/rankable.rb
191
+ - app/models/rankit/score.rb
192
+ - app/models/rankit/user.rb
193
+ - app/views/layouts/rankit/application.html.haml
194
+ - app/views/rankit/comments/_comment.html.haml
195
+ - app/views/rankit/comments/index.html.haml
196
+ - app/views/rankit/comments/new.html.haml
197
+ - app/views/rankit/devise/sessions/new.html.haml
198
+ - app/views/rankit/devise/shared/_links.erb
199
+ - app/views/rankit/rankables/_form.html.haml
200
+ - app/views/rankit/rankables/_rankable.html.haml
201
+ - app/views/rankit/rankables/edit.html.haml
202
+ - app/views/rankit/rankables/index.html.haml
203
+ - app/views/rankit/rankables/new.html.haml
204
+ - app/views/rankit/scores/edit.html.haml
205
+ - config/cucumber.yml
206
+ - config/initializers/devise.rb
207
+ - config/locales/devise.en.yml
208
+ - config/routes.rb
209
+ - db/migrate/20121002035444_create_rankit_users.rb
210
+ - db/migrate/20121002071154_create_rankit_rankables.rb
211
+ - db/migrate/20121002203001_create_rankit_scores.rb
212
+ - db/migrate/20121002224650_create_rankit_comments.rb
213
+ - lib/rankit/devise/failure_app.rb
214
+ - lib/rankit/engine.rb
215
+ - lib/rankit/version.rb
216
+ - lib/rankit.rb
217
+ - lib/tasks/rankit_tasks.rake
218
+ - MIT-LICENSE
219
+ - Rakefile
220
+ - README.markdown
221
+ homepage: https://github.com/crowdint/rankit
222
+ licenses: []
223
+ post_install_message:
224
+ rdoc_options: []
225
+ require_paths:
226
+ - lib
227
+ required_ruby_version: !ruby/object:Gem::Requirement
228
+ none: false
229
+ requirements:
230
+ - - ! '>='
231
+ - !ruby/object:Gem::Version
232
+ version: '0'
233
+ segments:
234
+ - 0
235
+ hash: -784044612865534987
236
+ required_rubygems_version: !ruby/object:Gem::Requirement
237
+ none: false
238
+ requirements:
239
+ - - ! '>='
240
+ - !ruby/object:Gem::Version
241
+ version: '0'
242
+ segments:
243
+ - 0
244
+ hash: -784044612865534987
245
+ requirements: []
246
+ rubyforge_project:
247
+ rubygems_version: 1.8.23
248
+ signing_key:
249
+ specification_version: 3
250
+ summary: Post stuff, rank it, let others rank, comment
251
+ test_files: []