appstats 0.6.0 → 0.6.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
- appstats (0.6.0)
4
+ appstats (0.6.1)
5
5
  daemons
6
6
  net-scp
7
7
  rails (>= 2.3.0)
@@ -22,10 +22,10 @@ module ActsAsAppstatsable
22
22
  end
23
23
 
24
24
  def acts_as_appstatsable_options(options = {})
25
- if !options[:include].nil?
26
- self.appstats_after_create = options[:include].include?(:create)
27
- self.appstats_after_destroy = options[:include].include?(:destroy)
28
- self.appstats_after_update = options[:include].include?(:update)
25
+ if !options[:only].nil?
26
+ self.appstats_after_create = options[:only].include?(:create)
27
+ self.appstats_after_destroy = options[:only].include?(:destroy)
28
+ self.appstats_after_update = options[:only].include?(:update)
29
29
  elsif !options[:except].nil?
30
30
  self.appstats_after_create = !options[:except].include?(:create)
31
31
  self.appstats_after_destroy = !options[:except].include?(:destroy)
@@ -1,3 +1,3 @@
1
1
  module Appstats
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -15,7 +15,7 @@ describe ActsAsAppstatsable do
15
15
  describe "should be settable in the options" do
16
16
 
17
17
  it "should only track included options" do
18
- Appstats::TestObject.acts_as_appstatsable_options(:include => [:create,:destroy])
18
+ Appstats::TestObject.acts_as_appstatsable_options(:only => [:create,:destroy])
19
19
  @obj = Appstats::TestObject.create(:name => "x")
20
20
  @obj.name = "y"
21
21
  @obj.save
@@ -44,14 +44,14 @@ describe ActsAsAppstatsable do
44
44
  end
45
45
 
46
46
  it "should track after_destroy" do
47
- Appstats::TestObject.acts_as_appstatsable(:include => [:destroy])
47
+ Appstats::TestObject.acts_as_appstatsable(:only => [:destroy])
48
48
  @obj = Appstats::TestObject.create(:name => "x")
49
49
  @obj.destroy
50
50
  Appstats::Logger.raw_read.last.should == Appstats::Logger.entry_to_s("object-destroyed", :class_name => "Appstats::TestObject", :class_id => @obj.id, :details => "[x]")
51
51
  end
52
52
 
53
53
  it "should track after_update" do
54
- Appstats::TestObject.acts_as_appstatsable(:include => [:update])
54
+ Appstats::TestObject.acts_as_appstatsable(:only => [:update])
55
55
  @obj = Appstats::TestObject.create(:name => "x")
56
56
  @obj.name = "y"
57
57
  @obj.save
data/spec/entry_spec.rb CHANGED
@@ -188,18 +188,18 @@ module Appstats
188
188
  end
189
189
 
190
190
  it "should understand an entry without contexts" do
191
- entry = Entry.load_from_logger_entry("0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
191
+ entry = Entry.load_from_logger_entry("0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
192
192
  Entry.count.should == @before_count + 1
193
193
  entry.action.should == "address_search"
194
- entry.raw_entry.should == "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
194
+ entry.raw_entry.should == "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
195
195
  entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
196
196
  end
197
197
 
198
198
  it "should understand contexts" do
199
- entry = Entry.load_from_logger_entry("0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
199
+ entry = Entry.load_from_logger_entry("0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
200
200
  Entry.count.should == @before_count + 1
201
201
  entry.action.should == "address_filter"
202
- entry.raw_entry.should == "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
202
+ entry.raw_entry.should == "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
203
203
  entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
204
204
  entry.contexts.size.should == 2
205
205
  entry.contexts[0].context_key = "app_name"
data/spec/logger_spec.rb CHANGED
@@ -115,7 +115,7 @@ module Appstats
115
115
 
116
116
  it "should accept numbers" do
117
117
  Appstats::Logger.entry(5, :blah => 6)
118
- Appstats::Logger.raw_read.should == ["0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
118
+ Appstats::Logger.raw_read.should == ["0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
119
119
  end
120
120
 
121
121
  end
@@ -124,7 +124,7 @@ module Appstats
124
124
 
125
125
  it "should look similar to regular entry" do
126
126
  Appstats::Logger.exception_entry(RuntimeError.new("blah"),:on => "login")
127
- Appstats::Logger.raw_read.should == ["0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
127
+ Appstats::Logger.raw_read.should == ["0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
128
128
  end
129
129
 
130
130
  end
@@ -141,29 +141,29 @@ module Appstats
141
141
 
142
142
  it "should handle a statistics entry" do
143
143
  expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
144
- actual = Appstats::Logger.entry_to_hash("0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
144
+ actual = Appstats::Logger.entry_to_hash("0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
145
145
  actual.should == expected
146
146
  end
147
147
 
148
148
  it "should handle contexts" do
149
149
  expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
150
- actual = Appstats::Logger.entry_to_hash("0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
150
+ actual = Appstats::Logger.entry_to_hash("0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
151
151
  actual.should == expected
152
152
  end
153
153
 
154
154
  it "should handle actions with the delimiter (and change the delimiter)" do
155
155
  expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
156
- actual = Appstats::Logger.entry_to_hash("0.6.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
156
+ actual = Appstats::Logger.entry_to_hash("0.6.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
157
157
  actual.should == expected
158
158
 
159
159
  expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
160
- actual = Appstats::Logger.entry_to_hash("0.6.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
160
+ actual = Appstats::Logger.entry_to_hash("0.6.1 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
161
161
  actual.should == expected
162
162
  end
163
163
 
164
164
  it "should handle contexts with the delimiter (and change the delimiter)" do
165
165
  expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
166
- actual = Appstats::Logger.entry_to_hash("0.6.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
166
+ actual = Appstats::Logger.entry_to_hash("0.6.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
167
167
  actual.should == expected
168
168
  end
169
169
 
@@ -172,66 +172,66 @@ module Appstats
172
172
  describe "#entry_to_s" do
173
173
 
174
174
  it "should handle a statistics entry" do
175
- expected = "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
175
+ expected = "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
176
176
  actual = Appstats::Logger.entry_to_s("address_search")
177
177
  actual.should == expected
178
178
  end
179
179
 
180
180
  it "should handle numbers" do
181
- expected = "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
181
+ expected = "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
182
182
  actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
183
183
  actual.should == expected
184
184
  end
185
185
 
186
186
  it "should handle default contexts" do
187
187
  Appstats::Logger.default_contexts[:app_name] = "market"
188
- expected = "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
188
+ expected = "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
189
189
  actual = Appstats::Logger.entry_to_s("address_search")
190
190
  actual.should == expected
191
191
  end
192
192
 
193
193
  it "should handle contexts (and sort them by symbol)" do
194
- expected = "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
194
+ expected = "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
195
195
  actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
196
196
  actual.should == expected
197
197
  end
198
198
 
199
199
  it "should handle actions with the delimiter (and change the delimiter)" do
200
- expected = "0.6.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
200
+ expected = "0.6.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
201
201
  actual = Appstats::Logger.entry_to_s("address:=search-n")
202
202
  actual.should == expected
203
203
 
204
- expected = "0.6.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
204
+ expected = "0.6.1 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
205
205
  actual = Appstats::Logger.entry_to_s("address::search==--n")
206
206
  actual.should == expected
207
207
  end
208
208
 
209
209
  it "should handle contexts with the delimiter (and change the delimiter)" do
210
- expected = "0.6.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
210
+ expected = "0.6.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
211
211
  actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
212
212
  actual.should == expected
213
213
  end
214
214
 
215
215
  it "should ignore spaces" do
216
- expected = "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
216
+ expected = "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
217
217
  actual = Appstats::Logger.entry_to_s("address search")
218
218
  actual.should == expected
219
219
  end
220
220
 
221
221
  it "should convert newlines in action" do
222
- expected = "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
222
+ expected = "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
223
223
  actual = Appstats::Logger.entry_to_s("address_\nsearch")
224
224
  actual.should == expected
225
225
  end
226
226
 
227
227
  it "should convert newlines in context" do
228
- expected = "0.6.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
228
+ expected = "0.6.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
229
229
  actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
230
230
  actual.should == expected
231
231
  end
232
232
 
233
233
  it "should convert newlines based on the delimiter" do
234
- expected = "0.6.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
234
+ expected = "0.6.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
235
235
  actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
236
236
  actual.should == expected
237
237
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appstats
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 0
10
- version: 0.6.0
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Forward