appstats 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/appstats/logger.rb +2 -0
- data/lib/appstats/version.rb +1 -1
- data/spec/logger_spec.rb +20 -14
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/appstats/logger.rb
CHANGED
|
@@ -82,6 +82,7 @@ module Appstats
|
|
|
82
82
|
|
|
83
83
|
lookups.each do |pair|
|
|
84
84
|
name = pair[1]
|
|
85
|
+
next unless name.respond_to?("include?")
|
|
85
86
|
while(name.include?(section_delimiter))
|
|
86
87
|
section_delimiter += ":"
|
|
87
88
|
end
|
|
@@ -97,6 +98,7 @@ module Appstats
|
|
|
97
98
|
|
|
98
99
|
def self.format_input(raw_input,newline_delimiter)
|
|
99
100
|
return raw_input if raw_input.nil?
|
|
101
|
+
return raw_input unless raw_input.kind_of?(String)
|
|
100
102
|
raw_input.gsub(/\s/,newline_delimiter)
|
|
101
103
|
end
|
|
102
104
|
|
data/lib/appstats/version.rb
CHANGED
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.0.
|
|
130
|
+
actual = Appstats::Logger.entry_to_hash("0.0.12 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.0.
|
|
136
|
+
actual = Appstats::Logger.entry_to_hash("0.0.12 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.0.
|
|
142
|
+
actual = Appstats::Logger.entry_to_hash("0.0.12 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.0.
|
|
146
|
+
actual = Appstats::Logger.entry_to_hash("0.0.12 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.0.
|
|
152
|
+
actual = Appstats::Logger.entry_to_hash("0.0.12 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
|
|
153
153
|
actual.should == expected
|
|
154
154
|
end
|
|
155
155
|
|
|
@@ -159,54 +159,60 @@ module Appstats
|
|
|
159
159
|
describe "#entry_to_s" do
|
|
160
160
|
|
|
161
161
|
it "should handle a statistics entry" do
|
|
162
|
-
expected = "0.0.
|
|
162
|
+
expected = "0.0.12 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
|
163
163
|
actual = Appstats::Logger.entry_to_s("address_search")
|
|
164
164
|
actual.should == expected
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
+
it "should handle numbers" do
|
|
168
|
+
expected = "0.0.12 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
|
169
|
+
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
|
170
|
+
actual.should == expected
|
|
171
|
+
end
|
|
172
|
+
|
|
167
173
|
it "should handle default contexts" do
|
|
168
174
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
|
169
|
-
expected = "0.0.
|
|
175
|
+
expected = "0.0.12 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
|
170
176
|
actual = Appstats::Logger.entry_to_s("address_search")
|
|
171
177
|
actual.should == expected
|
|
172
178
|
end
|
|
173
179
|
|
|
174
180
|
it "should handle contexts (and sort them by symbol)" do
|
|
175
|
-
expected = "0.0.
|
|
181
|
+
expected = "0.0.12 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
|
176
182
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
|
177
183
|
actual.should == expected
|
|
178
184
|
end
|
|
179
185
|
|
|
180
186
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
|
181
|
-
expected = "0.0.
|
|
187
|
+
expected = "0.0.12 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
|
182
188
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
|
183
189
|
actual.should == expected
|
|
184
190
|
|
|
185
|
-
expected = "0.0.
|
|
191
|
+
expected = "0.0.12 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
|
186
192
|
actual = Appstats::Logger.entry_to_s("address::search==--n")
|
|
187
193
|
actual.should == expected
|
|
188
194
|
end
|
|
189
195
|
|
|
190
196
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
|
191
|
-
expected = "0.0.
|
|
197
|
+
expected = "0.0.12 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
|
192
198
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
|
193
199
|
actual.should == expected
|
|
194
200
|
end
|
|
195
201
|
|
|
196
202
|
it "should convert newlines in action" do
|
|
197
|
-
expected = "0.0.
|
|
203
|
+
expected = "0.0.12 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
|
198
204
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
|
199
205
|
actual.should == expected
|
|
200
206
|
end
|
|
201
207
|
|
|
202
208
|
it "should convert newlines in context" do
|
|
203
|
-
expected = "0.0.
|
|
209
|
+
expected = "0.0.12 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
|
204
210
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
|
205
211
|
actual.should == expected
|
|
206
212
|
end
|
|
207
213
|
|
|
208
214
|
it "should convert newlines based on the delimiter" do
|
|
209
|
-
expected = "0.0.
|
|
215
|
+
expected = "0.0.12 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
|
210
216
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
|
211
217
|
actual.should == expected
|
|
212
218
|
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:
|
|
4
|
+
hash: 7
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 12
|
|
10
|
+
version: 0.0.12
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Andrew Forward
|