merit 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be995bc6f76b25bcfd157f902124baba46eb05a7
4
- data.tar.gz: 3905b409c862c55b11e05a892bdad1fca4371653
3
+ metadata.gz: 123265ab30632290e284deffe94b000aab61af82
4
+ data.tar.gz: 3e2dcca325352e75a7237c97f009104945af6215
5
5
  SHA512:
6
- metadata.gz: 30548a8373a7db2b1a37621bc8dbd08d60e7c2d11bf164b139e5098e245179acfcaec8bde96e4b6bf3a9b0edba238e9b45a65099abed95350bf0aa8d0b9370f5
7
- data.tar.gz: 1ecac2b778294d30882a0bba7ddcb165b0c328f12f74972cf0dba7dd65a207fa6fb8af151063c1ecd9769f4296bad0712583ab3f003433f8156d850d3652d9ec
6
+ metadata.gz: ee7cb5ebfc7acf53f13d03199f3456740d2a10c171a7d7aabb6eafad7abb919ab1c0855ec00d23a5a6a248f36502358ae02b3a6b9a5a70af69aa4bbc47c45a6d
7
+ data.tar.gz: 907ebc5ea903eb2977c9240fd5d2f5e9772091cff6352743520198b67b595e7187d56c974826f25bdcf2b88417cb5903229356fd5aba185d730142e472283900
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## 1.7.1
4
+
5
+ - [#121] Adds "Uninstall Merit" rake task.
6
+ - [#124] Thread safe configuration instance variable.
7
+ - [#133] Fixes Rails 4 + protected_attributes bug.
8
+ - Starts this Changelog!
9
+ - General code, tests and README improvements.
data/Gemfile CHANGED
@@ -6,6 +6,9 @@ version = ENV['RAILS_VERSION'] || '3.2'
6
6
  rails = case version
7
7
  when 'master'
8
8
  { github: 'rails/rails' }
9
+ when '4.0-protected-attributes'
10
+ gem 'protected_attributes'
11
+ "~> #{version}.0"
9
12
  when '4.0'
10
13
  "~> #{version}.0"
11
14
  when '3.2'
data/README.md CHANGED
@@ -1,12 +1,37 @@
1
1
  # Merit
2
- Merit is a reputation Ruby gem that supports Badges, Points, and Rankings.
3
2
 
4
-
5
- ![Merit gem](http://i567.photobucket.com/albums/ss118/DeuceBigglebags/th_nspot26_300.jpg)
3
+ Merit adds reputation behavior to Rails apps in the form of Badges, Points,
4
+ and Rankings.
6
5
 
7
6
  [![Build Status](https://travis-ci.org/tute/merit.png?branch=master)](http://travis-ci.org/tute/merit)
8
7
  [![Code Climate](https://codeclimate.com/github/tute/merit.png)](https://codeclimate.com/github/tute/merit)
9
8
 
9
+
10
+ # Table of Contents
11
+
12
+ - [Merit](#merit)
13
+ - [Table of Contents](#table-of-contents)
14
+ - [Installation](#installation)
15
+ - [Badges](#badges)
16
+ - [Creating Badges](#creating-badges)
17
+ - [Example](#example)
18
+ - [Defining Rules](#defining-rules)
19
+ - [Examples](#examples)
20
+ - [Other Actions](#other-actions)
21
+ - [Displaying Badges](#displaying-badges)
22
+ - [Points](#points)
23
+ - [Defining Rules](#defining-rules-1)
24
+ - [Examples](#examples-1)
25
+ - [Other Actions](#other-actions-1)
26
+ - [Displaying Points](#displaying-points)
27
+ - [Rankings](#rankings)
28
+ - [Defining Rules](#defining-rules-2)
29
+ - [Examples](#examples-2)
30
+ - [Displaying Rankings](#displaying-rankings)
31
+ - [Uninstalling Merit](#uninstalling-merit)
32
+ - [To-do List](#to-do-list)
33
+
34
+
10
35
  # Installation
11
36
 
12
37
  1. Add `gem 'merit'` to your `Gemfile`
@@ -16,10 +41,11 @@ Merit is a reputation Ruby gem that supports Badges, Points, and Rankings.
16
41
  5. Define badges in `config/initializers/merit.rb`
17
42
  6. Configure reputation rules for your application in `app/models/merit/*`
18
43
 
19
- ---
20
44
 
21
45
  # Badges
46
+
22
47
  ## Creating Badges
48
+
23
49
  Create badges in `config/initializers/merit.rb`
24
50
 
25
51
  `Merit::Badge.create!` takes a hash describing the badge:
@@ -30,6 +56,7 @@ Create badges in `config/initializers/merit.rb`
30
56
  * `:custom_fields` hash of anything else you want associated with the badge (optional)
31
57
 
32
58
  ### Example
59
+
33
60
  ```ruby
34
61
  Merit::Badge.create! ({
35
62
  id: 1,
@@ -39,11 +66,15 @@ Merit::Badge.create! ({
39
66
  })
40
67
  ```
41
68
 
42
- ## Defining Badge Rules
43
- Badges can be automatically given to any resource in your application based on rules and conditions you create.
44
- Badges can also have levels, and be permanent or temporary (A temporary badge is revoked when the conditions of the badge are no longer met).
69
+ ## Defining Rules
70
+
71
+ Badges can be automatically given to any resource in your application based on
72
+ rules and conditions you create. Badges can also have levels, and be permanent
73
+ or temporary (A temporary badge is revoked when the conditions of the badge
74
+ are no longer met).
45
75
 
46
- Badge rules / conditions are defined in `app/models/merit/badge_rules.rb` `initialize` block by calling `grant_on` with the following parameters:
76
+ Badge rules / conditions are defined in `app/models/merit/badge_rules.rb`
77
+ `initialize` block by calling `grant_on` with the following parameters:
47
78
 
48
79
  * `'controller#action'` a string similar to Rails routes
49
80
  * `:badge` corresponds to the `:name` of the badge
@@ -76,11 +107,11 @@ grant_on 'comments#vote', badge: 'relevant-commenter', to: :user do |comment|
76
107
  end
77
108
 
78
109
  grant_on ['users#create', 'users#update'], badge: 'autobiographer', temporary: true do |user|
79
- user.name.present? && user.email.present?
110
+ user.name? && user.email?
80
111
  end
81
112
  ```
82
113
 
83
- ## Other Badge Actions
114
+ ## Other Actions
84
115
 
85
116
  ```ruby
86
117
  # Check granted badges
@@ -102,9 +133,23 @@ Badge.last_granted(since_date: 1.week.ago, limit: 20)
102
133
  Badge.find(1).users
103
134
  ```
104
135
 
105
- ---
136
+ ## Displaying Badges
106
137
 
107
- # Defining point rules
138
+ Meritable models have a `badges` method which returns an array of associated
139
+ badges:
140
+
141
+ ```erb
142
+ <ul>
143
+ <% current_user.badges.each do |badge| %>
144
+ <li><%= badge.name %></li>
145
+ <% end %>
146
+ </ul>
147
+ ```
148
+
149
+
150
+ # Points
151
+
152
+ ## Defining Rules
108
153
 
109
154
  Points are given to "meritable" resources on actions-triggered, either to the
110
155
  action user or to the method(s) defined in the `:to` option. Define rules on
@@ -114,17 +159,18 @@ action user or to the method(s) defined in the `:to` option. Define rules on
114
159
 
115
160
  * `score`
116
161
  * `Integer`
117
- * `Proc`, or any object that accepts `call` which takes one argument, where the target_object is passed in and the return value is used as the score.
162
+ * `Proc`, or any object that accepts `call` which takes one argument, where
163
+ the target_object is passed in and the return value is used as the score.
118
164
  * `:on` action as string or array of strings (similar to Rails routes)
119
165
  * `:to` method(s) to send to the target_object (who should be scored?)
120
- * `:model_name` (optional) to specify the model name if it cannot be guessed from the controller.
121
- (e.g. `model_name: 'User'` for `RegistrationsController`, or
122
- `model_name: 'Comment'` for `Api::CommentsController`)
166
+ * `:model_name` (optional) to specify the model name if it cannot be guessed
167
+ from the controller. (e.g. `model_name: 'User'` for `RegistrationsController`,
168
+ or `model_name: 'Comment'` for `Api::CommentsController`)
123
169
  * `&block`
124
170
  * empty (always scores)
125
171
  * a block which evaluates to boolean (recieves target object as parameter)
126
172
 
127
- ## Examples
173
+ ### Examples
128
174
 
129
175
  ```ruby
130
176
  # app/models/merit/point_rules.rb
@@ -139,20 +185,23 @@ score 20, on: [
139
185
 
140
186
  score 15, on: 'reviews#create', to: [:reviewer, :reviewed]
141
187
 
142
- calculate = lambda { |photo| PhotoPointsCalculator.calculate_score_for(photo) }
143
- score calculate, on: 'photos#create'
188
+ proc = lambda { |photo| PhotoPointsCalculator.calculate_score_for(photo) }
189
+ score proc, on: 'photos#create'
144
190
  ```
145
191
 
146
- ```ruby
147
- # Check awarded points
148
- current_user.points # Returns an integer
192
+ ## Other Actions
149
193
 
194
+ ```ruby
150
195
  # Score manually
151
196
  current_user.add_points(20, 'Optional log message')
152
197
  current_user.subtract_points(10)
153
198
  ```
154
199
 
155
200
  ```ruby
201
+ # Query awarded points since a given date
202
+ score_points = current_user.sash.scores.first.score_points
203
+ score_points.where("created_at > '#{1.month.ago}'").sum(:num_points)
204
+
156
205
  # List top 10 scored users in the last month
157
206
  Merit::Score.top_scored
158
207
 
@@ -164,18 +213,27 @@ Merit::Score.top_scored(
164
213
  )
165
214
  ```
166
215
 
167
- ---
216
+ ## Displaying Points
217
+
218
+ Meritable models have a `points` method which returns an integer:
219
+
220
+ ```erb
221
+ <%= current_user.points %>
222
+ ```
223
+
168
224
 
169
- # Defining rank rules
225
+ # Rankings
170
226
 
171
- 5 stars is a common ranking use case. They are not given at specified actions
172
- like badges, you should define a cron job to test if ranks are to be granted.
227
+ A common ranking use case is 5 stars. They are not given at specified actions
228
+ like badges, a cron job should be defined to test if ranks are to be granted.
229
+
230
+ ## Defining Rules
173
231
 
174
232
  Define rules on `app/models/merit/rank_rules.rb`:
175
233
 
176
234
  `set_rank` accepts:
177
235
 
178
- * `:level` ranking level (greater is better)
236
+ * `:level` ranking level (greater is better, Lexicographical order)
179
237
  * `:to` model or scope to check if new rankings apply
180
238
  * `:level_name` attribute name (default is empty and results in
181
239
  '`level`' attribute, if set it's appended like
@@ -190,7 +248,7 @@ end
190
248
  ```
191
249
 
192
250
 
193
- ## Examples
251
+ ### Examples
194
252
 
195
253
  ```ruby
196
254
  set_rank level: 2, to: Committer.active do |committer|
@@ -202,8 +260,23 @@ set_rank level: 3, to: Committer.active do |committer|
202
260
  end
203
261
  ```
204
262
 
263
+ ## Displaying Rankings
264
+
265
+ ```erb
266
+ <%= current_user.level %>
267
+ ```
268
+
269
+
270
+ # Uninstalling Merit
271
+
272
+ 1. Run `rails d merit:install`
273
+ 2. Run `rails d merit MODEL_NAME` (e.g. `user`)
274
+ 3. Run `rails g merit:remove MODEL_NAME` (e.g. `user`)
275
+ 4. Run `rake db:migrate`
276
+ 5. Remove `merit` from your Gemfile
277
+
205
278
 
206
- # To-do list
279
+ # To-do List
207
280
 
208
281
  * Finish Observer implementation for `Judge`.
209
282
  * Move level from meritable model into Sash
@@ -0,0 +1,21 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ module ActiveRecord
4
+ module Generators
5
+ class RemoveGenerator < ActiveRecord::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+ desc "Creates a migration file to remove all traces of Merit on the DB"
10
+
11
+ def self.next_migration_number(path)
12
+ ActiveRecord::Generators::Base.next_migration_number(path)
13
+ end
14
+
15
+ def copy_migrations_and_model
16
+ migration_template 'remove_merit_tables.rb', 'db/migrate/remove_merit_tables.rb'
17
+ migration_template "remove_fields_from_model.rb", "db/migrate/remove_fields_from_#{table_name}"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ class RemoveFieldsFrom<%= table_name.camelize %> < ActiveRecord::Migration
2
+ def self.up
3
+ remove_column :<%= table_name %>, :sash_id
4
+ remove_column :<%= table_name %>, :level
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ class RemoveMeritTables < ActiveRecord::Migration
2
+ def self.up
3
+ drop_table :merit_actions
4
+ drop_table :merit_activity_logs
5
+ drop_table :badges_sashes
6
+ drop_table :sashes
7
+ drop_table :merit_scores
8
+ drop_table :merit_score_points
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ module Merit
2
+ module Generators
3
+ class RemoveGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('../templates', __FILE__)
5
+ hook_for :orm
6
+
7
+ private
8
+
9
+ def model_exists?
10
+ File.exists?(File.join(destination_root, model_path))
11
+ end
12
+
13
+ def model_path
14
+ @model_path ||= File.join("app", "models", "#{file_path}.rb")
15
+ end
16
+ end
17
+ end
18
+ end
@@ -3,7 +3,7 @@ Merit.setup do |config|
3
3
  # Check rules on each request or in background
4
4
  # config.checks_on_each_request = true
5
5
 
6
- # Define ORM. Could be :active_record (default) and :mongo_mapper and :mongoid
6
+ # Define ORM. Could be :active_record (default) and :mongoid
7
7
  # config.orm = :active_record
8
8
 
9
9
  # Define :user_model_name. This model will be used to grand badge if no :to option is given. Default is "User".
@@ -14,11 +14,14 @@ Merit.setup do |config|
14
14
  end
15
15
 
16
16
  # Create application badges (uses https://github.com/norman/ambry)
17
- # Merit::Badge.create!({
18
- # id: 1,
17
+ # badge_id = 0
18
+ # [{
19
+ # id: (badge_id = badge_id+1),
19
20
  # name: 'just-registered'
20
21
  # }, {
21
- # id: 2,
22
+ # id: (badge_id = badge_id+1),
22
23
  # name: 'best-unicorn',
23
24
  # custom_fields: { category: 'fantasy' }
24
- # })
25
+ # }].each do |attrs|
26
+ # Merit::Badge.create! attrs
27
+ # end
@@ -11,33 +11,43 @@ require 'merit/base_target_finder'
11
11
  require 'merit/target_finder'
12
12
 
13
13
  module Merit
14
+ def self.setup
15
+ @config ||= Configuration.new
16
+ yield @config if block_given?
17
+ end
18
+
14
19
  # Check rules on each request
15
- mattr_accessor :checks_on_each_request
16
- @@checks_on_each_request = true
20
+ def self.checks_on_each_request
21
+ @config.checks_on_each_request
22
+ end
17
23
 
18
- # Define ORM
19
- mattr_accessor :orm
20
- @@orm = :active_record
24
+ # # Define ORM
25
+ def self.orm
26
+ @config.orm
27
+ end
21
28
 
22
29
  # Define user_model_name
23
- mattr_accessor :user_model_name
24
- @@user_model_name = 'User'
25
30
  def self.user_model
26
- @@user_model_name.constantize
31
+ @config.user_model_name.constantize
27
32
  end
28
33
 
29
34
  # Define current_user_method
30
- mattr_accessor :current_user_method
31
35
  def self.current_user_method
32
- @@current_user_method || "current_#{@@user_model_name.downcase}".to_sym
36
+ @config.current_user_method || "current_#{@config.user_model_name.downcase}".to_sym
33
37
  end
34
38
 
35
-
36
- # Load configuration from initializer
37
- def self.setup
38
- yield self
39
+ class Configuration
40
+ attr_accessor :checks_on_each_request,
41
+ :orm, :user_model_name, :current_user_method
42
+ def initialize
43
+ @checks_on_each_request = true
44
+ @orm = :active_record
45
+ @user_model_name = 'User'
46
+ end
39
47
  end
40
48
 
49
+ setup
50
+
41
51
  class BadgeNotFound < Exception; end
42
52
  class RankAttributeNotDefined < Exception; end
43
53
 
@@ -24,12 +24,7 @@ module Merit
24
24
  end
25
25
 
26
26
  def _merit_orm_specific_config
27
- if Merit.orm == :mongo_mapper
28
- plugin Merit
29
- key :sash_id, String
30
- key :points, Integer, default: 0
31
- key :level, Integer, default: 0
32
- elsif Merit.orm == :mongoid
27
+ if Merit.orm == :mongoid
33
28
  field :sash_id
34
29
  field :points, type: Integer, default: 0
35
30
  field :level, type: Integer, default: 0
@@ -62,9 +57,6 @@ end
62
57
  if Object.const_defined?('ActiveRecord')
63
58
  ActiveRecord::Base.send :include, Merit
64
59
  end
65
- if Object.const_defined?('MongoMapper')
66
- MongoMapper::Document.plugin Merit
67
- end
68
60
  if Object.const_defined?('Mongoid')
69
61
  Mongoid::Document.send :include, Merit
70
62
  end
@@ -4,7 +4,7 @@ module Merit
4
4
 
5
5
  has_many :activity_logs, class_name: Merit::ActivityLog
6
6
 
7
- unless defined?(ActionController::StrongParameters)
7
+ if defined?(ProtectedAttributes) || !defined?(ActionController::StrongParameters)
8
8
  attr_accessible :user_id, :action_method, :action_value, :had_errors,
9
9
  :target_model, :target_id, :processed, :log
10
10
  end
@@ -5,7 +5,7 @@ module Merit
5
5
  belongs_to :action, class_name: Merit::Action
6
6
  belongs_to :related_change, polymorphic: true
7
7
 
8
- unless defined?(ActionController::StrongParameters)
8
+ if defined?(ProtectedAttributes) || !defined?(ActionController::StrongParameters)
9
9
  attr_accessible :action_id, :related_change, :description, :created_at
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ module Merit
5
5
  class_name: Merit::ActivityLog,
6
6
  as: :related_change
7
7
 
8
- unless defined?(ActionController::StrongParameters)
8
+ if defined?(ProtectedAttributes) || !defined?(ActionController::StrongParameters)
9
9
  attr_accessible :badge_id
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
5
5
  s.homepage = "http://github.com/tute/merit"
6
6
  s.files = `git ls-files`.split("\n").reject{|f| f =~ /^\./ }
7
7
  s.license = 'MIT'
8
- s.version = '1.7.0'
8
+ s.version = '1.7.1'
9
9
  s.authors = ["Tute Costa"]
10
10
  s.email = 'tutecosta@gmail.com'
11
11
 
@@ -3,7 +3,7 @@ Merit.setup do |config|
3
3
  # Check rules on each request or in background
4
4
  # config.checks_on_each_request = true
5
5
 
6
- # Define ORM. Could be :active_record (default) and :mongo_mapper and :mongoid
6
+ # Define ORM. Could be :active_record (default) and :mongoid
7
7
  config.orm = :mongoid
8
8
  end
9
9
 
@@ -3,7 +3,7 @@ class Comment < ActiveRecord::Base
3
3
 
4
4
  belongs_to :user
5
5
 
6
- unless defined?(ActionController::StrongParameters)
6
+ if defined?(ProtectedAttributes) || !defined?(ActionController::StrongParameters)
7
7
  attr_accessible :name, :comment, :user_id, :votes
8
8
  end
9
9
 
@@ -3,7 +3,7 @@ class User < ActiveRecord::Base
3
3
 
4
4
  has_many :comments
5
5
 
6
- unless defined?(ActionController::StrongParameters)
6
+ if defined?(ProtectedAttributes) || !defined?(ActionController::StrongParameters)
7
7
  attr_accessible :name
8
8
  end
9
9
 
@@ -20,4 +20,4 @@
20
20
  <li><%= link_to 'Comments', comments_url %></li>
21
21
  </ul>
22
22
  </body>
23
- </html>
23
+ </html>
@@ -16,6 +16,9 @@ module Dummy
16
16
  # config.i18n.default_locale = :de
17
17
  # config.active_record.whitelist_attributes = true
18
18
 
19
+ # http://stackoverflow.com/questions/20361428/rails-i18n-validation-deprecation-warning
20
+ config.i18n.enforce_available_locales = true
21
+
19
22
  # Configure the default encoding used in templates for Ruby 1.9.
20
23
  config.encoding = "utf-8"
21
24
 
@@ -3,7 +3,7 @@ Merit.setup do |config|
3
3
  # Check rules on each request or in background
4
4
  # config.checks_on_each_request = true
5
5
 
6
- # Define ORM. Could be:active_record (default), :mongo_mapper and :mongoid
6
+ # Define ORM. Could be:active_record (default) and :mongoid
7
7
  # config.orm = :active_record
8
8
  end
9
9
 
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130329222238) do
14
+ ActiveRecord::Schema.define(:version => 20130329224410) do
15
15
 
16
16
  create_table "badges_sashes", :force => true do |t|
17
17
  t.integer "badge_id"
@@ -24,7 +24,9 @@ describe Merit::TargetFinder do
24
24
 
25
25
  describe 'rule#to is :action_user' do
26
26
  it 'should return an array including user that executed the action' do
27
- Merit.user_model_name = 'User'
27
+ Merit.setup do |config|
28
+ config.user_model_name = 'User'
29
+ end
28
30
  rule = Merit::Rule.new
29
31
  rule.to = :action_user
30
32
  action = Merit::Action.new(user_id: 22)
@@ -40,7 +42,9 @@ describe Merit::TargetFinder do
40
42
 
41
43
  describe 'when user does not exist' do
42
44
  it 'should return warn and return an empty array' do
43
- Merit.user_model_name = 'User'
45
+ Merit.setup do |config|
46
+ config.user_model_name = 'User'
47
+ end
44
48
  rule = Merit::Rule.new
45
49
  rule.to = :action_user
46
50
  action = Merit::Action.new(user_id: 22)
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tute Costa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2014-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ambry
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 3.2.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 3.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: capybara
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simplecov
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
@@ -101,6 +101,7 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - CHANGELOG.md
104
105
  - Gemfile
105
106
  - MIT-LICENSE
106
107
  - README.md
@@ -111,14 +112,18 @@ files:
111
112
  - app/models/merit/badge.rb
112
113
  - lib/generators/active_record/install_generator.rb
113
114
  - lib/generators/active_record/merit_generator.rb
115
+ - lib/generators/active_record/remove_generator.rb
114
116
  - lib/generators/active_record/templates/add_fields_to_model.rb
115
117
  - lib/generators/active_record/templates/create_badges_sashes.rb
116
118
  - lib/generators/active_record/templates/create_merit_actions.rb
117
119
  - lib/generators/active_record/templates/create_merit_activity_logs.rb
118
120
  - lib/generators/active_record/templates/create_sashes.rb
119
121
  - lib/generators/active_record/templates/create_scores_and_points.rb
122
+ - lib/generators/active_record/templates/remove_fields_from_model.rb
123
+ - lib/generators/active_record/templates/remove_merit_tables.rb
120
124
  - lib/generators/merit/install_generator.rb
121
125
  - lib/generators/merit/merit_generator.rb
126
+ - lib/generators/merit/remove_generator.rb
122
127
  - lib/generators/merit/templates/merit.rb
123
128
  - lib/generators/merit/templates/merit_badge_rules.rb
124
129
  - lib/generators/merit/templates/merit_point_rules.rb
@@ -133,8 +138,6 @@ files:
133
138
  - lib/merit/models/active_record/merit/badges_sash.rb
134
139
  - lib/merit/models/active_record/merit/sash.rb
135
140
  - lib/merit/models/active_record/merit/score.rb
136
- - lib/merit/models/mongo_mapper/merit/action.rb
137
- - lib/merit/models/mongo_mapper/sash.rb
138
141
  - lib/merit/models/mongoid/merit/action.rb
139
142
  - lib/merit/models/mongoid/sash.rb
140
143
  - lib/merit/observer.rb
@@ -283,17 +286,17 @@ require_paths:
283
286
  - lib
284
287
  required_ruby_version: !ruby/object:Gem::Requirement
285
288
  requirements:
286
- - - '>='
289
+ - - ">="
287
290
  - !ruby/object:Gem::Version
288
291
  version: 1.9.2
289
292
  required_rubygems_version: !ruby/object:Gem::Requirement
290
293
  requirements:
291
- - - '>='
294
+ - - ">="
292
295
  - !ruby/object:Gem::Version
293
296
  version: '0'
294
297
  requirements: []
295
298
  rubyforge_project:
296
- rubygems_version: 2.0.14
299
+ rubygems_version: 2.2.0
297
300
  signing_key:
298
301
  specification_version: 4
299
302
  summary: General reputation Rails engine.
@@ -1,15 +0,0 @@
1
- module Merit
2
- class Action
3
- include MongoMapper::Document
4
-
5
- key :user_id, String
6
- key :action_method, String
7
- key :action_value, Integer
8
- key :had_errors, Boolean
9
- key :target_model, String
10
- key :target_id, String
11
- key :processed, Boolean, default: false
12
- key :log, String
13
- timestamps!
14
- end
15
- end
@@ -1,16 +0,0 @@
1
- class Sash
2
- include MongoMapper::Document
3
-
4
- key :badge_ids, Array
5
- timestamps!
6
-
7
- def add_badge(badge_id)
8
- self.badge_ids << badge_id
9
- self.save
10
- end
11
-
12
- def rm_badge(badge_id)
13
- self.badge_ids -= [badge_id]
14
- self.save
15
- end
16
- end