appstats 0.0.15 → 0.0.16

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 CHANGED
@@ -3,6 +3,6 @@ pkg/*
3
3
  .bundle
4
4
  db/migrate
5
5
  doc
6
- config
7
6
  config/appstats.yml
7
+ config/initializers/appstats.rb
8
8
  log
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- appstats (0.0.15)
4
+ appstats (0.0.16)
5
5
  daemons
6
6
  net-scp
7
7
  rails (>= 2.3.0)
@@ -0,0 +1,18 @@
1
+ database:
2
+ adapter: mysql
3
+ database: mystatsdb_production
4
+ username: root
5
+ password:
6
+ host: localhost
7
+ encoding: utf8
8
+ remote_servers:
9
+ - :host: my.remoteserver.com
10
+ :user: deploy
11
+ :password: abc123
12
+ :path: /home/deploy/rails/myapp/current/log
13
+ :template: appstats
14
+ - :host: jobs.remoteserver.com
15
+ :user: deploy
16
+ :password: abc123
17
+ :path: /home/deploy/rails/myotherapp/current/log
18
+ :template: appstats
@@ -0,0 +1,6 @@
1
+ dir_mode: script
2
+ dir: ../../log
3
+ multiple: false
4
+ backtrace: true
5
+ monitor: false
6
+ ontop: false
@@ -0,0 +1,3 @@
1
+
2
+ Appstats::Logger.filename_template = "my_appstats"
3
+ Appstats::Logger.default_contexts[:app_name] = "YOUR_APP_NAME_HERE"
@@ -1,3 +1,3 @@
1
1
  module Appstats
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -143,18 +143,18 @@ module Appstats
143
143
  end
144
144
 
145
145
  it "should understand an entry without contexts" do
146
- entry = Entry.load_from_logger_entry("0.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
146
+ entry = Entry.load_from_logger_entry("0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
147
147
  Entry.count.should == @before_count + 1
148
148
  entry.action.should == "address_search"
149
- entry.raw_entry.should == "0.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
149
+ entry.raw_entry.should == "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
150
150
  entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
151
151
  end
152
152
 
153
153
  it "should understand contexts" do
154
- entry = Entry.load_from_logger_entry("0.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
154
+ entry = Entry.load_from_logger_entry("0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
155
155
  Entry.count.should == @before_count + 1
156
156
  entry.action.should == "address_filter"
157
- entry.raw_entry.should == "0.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
157
+ entry.raw_entry.should == "0.0.16 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
158
158
  entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
159
159
  entry.contexts.size.should == 2
160
160
  entry.contexts[0].context_key = "app_name"
@@ -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.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
130
+ actual = Appstats::Logger.entry_to_hash("0.0.16 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.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
136
+ actual = Appstats::Logger.entry_to_hash("0.0.16 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.15 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
142
+ actual = Appstats::Logger.entry_to_hash("0.0.16 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.15 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
146
+ actual = Appstats::Logger.entry_to_hash("0.0.16 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.15 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
152
+ actual = Appstats::Logger.entry_to_hash("0.0.16 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.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
161
+ expected = "0.0.16 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.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
167
+ expected = "0.0.16 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.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
174
+ expected = "0.0.16 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.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
180
+ expected = "0.0.16 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.0.15 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
186
+ expected = "0.0.16 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.0.15 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
190
+ expected = "0.0.16 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.0.15 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
196
+ expected = "0.0.16 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.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
202
+ expected = "0.0.16 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.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
208
+ expected = "0.0.16 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.0.15 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
214
+ expected = "0.0.16 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.0.15 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
220
+ expected = "0.0.16 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: 1
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 15
10
- version: 0.0.15
9
+ - 16
10
+ version: 0.0.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Forward
@@ -137,6 +137,9 @@ files:
137
137
  - Rakefile
138
138
  - appstats.gemspec
139
139
  - autotest/discover.rb
140
+ - config/appstats.yml.example
141
+ - config/daemons.yml
142
+ - config/initializers/appstats.rb.example
140
143
  - db/config.yml
141
144
  - db/migrations/20110105221941_create_appstats_entries.rb
142
145
  - db/migrations/20110203151136_create_appstats_contexts.rb