merit 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- merit (0.8.0)
4
+ merit (0.8.1)
5
5
  ambry (~> 0.3.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -14,10 +14,11 @@
14
14
  1. Add `gem 'merit'` to your `Gemfile`
15
15
  2. Run `rails g merit:install`
16
16
  3. Run `rails g merit MODEL_NAME`
17
- 4.
17
+ 4. Depending on your ORM
18
18
  * ActiveRecord: Run `rake db:migrate`
19
19
  * Mongoid: Set `config.orm = :mongoid` in `config/initializers/merit.rb`
20
- 5. Configure reputation rules for your application
20
+ 5. Define badges you will use in `config/initializers/merit.rb`
21
+ 6. Configure reputation rules for your application in `app/models/merit/*`
21
22
 
22
23
  ---
23
24
 
@@ -132,6 +133,7 @@ end
132
133
 
133
134
  # To-do list
134
135
 
136
+ * `Badge#grant_to` should accept a second `multiple` parameter
135
137
  * Can infer params[:id] = instance_variable.id in create actions, for having
136
138
  the object in the rule method parameter, so we don't need it in controllers.
137
139
  * add an error handler for inexistent badges.
@@ -150,5 +152,5 @@ end
150
152
 
151
153
  * [Tute Costa](https://github.com/tute)
152
154
  * [Juan Schwindt](https://github.com/jschwindt)
153
- * [Eric Knudtson](https://github.com/ek)
155
+ * [Eric Knudtson](https://github.com/ek) ([Chef Surfing](https://chefsurfing.com/))
154
156
  * [A4bandas media](https://github.com/a4bandas)
@@ -16,6 +16,10 @@ module Merit
16
16
  field :level, :type => Integer, :default => 0
17
17
  end
18
18
  end
19
+
20
+ def find_by_id(id)
21
+ Merit.orm == :mongoid ? where(:_id => id).first : super(id)
22
+ end
19
23
  end
20
24
 
21
25
  def badges
data/lib/merit/rule.rb CHANGED
@@ -14,7 +14,7 @@ module Merit
14
14
  if target_obj.present?
15
15
  return block.call(target_obj)
16
16
  else
17
- Rails.logger.warn "[merit] no target_obj found on Rule#applies?"
17
+ Rails.logger.warn "[merit] no target_obj found on Rule#applies?. MeritAction: #{action.inspect}"
18
18
  return false
19
19
  end
20
20
  when 0 # evaluates to boolean
data/merit.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
4
4
  s.description = "Manage badges, points and rankings (reputation) of resources in a Rails application."
5
5
  s.homepage = "http://github.com/tute/merit"
6
6
  s.files = `git ls-files`.split("\n").reject{|f| f =~ /^\./ }
7
- s.version = "0.8.0"
7
+ s.version = "0.8.1"
8
8
  s.authors = ["Tute Costa"]
9
9
  s.email = 'tutecosta@gmail.com'
10
10
  s.add_dependency 'ambry', '~> 0.3.0'
@@ -10,8 +10,4 @@ class Comment
10
10
  attr_accessible :name, :comment, :user_id, :votes
11
11
 
12
12
  validates :name, :comment, :user_id, :presence => true
13
-
14
- def self.find_by_id(id)
15
- where(:_id => id).first
16
- end
17
13
  end
@@ -10,10 +10,6 @@ class User
10
10
 
11
11
  attr_accessible :name
12
12
 
13
- def self.find_by_id(id)
14
- where(:_id => id).first
15
- end
16
-
17
13
  def show_badges
18
14
  create_sash_if_none
19
15
  badges_uniq = Badge.find_by_id(sash.badge_ids)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-11 00:00:00.000000000 Z
12
+ date: 2012-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ambry
16
- requirement: &70205487291520 !ruby/object:Gem::Requirement
16
+ requirement: &70334081390280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70205487291520
24
+ version_requirements: *70334081390280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &70205487291040 !ruby/object:Gem::Requirement
27
+ requirement: &70334081389800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.2.3
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70205487291040
35
+ version_requirements: *70334081389800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &70205487290660 !ruby/object:Gem::Requirement
38
+ requirement: &70334081409880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70205487290660
46
+ version_requirements: *70334081409880
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: haml
49
- requirement: &70205487290200 !ruby/object:Gem::Requirement
49
+ requirement: &70334081409420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70205487290200
57
+ version_requirements: *70334081409420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: capybara
60
- requirement: &70205487289780 !ruby/object:Gem::Requirement
60
+ requirement: &70334081409000 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70205487289780
68
+ version_requirements: *70334081409000
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &70205487289360 !ruby/object:Gem::Requirement
71
+ requirement: &70334081408580 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70205487289360
79
+ version_requirements: *70334081408580
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: bson_ext
82
- requirement: &70205487288940 !ruby/object:Gem::Requirement
82
+ requirement: &70334081408160 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70205487288940
90
+ version_requirements: *70334081408160
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: mongoid
93
- requirement: &70205487288440 !ruby/object:Gem::Requirement
93
+ requirement: &70334081407660 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: 2.0.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70205487288440
101
+ version_requirements: *70334081407660
102
102
  description: Manage badges, points and rankings (reputation) of resources in a Rails
103
103
  application.
104
104
  email: tutecosta@gmail.com