merit 0.2.5 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/Gemfile +2 -0
  2. data/Gemfile.lock +103 -0
  3. data/README.markdown +17 -2
  4. data/app/models/badge.rb +27 -19
  5. data/app/models/merit_action.rb +5 -3
  6. data/app/models/sash.rb +5 -14
  7. data/lib/generators/active_record/merit_generator.rb +14 -14
  8. data/lib/generators/{merit → active_record}/templates/create_badges_sashes.rb +0 -0
  9. data/lib/generators/{merit → active_record}/templates/create_merit_actions.rb +0 -0
  10. data/lib/generators/{merit → active_record}/templates/create_sashes.rb +0 -0
  11. data/lib/generators/merit/install_generator.rb +3 -20
  12. data/lib/generators/merit/merit_generator.rb +12 -0
  13. data/lib/generators/merit/templates/merit.rb +10 -1
  14. data/lib/merit.rb +11 -2
  15. data/lib/merit/controller_extensions.rb +2 -2
  16. data/lib/merit/model_additions.rb +18 -17
  17. data/lib/merit/models/active_record/badges_sash.rb +12 -0
  18. data/lib/merit/models/active_record/merit_action.rb +2 -0
  19. data/lib/merit/models/active_record/sash.rb +12 -0
  20. data/lib/merit/models/mongo_mapper/merit_action.rb +12 -0
  21. data/lib/merit/models/mongo_mapper/sash.rb +15 -0
  22. data/lib/merit/rule.rb +2 -2
  23. data/lib/merit/rules_badge.rb +1 -1
  24. data/merit.gemspec +16 -0
  25. data/test/dummy/Rakefile +7 -0
  26. data/test/dummy/app/controllers/application_controller.rb +7 -0
  27. data/test/dummy/app/controllers/comments_controller.rb +90 -0
  28. data/test/dummy/app/controllers/registrations_controller.rb +15 -0
  29. data/test/dummy/app/controllers/users_controller.rb +67 -0
  30. data/test/dummy/app/helpers/application_helper.rb +2 -0
  31. data/test/dummy/app/models/comment.rb +4 -0
  32. data/test/dummy/app/models/merit_badge_rules.rb +41 -0
  33. data/test/dummy/app/models/merit_point_rules.rb +18 -0
  34. data/test/dummy/app/models/merit_rank_rules.rb +25 -0
  35. data/test/dummy/app/models/user.rb +9 -0
  36. data/test/dummy/app/views/comments/_form.html.erb +29 -0
  37. data/test/dummy/app/views/comments/edit.html.erb +6 -0
  38. data/test/dummy/app/views/comments/index.html.erb +35 -0
  39. data/test/dummy/app/views/comments/new.html.erb +5 -0
  40. data/test/dummy/app/views/comments/show.html.erb +23 -0
  41. data/test/dummy/app/views/layouts/application.html.haml +18 -0
  42. data/test/dummy/app/views/users/_form.html.erb +22 -0
  43. data/test/dummy/app/views/users/edit.html.erb +6 -0
  44. data/test/dummy/app/views/users/index.html.erb +26 -0
  45. data/test/dummy/app/views/users/new.html.erb +5 -0
  46. data/test/dummy/app/views/users/show.html.erb +18 -0
  47. data/test/dummy/config.ru +4 -0
  48. data/test/dummy/config/application.rb +24 -0
  49. data/test/dummy/config/boot.rb +10 -0
  50. data/test/dummy/config/database.yml +22 -0
  51. data/test/dummy/config/environment.rb +5 -0
  52. data/test/dummy/config/environments/development.rb +26 -0
  53. data/test/dummy/config/environments/production.rb +49 -0
  54. data/test/dummy/config/environments/test.rb +35 -0
  55. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/test/dummy/config/initializers/badges_data.rb +40 -0
  57. data/test/dummy/config/initializers/inflections.rb +10 -0
  58. data/test/dummy/config/initializers/mime_types.rb +5 -0
  59. data/test/dummy/config/initializers/secret_token.rb +7 -0
  60. data/test/dummy/config/initializers/session_store.rb +8 -0
  61. data/test/dummy/config/locales/en.yml +5 -0
  62. data/test/dummy/config/routes.rb +9 -0
  63. data/test/dummy/db/migrate/20110421191249_create_users.rb +12 -0
  64. data/test/dummy/db/migrate/20110421191250_create_comments.rb +16 -0
  65. data/test/dummy/db/schema.rb +61 -0
  66. data/test/dummy/db/seeds.rb +17 -0
  67. data/test/dummy/public/404.html +26 -0
  68. data/test/dummy/public/422.html +26 -0
  69. data/test/dummy/public/500.html +26 -0
  70. data/test/dummy/public/favicon.ico +0 -0
  71. data/test/dummy/public/javascripts/application.js +2 -0
  72. data/test/dummy/public/javascripts/controls.js +965 -0
  73. data/test/dummy/public/javascripts/dragdrop.js +974 -0
  74. data/test/dummy/public/javascripts/effects.js +1123 -0
  75. data/test/dummy/public/javascripts/prototype.js +6001 -0
  76. data/test/dummy/public/javascripts/rails.js +191 -0
  77. data/test/dummy/public/stylesheets/.gitkeep +0 -0
  78. data/test/dummy/public/stylesheets/scaffold.css +56 -0
  79. data/test/dummy/script/rails +6 -0
  80. data/test/integration/navigation_test.rb +132 -0
  81. data/test/merit_unit_test.rb +22 -0
  82. data/test/support/integration_case.rb +5 -0
  83. data/test/test_helper.rb +22 -0
  84. metadata +132 -13
  85. data/app/models/badges_sash.rb +0 -14
  86. data/lib/generators/merit/templates/create_badges.rb +0 -19
@@ -1,14 +0,0 @@
1
- class BadgesSash < ActiveRecord::Base
2
- belongs_to :badge
3
- belongs_to :sash
4
-
5
- # TODO: Better way to do it? With composite keys ARel complained:
6
- # NoMethodError: undefined method `eq' for nil:NilClass
7
- # from ~/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.9/lib/active_support/whiny_nil.rb:48:in `method_missing'
8
- # from ~/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.9/lib/active_record/persistence.rb:259:in `update'
9
- def set_notified!(badge, sash)
10
- ActiveRecord::Base.connection.execute("UPDATE badges_sashes
11
- SET notified_user = TRUE
12
- WHERE badge_id = #{badge.id} AND sash_id = #{sash.id}")
13
- end
14
- end
@@ -1,19 +0,0 @@
1
- class CreateBadges < ActiveRecord::Migration
2
- def self.up
3
- create_table :badges do |t|
4
- t.string :name
5
- t.string :level
6
- t.string :image
7
- t.string :description
8
- t.timestamps
9
- end
10
-
11
- # First badges:
12
- # Badge.create( :name => 'just-registered' )
13
- # Badge.create( :name => 'creator', :level => 'inspired', :image => 'http://upload.wikimedia.org/wikipedia/commons/9/94/Luca_prodan.jpg' )
14
- end
15
-
16
- def self.down
17
- drop_table :badges
18
- end
19
- end