appstats 0.0.9 → 0.0.10
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/lib/appstats/logger.rb +7 -3
- data/lib/appstats/version.rb +1 -1
- data/spec/logger_spec.rb +20 -1
- metadata +4 -4
data/lib/appstats/logger.rb
CHANGED
@@ -38,9 +38,9 @@ module Appstats
|
|
38
38
|
contexts = contexts.merge(default_contexts)
|
39
39
|
section_delimiter, assign_delimiter, newline_delimiter = determine_delimiters(contexts.merge(:action => action))
|
40
40
|
answer = "#{Appstats::VERSION} setup[#{section_delimiter},#{assign_delimiter},#{newline_delimiter}] "
|
41
|
-
answer += "#{now} action#{assign_delimiter}#{action}"
|
41
|
+
answer += "#{now} action#{assign_delimiter}#{format_input(action,newline_delimiter)}"
|
42
42
|
contexts.keys.sort.each do |key|
|
43
|
-
answer += " #{section_delimiter} #{key}#{assign_delimiter}#{contexts[key]}"
|
43
|
+
answer += " #{section_delimiter} #{key}#{assign_delimiter}#{format_input(contexts[key],newline_delimiter)}"
|
44
44
|
end
|
45
45
|
answer
|
46
46
|
end
|
@@ -94,7 +94,11 @@ module Appstats
|
|
94
94
|
end
|
95
95
|
[section_delimiter,assign_delimiter,newline_delimiter]
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
|
+
def self.format_input(raw_input,newline_delimiter)
|
99
|
+
return raw_input if raw_input.nil?
|
100
|
+
raw_input.gsub(/\s/,newline_delimiter)
|
101
|
+
end
|
98
102
|
|
99
103
|
end
|
100
104
|
end
|
data/lib/appstats/version.rb
CHANGED
data/spec/logger_spec.rb
CHANGED
@@ -107,7 +107,7 @@ module Appstats
|
|
107
107
|
|
108
108
|
describe "#entry" do
|
109
109
|
|
110
|
-
it "should
|
110
|
+
it "should outline the to_s" do
|
111
111
|
Appstats::Logger.stub!(:entry_to_s).with("address_search",{}).and_return("entry_to_s called")
|
112
112
|
Appstats::Logger.entry("address_search")
|
113
113
|
Appstats::Logger.raw_read.should == ["entry_to_s called"]
|
@@ -193,6 +193,25 @@ module Appstats
|
|
193
193
|
actual.should == expected
|
194
194
|
end
|
195
195
|
|
196
|
+
it "should convert newlines in action" do
|
197
|
+
expected = "0.0.9 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
198
|
+
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
199
|
+
actual.should == expected
|
200
|
+
end
|
201
|
+
|
202
|
+
it "should convert newlines in context" do
|
203
|
+
expected = "0.0.9 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
204
|
+
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
205
|
+
actual.should == expected
|
206
|
+
end
|
207
|
+
|
208
|
+
it "should convert newlines based on the delimiter" do
|
209
|
+
expected = "0.0.9 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
210
|
+
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
211
|
+
actual.should == expected
|
212
|
+
end
|
213
|
+
|
214
|
+
|
196
215
|
end
|
197
216
|
|
198
217
|
|
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: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Forward
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-02 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|