appstats 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/appstats.rb +3 -1
- data/lib/appstats/version.rb +1 -1
- data/lib/templates/appstats_config.rb +1 -1
- data/spec/entry_spec.rb +4 -4
- data/spec/logger_spec.rb +16 -16
- metadata +6 -6
data/Gemfile.lock
CHANGED
data/lib/appstats.rb
CHANGED
@@ -12,7 +12,9 @@ require "#{File.dirname(__FILE__)}/appstats/log_collector"
|
|
12
12
|
require "#{File.dirname(__FILE__)}/appstats/query"
|
13
13
|
|
14
14
|
# required in the appstats.gemspec
|
15
|
-
|
15
|
+
unless Appstats.const_defined?(:VERSION)
|
16
|
+
require "#{File.dirname(__FILE__)}/appstats/version"
|
17
|
+
end
|
16
18
|
|
17
19
|
module Appstats
|
18
20
|
|
data/lib/appstats/version.rb
CHANGED
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.
|
191
|
+
entry = Entry.load_from_logger_entry("0.4.0 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.
|
194
|
+
entry.raw_entry.should == "0.4.0 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.
|
199
|
+
entry = Entry.load_from_logger_entry("0.4.0 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.
|
202
|
+
entry.raw_entry.should == "0.4.0 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
@@ -127,29 +127,29 @@ module Appstats
|
|
127
127
|
|
128
128
|
it "should handle a statistics entry" do
|
129
129
|
expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
|
130
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
130
|
+
actual = Appstats::Logger.entry_to_hash("0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
131
131
|
actual.should == expected
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should handle contexts" do
|
135
135
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
136
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
136
|
+
actual = Appstats::Logger.entry_to_hash("0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
137
137
|
actual.should == expected
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
141
141
|
expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
|
142
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
142
|
+
actual = Appstats::Logger.entry_to_hash("0.4.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
|
143
143
|
actual.should == expected
|
144
144
|
|
145
145
|
expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
|
146
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
146
|
+
actual = Appstats::Logger.entry_to_hash("0.4.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
|
147
147
|
actual.should == expected
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
151
151
|
expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
|
152
|
-
actual = Appstats::Logger.entry_to_hash("0.
|
152
|
+
actual = Appstats::Logger.entry_to_hash("0.4.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
|
153
153
|
actual.should == expected
|
154
154
|
end
|
155
155
|
|
@@ -158,66 +158,66 @@ module Appstats
|
|
158
158
|
describe "#entry_to_s" do
|
159
159
|
|
160
160
|
it "should handle a statistics entry" do
|
161
|
-
expected = "0.
|
161
|
+
expected = "0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
162
162
|
actual = Appstats::Logger.entry_to_s("address_search")
|
163
163
|
actual.should == expected
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should handle numbers" do
|
167
|
-
expected = "0.
|
167
|
+
expected = "0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
168
168
|
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
169
169
|
actual.should == expected
|
170
170
|
end
|
171
171
|
|
172
172
|
it "should handle default contexts" do
|
173
173
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
174
|
-
expected = "0.
|
174
|
+
expected = "0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
175
175
|
actual = Appstats::Logger.entry_to_s("address_search")
|
176
176
|
actual.should == expected
|
177
177
|
end
|
178
178
|
|
179
179
|
it "should handle contexts (and sort them by symbol)" do
|
180
|
-
expected = "0.
|
180
|
+
expected = "0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
181
181
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
182
182
|
actual.should == expected
|
183
183
|
end
|
184
184
|
|
185
185
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
186
|
-
expected = "0.
|
186
|
+
expected = "0.4.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
187
187
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
188
188
|
actual.should == expected
|
189
189
|
|
190
|
-
expected = "0.
|
190
|
+
expected = "0.4.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
191
191
|
actual = Appstats::Logger.entry_to_s("address::search==--n")
|
192
192
|
actual.should == expected
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
196
|
-
expected = "0.
|
196
|
+
expected = "0.4.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
197
197
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
198
198
|
actual.should == expected
|
199
199
|
end
|
200
200
|
|
201
201
|
it "should ignore spaces" do
|
202
|
-
expected = "0.
|
202
|
+
expected = "0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
|
203
203
|
actual = Appstats::Logger.entry_to_s("address search")
|
204
204
|
actual.should == expected
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should convert newlines in action" do
|
208
|
-
expected = "0.
|
208
|
+
expected = "0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
209
209
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
210
210
|
actual.should == expected
|
211
211
|
end
|
212
212
|
|
213
213
|
it "should convert newlines in context" do
|
214
|
-
expected = "0.
|
214
|
+
expected = "0.4.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
215
215
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
216
216
|
actual.should == expected
|
217
217
|
end
|
218
218
|
|
219
219
|
it "should convert newlines based on the delimiter" do
|
220
|
-
expected = "0.
|
220
|
+
expected = "0.4.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
221
221
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
222
222
|
actual.should == expected
|
223
223
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Forward
|
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
221
|
requirements: []
|
222
222
|
|
223
223
|
rubyforge_project:
|
224
|
-
rubygems_version: 1.
|
224
|
+
rubygems_version: 1.3.7
|
225
225
|
signing_key:
|
226
226
|
specification_version: 3
|
227
227
|
summary: Provide usage statistics about how your application is being used
|