von 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +46 -5
- data/Rakefile +1 -1
- data/lib/von.rb +42 -5
- data/lib/von/config.rb +54 -24
- data/lib/von/counter.rb +41 -83
- data/lib/von/counters/best.rb +68 -0
- data/lib/von/counters/commands.rb +41 -0
- data/lib/von/counters/current.rb +43 -0
- data/lib/von/counters/period.rb +62 -0
- data/lib/von/counters/total.rb +49 -0
- data/lib/von/period.rb +51 -30
- data/lib/von/version.rb +1 -1
- data/test/config_test.rb +31 -11
- data/test/counter_test.rb +40 -65
- data/test/counters/best_test.rb +53 -0
- data/test/counters/current_test.rb +55 -0
- data/test/counters/period_test.rb +78 -0
- data/test/counters/total_test.rb +33 -0
- data/test/period_test.rb +62 -40
- data/test/test_helper.rb +2 -62
- data/test/von_test.rb +25 -3
- data/von.gemspec +1 -0
- metadata +31 -3
- data/lib/von/model_counter.rb +0 -28
data/von.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
|
|
22
22
|
|
23
23
|
gem.add_development_dependency 'rake', '~> 10.0.3'
|
24
24
|
gem.add_development_dependency 'minitest', '~> 3.0.0'
|
25
|
+
gem.add_development_dependency 'fakeredis', '~> 0.4.1'
|
25
26
|
gem.add_development_dependency 'mocha', '~> 0.11.4'
|
26
27
|
gem.add_development_dependency 'timecop', '~> 0.5.9.1'
|
27
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: von
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 3.0.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: fakeredis
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.4.1
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.4.1
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
95
|
name: mocha
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,11 +139,19 @@ files:
|
|
123
139
|
- lib/von.rb
|
124
140
|
- lib/von/config.rb
|
125
141
|
- lib/von/counter.rb
|
126
|
-
- lib/von/
|
142
|
+
- lib/von/counters/best.rb
|
143
|
+
- lib/von/counters/commands.rb
|
144
|
+
- lib/von/counters/current.rb
|
145
|
+
- lib/von/counters/period.rb
|
146
|
+
- lib/von/counters/total.rb
|
127
147
|
- lib/von/period.rb
|
128
148
|
- lib/von/version.rb
|
129
149
|
- test/config_test.rb
|
130
150
|
- test/counter_test.rb
|
151
|
+
- test/counters/best_test.rb
|
152
|
+
- test/counters/current_test.rb
|
153
|
+
- test/counters/period_test.rb
|
154
|
+
- test/counters/total_test.rb
|
131
155
|
- test/period_test.rb
|
132
156
|
- test/test_helper.rb
|
133
157
|
- test/von_test.rb
|
@@ -159,6 +183,10 @@ summary: Von is an opinionated Redis stats tracker.
|
|
159
183
|
test_files:
|
160
184
|
- test/config_test.rb
|
161
185
|
- test/counter_test.rb
|
186
|
+
- test/counters/best_test.rb
|
187
|
+
- test/counters/current_test.rb
|
188
|
+
- test/counters/period_test.rb
|
189
|
+
- test/counters/total_test.rb
|
162
190
|
- test/period_test.rb
|
163
191
|
- test/test_helper.rb
|
164
192
|
- test/von_test.rb
|
data/lib/von/model_counter.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module Von
|
2
|
-
module ModelCounter
|
3
|
-
extend ::ActiveSupport::Concern
|
4
|
-
|
5
|
-
module ClassMethods
|
6
|
-
def increments_stat(key, options = {})
|
7
|
-
increment_method = "increment_stat_#{key.gsub(/:/, '_')}".to_sym
|
8
|
-
|
9
|
-
define_method increment_method do
|
10
|
-
Von.increment(key)
|
11
|
-
end
|
12
|
-
|
13
|
-
case options[:on]
|
14
|
-
when :create
|
15
|
-
after_create increment_method
|
16
|
-
when :save
|
17
|
-
after_save increment_method
|
18
|
-
when :update
|
19
|
-
after_update increment_method
|
20
|
-
else
|
21
|
-
# default to create
|
22
|
-
after_create increment_method
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|