appstats 0.0.12 → 0.0.13
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 +1 -1
- data/lib/appstats/version.rb +1 -1
- data/spec/logger_spec.rb +21 -15
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/appstats/logger.rb
CHANGED
@@ -99,7 +99,7 @@ module Appstats
|
|
99
99
|
def self.format_input(raw_input,newline_delimiter)
|
100
100
|
return raw_input if raw_input.nil?
|
101
101
|
return raw_input unless raw_input.kind_of?(String)
|
102
|
-
raw_input.gsub(/\
|
102
|
+
raw_input.gsub(/\n/,newline_delimiter)
|
103
103
|
end
|
104
104
|
|
105
105
|
end
|
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.13 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.13 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.13 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.13 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.13 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,60 +159,66 @@ 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.13 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
167
|
it "should handle numbers" do
|
168
|
-
expected = "0.0.
|
168
|
+
expected = "0.0.13 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
169
169
|
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
170
170
|
actual.should == expected
|
171
171
|
end
|
172
172
|
|
173
173
|
it "should handle default contexts" do
|
174
174
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
175
|
-
expected = "0.0.
|
175
|
+
expected = "0.0.13 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
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 contexts (and sort them by symbol)" do
|
181
|
-
expected = "0.0.
|
181
|
+
expected = "0.0.13 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
182
182
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
183
183
|
actual.should == expected
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
187
|
-
expected = "0.0.
|
187
|
+
expected = "0.0.13 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
188
188
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
189
189
|
actual.should == expected
|
190
190
|
|
191
|
-
expected = "0.0.
|
191
|
+
expected = "0.0.13 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
192
192
|
actual = Appstats::Logger.entry_to_s("address::search==--n")
|
193
193
|
actual.should == expected
|
194
194
|
end
|
195
195
|
|
196
196
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
197
|
-
expected = "0.0.
|
197
|
+
expected = "0.0.13 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
198
198
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
199
199
|
actual.should == expected
|
200
200
|
end
|
201
|
+
|
202
|
+
it "should ignore spaces" do
|
203
|
+
expected = "0.0.13 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
|
204
|
+
actual = Appstats::Logger.entry_to_s("address search")
|
205
|
+
actual.should == expected
|
206
|
+
end
|
201
207
|
|
202
208
|
it "should convert newlines in action" do
|
203
|
-
expected = "0.0.
|
209
|
+
expected = "0.0.13 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
204
210
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
205
211
|
actual.should == expected
|
206
212
|
end
|
207
213
|
|
208
214
|
it "should convert newlines in context" do
|
209
|
-
expected = "0.0.
|
215
|
+
expected = "0.0.13 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
210
216
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
211
217
|
actual.should == expected
|
212
218
|
end
|
213
219
|
|
214
220
|
it "should convert newlines based on the delimiter" do
|
215
|
-
expected = "0.0.
|
221
|
+
expected = "0.0.13 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
216
222
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
217
223
|
actual.should == expected
|
218
224
|
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: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 13
|
10
|
+
version: 0.0.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Forward
|