appstats 0.16.6 → 0.16.7
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/.gitignore +1 -0
- data/Gemfile.lock +62 -2
- data/Rakefile +16 -1
- data/appstats.gemspec +1 -0
- data/lib/appstats/ci.rake +57 -0
- data/lib/appstats/logger.rb +3 -0
- data/lib/appstats/version.rb +1 -1
- data/lib/templates/appstats_config.rb +1 -1
- data/spec/entry_spec.rb +8 -8
- data/spec/logger_spec.rb +34 -27
- data/spec/spec_helper.rb +1 -0
- metadata +19 -4
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
appstats (0.16.
|
4
|
+
appstats (0.16.7)
|
5
5
|
daemons
|
6
6
|
net-scp
|
7
7
|
rails (>= 2.3.0)
|
@@ -9,6 +9,7 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: http://rubygems.org/
|
11
11
|
specs:
|
12
|
+
Saikuro (1.1.0)
|
12
13
|
ZenTest (4.4.2)
|
13
14
|
abstract (1.0.0)
|
14
15
|
actionmailer (3.0.3)
|
@@ -38,22 +39,57 @@ GEM
|
|
38
39
|
activesupport (= 3.0.3)
|
39
40
|
activesupport (3.0.3)
|
40
41
|
arel (2.0.7)
|
42
|
+
arrayfields (4.7.4)
|
41
43
|
builder (2.1.2)
|
44
|
+
chronic (0.3.0)
|
45
|
+
churn (0.0.13)
|
46
|
+
chronic (>= 0.2.3)
|
47
|
+
hirb
|
48
|
+
json_pure
|
49
|
+
main
|
50
|
+
ruby_parser (~> 2.0.4)
|
51
|
+
sexp_processor (~> 3.0.3)
|
52
|
+
colored (1.2)
|
42
53
|
daemons (1.1.0)
|
43
54
|
diff-lcs (1.1.2)
|
44
55
|
erubis (2.6.6)
|
45
56
|
abstract (>= 1.0.0)
|
57
|
+
fattr (2.2.0)
|
58
|
+
flay (1.4.2)
|
59
|
+
ruby_parser (~> 2.0)
|
60
|
+
sexp_processor (~> 3.0)
|
61
|
+
flog (2.5.1)
|
62
|
+
ruby_parser (~> 2.0)
|
63
|
+
sexp_processor (~> 3.0)
|
64
|
+
haml (3.0.25)
|
65
|
+
hirb (0.4.0)
|
46
66
|
i18n (0.5.0)
|
67
|
+
json_pure (1.5.1)
|
47
68
|
mail (2.2.15)
|
48
69
|
activesupport (>= 2.3.6)
|
49
70
|
i18n (>= 0.4.0)
|
50
71
|
mime-types (~> 1.16)
|
51
72
|
treetop (~> 1.4.8)
|
73
|
+
main (4.4.0)
|
74
|
+
arrayfields (>= 4.7.4)
|
75
|
+
fattr (>= 2.1.0)
|
76
|
+
metric_fu (2.1.1)
|
77
|
+
Saikuro (>= 1.1.0)
|
78
|
+
activesupport (>= 2.0.0)
|
79
|
+
chronic (~> 0.3.0)
|
80
|
+
churn (>= 0.0.7)
|
81
|
+
flay (>= 1.2.1)
|
82
|
+
flog (>= 2.3.0)
|
83
|
+
rails_best_practices (>= 0.6.4)
|
84
|
+
rcov (>= 0.8.3.3)
|
85
|
+
reek (>= 1.2.6)
|
86
|
+
roodi (>= 2.1.0)
|
87
|
+
syntax
|
52
88
|
mime-types (1.16)
|
53
89
|
mysql (2.8.1)
|
54
90
|
net-scp (1.0.4)
|
55
91
|
net-ssh (>= 1.99.1)
|
56
|
-
net-ssh (2.1.
|
92
|
+
net-ssh (2.1.3)
|
57
93
|
polyglot (0.3.1)
|
58
94
|
rack (1.2.1)
|
59
95
|
rack-mount (0.6.13)
|
@@ -68,12 +104,27 @@ GEM
|
|
68
104
|
activesupport (= 3.0.3)
|
69
105
|
bundler (~> 1.0)
|
70
106
|
railties (= 3.0.3)
|
107
|
+
rails_best_practices (0.7.1)
|
108
|
+
activesupport
|
109
|
+
colored (~> 1.2)
|
110
|
+
erubis (~> 2.6.6)
|
111
|
+
haml (~> 3.0.18)
|
112
|
+
i18n
|
113
|
+
ruby-progressbar (~> 0.0.9)
|
114
|
+
ruby_parser (~> 2.0.4)
|
71
115
|
railties (3.0.3)
|
72
116
|
actionpack (= 3.0.3)
|
73
117
|
activesupport (= 3.0.3)
|
74
118
|
rake (>= 0.8.7)
|
75
119
|
thor (~> 0.14.4)
|
76
120
|
rake (0.8.7)
|
121
|
+
rcov (0.9.9)
|
122
|
+
reek (1.2.8)
|
123
|
+
ruby2ruby (~> 1.2)
|
124
|
+
ruby_parser (~> 2.0)
|
125
|
+
sexp_processor (~> 3.0)
|
126
|
+
roodi (2.1.0)
|
127
|
+
ruby_parser
|
77
128
|
rspec (2.4.0)
|
78
129
|
rspec-core (~> 2.4.0)
|
79
130
|
rspec-expectations (~> 2.4.0)
|
@@ -82,9 +133,17 @@ GEM
|
|
82
133
|
rspec-expectations (2.4.0)
|
83
134
|
diff-lcs (~> 1.1.2)
|
84
135
|
rspec-mocks (2.4.0)
|
136
|
+
ruby-progressbar (0.0.9)
|
137
|
+
ruby2ruby (1.2.5)
|
138
|
+
ruby_parser (~> 2.0)
|
139
|
+
sexp_processor (~> 3.0)
|
140
|
+
ruby_parser (2.0.6)
|
141
|
+
sexp_processor (~> 3.0)
|
142
|
+
sexp_processor (3.0.5)
|
85
143
|
standalone_migrations (0.3.0)
|
86
144
|
activerecord
|
87
145
|
rake
|
146
|
+
syntax (1.0.0)
|
88
147
|
thor (0.14.6)
|
89
148
|
treetop (1.4.9)
|
90
149
|
polyglot (>= 0.3.1)
|
@@ -96,6 +155,7 @@ PLATFORMS
|
|
96
155
|
DEPENDENCIES
|
97
156
|
ZenTest
|
98
157
|
appstats!
|
158
|
+
metric_fu
|
99
159
|
mysql
|
100
160
|
rspec
|
101
161
|
standalone_migrations
|
data/Rakefile
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
require 'tasks/standalone_migrations'
|
5
4
|
require 'appstats/tasks'
|
5
|
+
require 'metric_fu'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
require 'tasks/standalone_migrations'
|
8
|
+
|
9
|
+
import 'lib/appstats/ci.rake'
|
6
10
|
|
7
11
|
begin
|
8
12
|
MigratorTasks.new do |t|
|
@@ -17,3 +21,14 @@ begin
|
|
17
21
|
rescue LoadError => e
|
18
22
|
puts "gem install standalone_migrations to get db:migrate:* tasks! (Error: #{e})"
|
19
23
|
end
|
24
|
+
|
25
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
26
|
+
t.pattern = "spec/*_spec.rb"
|
27
|
+
t.rspec_opts = "--color"
|
28
|
+
end
|
29
|
+
|
30
|
+
MetricFu::Configuration.run do |config|
|
31
|
+
config.metrics = [:rcov]
|
32
|
+
config.rcov[:test_files] = ['spec/*_spec.rb']
|
33
|
+
config.rcov[:rcov_opts] << '-Ispec'
|
34
|
+
end
|
data/appstats.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency('ZenTest')
|
23
23
|
s.add_development_dependency('standalone_migrations')
|
24
24
|
s.add_development_dependency('mysql')
|
25
|
+
s.add_development_dependency('metric_fu')
|
25
26
|
|
26
27
|
s.files = `git ls-files`.split("\n")
|
27
28
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -0,0 +1,57 @@
|
|
1
|
+
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
2
|
+
namespace :ci do
|
3
|
+
desc "Perform a build on the CI server"
|
4
|
+
task :build => ['config', 'create_logs'] do
|
5
|
+
begin
|
6
|
+
Rake::Task['appstats:install:migrations'].invoke
|
7
|
+
Rake::Task['db:migrate'].invoke
|
8
|
+
Rake::Task['db:test:prepare'].invoke
|
9
|
+
Rake::Task['spec'].invoke
|
10
|
+
Rake::Task['metrics:all'].invoke
|
11
|
+
Rake::Task['ci:success'].invoke
|
12
|
+
rescue Exception => e
|
13
|
+
Rake::Task['ci:failure'].invoke
|
14
|
+
raise e
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Setup the correct database configuration files"
|
19
|
+
task :config do
|
20
|
+
source_db_file = '/cenx/appstats/sensitive/config.yml'
|
21
|
+
dest_db_file = "#{Dir.pwd}/db/config.yml"
|
22
|
+
abort "No database file [#{source_db_file}], unable to continue CI build" unless File.exists? source_db_file
|
23
|
+
FileUtils.cp source_db_file, dest_db_file, :preserve => false
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Create log files that are used when running tests"
|
27
|
+
task :create_logs do
|
28
|
+
if not File.exists?('log') then
|
29
|
+
FileUtils.mkdir 'log'
|
30
|
+
else
|
31
|
+
if not File.directory?('log') then
|
32
|
+
FileUtils.rm 'log'
|
33
|
+
FileUtils.mkdir 'log'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
[4, 7, 8].each do |i|
|
37
|
+
FileUtils.touch "log/appstats_remote_log_2#{i}.log"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Testing the environment"
|
42
|
+
task :test do
|
43
|
+
system('ruby -r rubygems -e "p Gem.path"')
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "The Build Succeeded, so tell our monitoring service"
|
47
|
+
task :success do
|
48
|
+
FileUtils.cp '/home/deployer/monitor/statuses/Appstats.cc.success', '/home/deployer/monitor/log/Appstats.cc', :preserve => false
|
49
|
+
end
|
50
|
+
|
51
|
+
desc "The Build failed, so tell our monitoring service"
|
52
|
+
task :failure do
|
53
|
+
FileUtils.cp '/home/deployer/monitor/statuses/Appstats.cc.failure', '/home/deployer/monitor/log/Appstats.cc', :preserve => false
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
data/lib/appstats/logger.rb
CHANGED
data/lib/appstats/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
|
2
2
|
# LOGGER CONFIGURATIONS (i.e. what is integrated within all of your apps)
|
3
|
-
Appstats::Logger.filename_template =
|
3
|
+
Appstats::Logger.filename_template = File.join(File.dirname(__FILE__), '..', '..', 'log','appstats') # usually left as-is
|
4
4
|
Appstats::Logger.default_contexts[:app_name] = "YOUR_APP_NAME_HERE" # replace me with your app name
|
data/spec/entry_spec.rb
CHANGED
@@ -193,18 +193,18 @@ module Appstats
|
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should understand an entry without contexts" do
|
196
|
-
entry = Entry.create_from_logger_string("0.16.
|
196
|
+
entry = Entry.create_from_logger_string("0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
197
197
|
Entry.count.should == @before_count + 1
|
198
198
|
entry.action.should == "address_search"
|
199
|
-
entry.raw_entry.should == "0.16.
|
199
|
+
entry.raw_entry.should == "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
200
200
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
201
201
|
end
|
202
202
|
|
203
203
|
it "should understand contexts" do
|
204
|
-
entry = Entry.create_from_logger_string("0.16.
|
204
|
+
entry = Entry.create_from_logger_string("0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
205
205
|
Entry.count.should == @before_count + 1
|
206
206
|
entry.action.should == "address_filter"
|
207
|
-
entry.raw_entry.should == "0.16.
|
207
|
+
entry.raw_entry.should == "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
208
208
|
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
|
209
209
|
entry.contexts.size.should == 2
|
210
210
|
entry.contexts[0].context_key = "app_name"
|
@@ -214,10 +214,10 @@ module Appstats
|
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should handle 'action' as a context" do
|
217
|
-
entry = Entry.create_from_logger_string('0.16.
|
217
|
+
entry = Entry.create_from_logger_string('0.16.7 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb')
|
218
218
|
Entry.count.should == @before_count + 1
|
219
219
|
entry.action.should == "page-view"
|
220
|
-
entry.raw_entry.should == "0.16.
|
220
|
+
entry.raw_entry.should == "0.16.7 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb"
|
221
221
|
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
|
222
222
|
entry.contexts.size.should == 2
|
223
223
|
entry.contexts[0].context_key = "action"
|
@@ -228,10 +228,10 @@ module Appstats
|
|
228
228
|
end
|
229
229
|
|
230
230
|
it "should handle multiple of the same 'context'" do
|
231
|
-
entry = Entry.create_from_logger_string('0.16.
|
231
|
+
entry = Entry.create_from_logger_string('0.16.7 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb')
|
232
232
|
Entry.count.should == @before_count + 1
|
233
233
|
entry.action.should == "page-view"
|
234
|
-
entry.raw_entry.should == "0.16.
|
234
|
+
entry.raw_entry.should == "0.16.7 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb"
|
235
235
|
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
|
236
236
|
entry.contexts.size.should == 2
|
237
237
|
entry.contexts[0].context_key = "app_name"
|
data/spec/logger_spec.rb
CHANGED
@@ -11,11 +11,7 @@ module Appstats
|
|
11
11
|
after(:each) do
|
12
12
|
File.delete(Appstats::Logger.filename) if File.exists?(Appstats::Logger.filename)
|
13
13
|
end
|
14
|
-
|
15
|
-
describe "#initialize" do
|
16
|
-
|
17
|
-
end
|
18
|
-
|
14
|
+
|
19
15
|
describe "#reset" do
|
20
16
|
|
21
17
|
it "should unset filename_template" do
|
@@ -107,20 +103,31 @@ module Appstats
|
|
107
103
|
|
108
104
|
describe "#entry" do
|
109
105
|
|
106
|
+
after(:each) do
|
107
|
+
FileUtils.rm_rf("./samplelog") if File.exists?('./samplelog')
|
108
|
+
end
|
109
|
+
|
110
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"]
|
114
114
|
end
|
115
115
|
|
116
|
+
it "should create the directory as required" do
|
117
|
+
Appstats::Logger.filename_template = "./samplelog/nested/appstats"
|
118
|
+
Appstats::Logger.entry("address_search")
|
119
|
+
File.exists?('./samplelog/nested').should == true
|
120
|
+
File.exists?('./samplelog/nested/appstats_2010-09-21.log').should == true
|
121
|
+
end
|
122
|
+
|
116
123
|
it "should accept numbers" do
|
117
124
|
Appstats::Logger.entry(5, :blah => 6)
|
118
|
-
Appstats::Logger.raw_read.should == ["0.16.
|
125
|
+
Appstats::Logger.raw_read.should == ["0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
|
119
126
|
end
|
120
127
|
|
121
128
|
it "should accept arrays" do
|
122
129
|
Appstats::Logger.entry('search', :provider => [ 'one', 'two' ])
|
123
|
-
Appstats::Logger.raw_read.should == ["0.16.
|
130
|
+
Appstats::Logger.raw_read.should == ["0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=search : provider=one : provider=two"]
|
124
131
|
end
|
125
132
|
|
126
133
|
|
@@ -130,7 +137,7 @@ module Appstats
|
|
130
137
|
|
131
138
|
it "should look similar to regular entry" do
|
132
139
|
Appstats::Logger.exception_entry(RuntimeError.new("blah"),:on => "login")
|
133
|
-
Appstats::Logger.raw_read.should == ["0.16.
|
140
|
+
Appstats::Logger.raw_read.should == ["0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
|
134
141
|
end
|
135
142
|
|
136
143
|
end
|
@@ -147,47 +154,47 @@ module Appstats
|
|
147
154
|
|
148
155
|
it "should handle a statistics entry" do
|
149
156
|
expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
|
150
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
157
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
|
151
158
|
actual.should == expected
|
152
159
|
end
|
153
160
|
|
154
161
|
it "should handle contexts" do
|
155
162
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
156
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
163
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
|
157
164
|
actual.should == expected
|
158
165
|
end
|
159
166
|
|
160
167
|
it "should handle multiple actions" do
|
161
168
|
expected = { :action => ["address_filter", "blah"], :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
162
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
169
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : action=blah : app_name=Market : server=Live")
|
163
170
|
actual.should == expected
|
164
171
|
end
|
165
172
|
|
166
173
|
it "should handle multiple of same context" do
|
167
174
|
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => ['Sin','Market'] }
|
168
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
175
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Sin : app_name=Market : server=Live")
|
169
176
|
actual.should == expected
|
170
177
|
end
|
171
178
|
|
172
179
|
it "should handle no actions" do
|
173
180
|
expected = { :action => "UNKNOWN_ACTION", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
|
174
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
181
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 app_name=Market : server=Live")
|
175
182
|
actual.should == expected
|
176
183
|
end
|
177
184
|
|
178
185
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
179
186
|
expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
|
180
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
187
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
|
181
188
|
actual.should == expected
|
182
189
|
|
183
190
|
expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
|
184
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
191
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
|
185
192
|
actual.should == expected
|
186
193
|
end
|
187
194
|
|
188
195
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
189
196
|
expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
|
190
|
-
actual = Appstats::Logger.entry_to_hash("0.16.
|
197
|
+
actual = Appstats::Logger.entry_to_hash("0.16.7 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
|
191
198
|
actual.should == expected
|
192
199
|
end
|
193
200
|
|
@@ -196,66 +203,66 @@ module Appstats
|
|
196
203
|
describe "#entry_to_s" do
|
197
204
|
|
198
205
|
it "should handle a statistics entry" do
|
199
|
-
expected = "0.16.
|
206
|
+
expected = "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
|
200
207
|
actual = Appstats::Logger.entry_to_s("address_search")
|
201
208
|
actual.should == expected
|
202
209
|
end
|
203
210
|
|
204
211
|
it "should handle numbers" do
|
205
|
-
expected = "0.16.
|
212
|
+
expected = "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
|
206
213
|
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
|
207
214
|
actual.should == expected
|
208
215
|
end
|
209
216
|
|
210
217
|
it "should handle default contexts" do
|
211
218
|
Appstats::Logger.default_contexts[:app_name] = "market"
|
212
|
-
expected = "0.16.
|
219
|
+
expected = "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
|
213
220
|
actual = Appstats::Logger.entry_to_s("address_search")
|
214
221
|
actual.should == expected
|
215
222
|
end
|
216
223
|
|
217
224
|
it "should handle contexts (and sort them by symbol)" do
|
218
|
-
expected = "0.16.
|
225
|
+
expected = "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
|
219
226
|
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
|
220
227
|
actual.should == expected
|
221
228
|
end
|
222
229
|
|
223
230
|
it "should handle actions with the delimiter (and change the delimiter)" do
|
224
|
-
expected = "0.16.
|
231
|
+
expected = "0.16.7 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
|
225
232
|
actual = Appstats::Logger.entry_to_s("address:=search-n")
|
226
233
|
actual.should == expected
|
227
234
|
|
228
|
-
expected = "0.16.
|
235
|
+
expected = "0.16.7 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
|
229
236
|
actual = Appstats::Logger.entry_to_s("address::search==--n")
|
230
237
|
actual.should == expected
|
231
238
|
end
|
232
239
|
|
233
240
|
it "should handle contexts with the delimiter (and change the delimiter)" do
|
234
|
-
expected = "0.16.
|
241
|
+
expected = "0.16.7 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
|
235
242
|
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
|
236
243
|
actual.should == expected
|
237
244
|
end
|
238
245
|
|
239
246
|
it "should ignore spaces" do
|
240
|
-
expected = "0.16.
|
247
|
+
expected = "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
|
241
248
|
actual = Appstats::Logger.entry_to_s("address search")
|
242
249
|
actual.should == expected
|
243
250
|
end
|
244
251
|
|
245
252
|
it "should convert newlines in action" do
|
246
|
-
expected = "0.16.
|
253
|
+
expected = "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
|
247
254
|
actual = Appstats::Logger.entry_to_s("address_\nsearch")
|
248
255
|
actual.should == expected
|
249
256
|
end
|
250
257
|
|
251
258
|
it "should convert newlines in context" do
|
252
|
-
expected = "0.16.
|
259
|
+
expected = "0.16.7 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
|
253
260
|
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
|
254
261
|
actual.should == expected
|
255
262
|
end
|
256
263
|
|
257
264
|
it "should convert newlines based on the delimiter" do
|
258
|
-
expected = "0.16.
|
265
|
+
expected = "0.16.7 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
|
259
266
|
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
|
260
267
|
actual.should == expected
|
261
268
|
end
|
data/spec/spec_helper.rb
CHANGED
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: 81
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 16
|
9
|
-
-
|
10
|
-
version: 0.16.
|
9
|
+
- 7
|
10
|
+
version: 0.16.7
|
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-03-
|
18
|
+
date: 2011-03-11 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -118,6 +118,20 @@ dependencies:
|
|
118
118
|
version: "0"
|
119
119
|
type: :development
|
120
120
|
version_requirements: *id007
|
121
|
+
- !ruby/object:Gem::Dependency
|
122
|
+
name: metric_fu
|
123
|
+
prerelease: false
|
124
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
version: "0"
|
133
|
+
type: :development
|
134
|
+
version_requirements: *id008
|
121
135
|
description: Provide usage statistics about how your application is being used
|
122
136
|
email:
|
123
137
|
- aforward@gmail.com
|
@@ -168,6 +182,7 @@ files:
|
|
168
182
|
- lib/appstats.rb
|
169
183
|
- lib/appstats/action.rb
|
170
184
|
- lib/appstats/acts_as_appstatsable.rb
|
185
|
+
- lib/appstats/ci.rake
|
171
186
|
- lib/appstats/code_injections.rb
|
172
187
|
- lib/appstats/context.rb
|
173
188
|
- lib/appstats/context_key.rb
|