Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Migrating to ruby 1.9.2

  • Loading branch information...
commit 138ba9a5c62d75525611a110bf9ba9458f079f5b 1 parent 5594f31
@aforward authored
View
78 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- appstats (0.24.1)
+ appstats (0.25.0)
daemons
net-scp
rails (>= 3.2.1)
@@ -10,7 +10,6 @@ PATH
GEM
remote: http://rubygems.org/
specs:
- Saikuro (1.1.0)
ZenTest (4.6.2)
actionmailer (3.2.1)
actionpack (= 3.2.1)
@@ -40,74 +39,26 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.0)
- arrayfields (4.7.4)
autotest-fsevent (0.2.7)
sys-uname
builder (3.0.0)
- chronic (0.3.0)
- churn (0.0.15)
- arrayfields (= 4.7.4)
- chronic (>= 0.2.3)
- chronic (>= 0.2.3)
- fattr (= 2.2.0)
- hirb (= 0.5.0)
- hirb
- jeweler (= 1.6.4)
- json (= 1.6.1)
- json_pure
- main
- main (>= 4.6.0)
- map (= 4.3.0)
- ruby_parser (= 2.3.1)
- ruby_parser (~> 2.3)
- sexp_processor (= 3.0.7)
- sexp_processor (~> 3.0.3)
- colored (1.2)
daemons (1.1.6)
diff-lcs (1.1.3)
erubis (2.7.0)
- fattr (2.2.0)
ffi (1.0.11)
- flay (1.4.3)
- ruby_parser (~> 2.0)
- sexp_processor (~> 3.0)
- flog (2.5.3)
- ruby_parser (~> 2.0)
- sexp_processor (~> 3.0)
- git (1.2.5)
guard (1.0.0)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-rspec (0.6.0)
guard (>= 0.10.0)
hike (1.2.1)
- hirb (0.5.0)
i18n (0.6.0)
- jeweler (1.6.4)
- bundler (~> 1.0)
- git (>= 1.2.5)
- rake
journey (1.0.1)
- json (1.6.1)
- json_pure (1.6.5)
+ json (1.6.5)
mail (2.4.1)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- main (4.7.1)
- map (4.3.0)
- metric_fu (2.1.1)
- Saikuro (>= 1.1.0)
- activesupport (>= 2.0.0)
- chronic (~> 0.3.0)
- churn (>= 0.0.7)
- flay (>= 1.2.1)
- flog (>= 2.3.0)
- rails_best_practices (>= 0.6.4)
- rcov (>= 0.8.3.3)
- reek (>= 1.2.6)
- roodi (>= 2.1.0)
- syntax
mime-types (1.17.2)
multi_json (1.0.4)
mysql2 (0.3.11)
@@ -115,7 +66,6 @@ GEM
net-ssh (>= 1.99.1)
net-ssh (2.3.0)
polyglot (0.3.3)
- progressbar (0.9.2)
rack (1.4.1)
rack-cache (1.1)
rack (>= 0.4)
@@ -131,13 +81,6 @@ GEM
activesupport (= 3.2.1)
bundler (~> 1.0)
railties (= 3.2.1)
- rails_best_practices (1.7.2)
- activesupport
- colored
- erubis
- i18n
- progressbar
- sexp_processor
railties (3.2.1)
actionpack (= 3.2.1)
activesupport (= 3.2.1)
@@ -147,16 +90,9 @@ GEM
thor (~> 0.14.6)
rake (0.9.2.2)
rb-fsevent (0.9.0)
- rcov (1.0.0)
rdoc (3.12)
json (~> 1.4)
redis (2.2.2)
- reek (1.2.8)
- ruby2ruby (~> 1.2)
- ruby_parser (~> 2.0)
- sexp_processor (~> 3.0)
- roodi (2.1.0)
- ruby_parser
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
@@ -165,20 +101,13 @@ GEM
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
- ruby2ruby (1.3.1)
- ruby_parser (~> 2.0)
- sexp_processor (~> 3.0)
- ruby_parser (2.3.1)
- sexp_processor (~> 3.0)
- sexp_processor (3.0.7)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
- tilt (!= 1.3.0, ~> 1.1)
+ tilt (~> 1.1, != 1.3.0)
standalone_migrations (1.0.5)
activerecord (>= 3)
rake
- syntax (1.0.0)
sys-uname (0.9.0)
ffi (>= 1.0.0)
thor (0.14.6)
@@ -196,7 +125,6 @@ DEPENDENCIES
appstats!
autotest-fsevent
guard-rspec
- metric_fu
mysql2
rake
rb-fsevent
View
1  appstats.gemspec
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
s.add_development_dependency('ZenTest')
s.add_development_dependency('standalone_migrations')
s.add_development_dependency('mysql2')
- s.add_development_dependency('metric_fu')
s.add_development_dependency('guard-rspec')
s.add_development_dependency('autotest-fsevent') if RUBY_PLATFORM =~ /darwin/i
s.add_development_dependency('rb-fsevent') if RUBY_PLATFORM =~ /darwin/i
View
2  lib/appstats/version.rb
@@ -1,3 +1,3 @@
module Appstats
- VERSION = "0.24.1"
+ VERSION = "0.25.0"
end
View
92 spec/audit_spec.rb
@@ -94,49 +94,61 @@ class Audit
all[0].column_type.should == nil
all[0].obj_type.should == nil
- all[1].obj_attr.should == "blah_string"
- all[1].column_type.should == "varchar(255)"
- all[1].obj_type.should == "string"
-
- all[2].obj_attr.should == "blah_timestamp"
+ all[1].obj_attr.should == "id"
+ all[1].column_type.should == "int(11)"
+ all[1].obj_type.should == "integer"
+
+ all[2].obj_attr.should == "created_at"
all[2].column_type.should == "datetime"
all[2].obj_type.should == "datetime"
- all[3].obj_attr.should == "created_at"
+ all[3].obj_attr.should == "updated_at"
all[3].column_type.should == "datetime"
all[3].obj_type.should == "datetime"
+
+ all[4].obj_attr.should == "blah_binary"
+ all[4].column_type.should == "blob"
+ all[4].obj_type.should == "binary"
+
+ all[5].obj_attr.should == "blah_boolean"
+ all[5].column_type.should == "tinyint(1)"
+ all[5].obj_type.should == "boolean"
- all[4].obj_attr.should == "updated_at"
- all[4].column_type.should == "datetime"
- all[4].obj_type.should == "datetime"
-
- all[5].obj_attr.should == "blah_decimal"
- all[5].column_type.should == "decimal(10,0)"
- all[5].obj_type.should == "integer"
-
- all[6].obj_attr.should == "id"
- all[6].column_type.should == "int(11)"
- all[6].obj_type.should == "integer"
+ all[6].obj_attr.should == "blah_date"
+ all[6].column_type.should == "date"
+ all[6].obj_type.should == "date"
- all[7].obj_attr.should == "blah_boolean"
- all[7].column_type.should == "tinyint(1)"
- all[7].obj_type.should == "boolean"
+ all[7].obj_attr.should == "blah_datetime"
+ all[7].column_type.should == "datetime"
+ all[7].obj_type.should == "datetime"
+
+ all[8].obj_attr.should == "blah_decimal"
+ all[8].column_type.should == "decimal(10,0)"
+ all[8].obj_type.should == "integer"
- all[8].obj_attr.should == "blah_binary"
- all[8].column_type.should == "blob"
- all[8].obj_type.should == "binary"
+ all[9].obj_attr.should == "blah_float"
+ all[9].column_type.should == "float"
+ all[9].obj_type.should == "float"
- all[9].obj_attr.should == "blah_time"
- all[9].column_type.should == "time"
- all[9].obj_type.should == "time"
+ all[10].obj_attr.should == "blah_integer"
+ all[10].column_type.should == "int(11)"
+ all[10].obj_type.should == "integer"
- all[10].obj_attr.should == "blah_text"
- all[10].column_type.should == "text"
- all[10].obj_type.should == "text"
+ all[11].obj_attr.should == "blah_string"
+ all[11].column_type.should == "varchar(255)"
+ all[11].obj_type.should == "string"
+
+ all[12].obj_attr.should == "blah_text"
+ all[12].column_type.should == "text"
+ all[12].obj_type.should == "text"
+
+ all[13].obj_attr.should == "blah_time"
+ all[13].column_type.should == "time"
+ all[13].obj_type.should == "time"
- all[11].obj_attr.should == "blah_integer"
- all[11].column_type.should == "int(11)"
- all[11].obj_type.should == "integer"
+ all[14].obj_attr.should == "blah_timestamp"
+ all[14].column_type.should == "datetime"
+ all[14].obj_type.should == "datetime"
end
end
@@ -311,6 +323,7 @@ class Audit
Audit.count.should == 5
all = Audit.all
+
audit = all[0]
audit.table_name.should == "appstats_test_objects"
audit.obj_name.should == "Appstats::TestObject"
@@ -325,6 +338,17 @@ class Audit
audit = all[1]
audit.table_name.should == "appstats_test_objects"
audit.obj_name.should == "Appstats::TestObject"
+ audit.obj_attr.should == 'id'
+ audit.obj_id.should == t.id
+ audit.action.should == "created"
+ audit.old_value.should == nil
+ audit.new_value.should == "#{t.id}"
+ audit.old_value_full.should == nil
+ audit.new_value_full.should == "#{t.id}"
+
+ audit = all[2]
+ audit.table_name.should == "appstats_test_objects"
+ audit.obj_name.should == "Appstats::TestObject"
audit.obj_attr.should == 'name'
audit.obj_id.should == t.id
audit.action.should == "created"
@@ -333,7 +357,7 @@ class Audit
audit.old_value_full.should == nil
audit.new_value_full.should == 'a'
- audit = all[2]
+ audit = all[3]
audit.table_name.should == "appstats_test_objects"
audit.obj_name.should == "Appstats::TestObject"
audit.obj_attr.should == 'created_at'
@@ -344,7 +368,7 @@ class Audit
audit.old_value_full.should == nil
audit.new_value_full.should == t.created_at.strftime("%Y-%m-%d %H:%M:%S")
- audit = all[3]
+ audit = all[4]
audit.table_name.should == "appstats_test_objects"
audit.obj_name.should == "Appstats::TestObject"
audit.obj_attr.should == 'updated_at'
View
16 spec/entry_spec.rb
@@ -193,18 +193,18 @@ module Appstats
end
it "should understand an entry without contexts" do
- entry = Entry.create_from_logger_string("0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
+ entry = Entry.create_from_logger_string("0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
Entry.count.should == @before_count + 1
entry.action.should == "address_search"
- entry.raw_entry.should == "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
+ entry.raw_entry.should == "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
end
it "should understand contexts" do
- entry = Entry.create_from_logger_string("0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
+ entry = Entry.create_from_logger_string("0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
Entry.count.should == @before_count + 1
entry.action.should == "address_filter"
- entry.raw_entry.should == "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
+ entry.raw_entry.should == "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
entry.occurred_at.should == Time.parse("2010-09-21 23:15:20")
entry.contexts.size.should == 2
entry.contexts[0].context_key = "app_name"
@@ -214,10 +214,10 @@ module Appstats
end
it "should handle 'action' as a context" do
- entry = Entry.create_from_logger_string('0.24.1 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb')
+ entry = Entry.create_from_logger_string('0.25.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb')
Entry.count.should == @before_count + 1
entry.action.should == "page-view"
- entry.raw_entry.should == "0.24.1 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb"
+ entry.raw_entry.should == "0.25.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : action=save_ovcen : app_name=cdb"
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
entry.contexts.size.should == 2
entry.contexts[0].context_key = "action"
@@ -228,10 +228,10 @@ module Appstats
end
it "should handle multiple of the same 'context'" do
- entry = Entry.create_from_logger_string('0.24.1 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb')
+ entry = Entry.create_from_logger_string('0.25.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb')
Entry.count.should == @before_count + 1
entry.action.should == "page-view"
- entry.raw_entry.should == "0.24.1 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb"
+ entry.raw_entry.should == "0.25.0 setup[:,=,-n] 2011-02-24 12:59:57 action=page-view : app_name=market : app_name=cdb"
entry.occurred_at.should == Time.parse("2011-02-24 12:59:57")
entry.contexts.size.should == 2
entry.contexts[0].context_key = "app_name"
View
44 spec/logger_spec.rb
@@ -122,12 +122,12 @@ module Appstats
it "should accept numbers" do
Appstats::Logger.entry(5, :blah => 6)
- Appstats::Logger.raw_read.should == ["0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
+ Appstats::Logger.raw_read.should == ["0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=5 : blah=6"]
end
it "should accept arrays" do
Appstats::Logger.entry('search', :provider => [ 'one', 'two' ])
- Appstats::Logger.raw_read.should == ["0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=search : provider=one : provider=two"]
+ Appstats::Logger.raw_read.should == ["0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=search : provider=one : provider=two"]
end
@@ -137,7 +137,7 @@ module Appstats
it "should look similar to regular entry" do
Appstats::Logger.exception_entry(RuntimeError.new("blah"),:on => "login")
- Appstats::Logger.raw_read.should == ["0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
+ Appstats::Logger.raw_read.should == ["0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=appstats-exception : error=blah : on=login"]
end
end
@@ -154,47 +154,47 @@ module Appstats
it "should handle a statistics entry" do
expected = { :action => "address_search", :timestamp => "2010-09-21 23:15:20" }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search")
actual.should == expected
end
it "should handle contexts" do
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live")
actual.should == expected
end
it "should handle multiple actions" do
expected = { :action => ["address_filter", "blah"], :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : action=blah : app_name=Market : server=Live")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : action=blah : app_name=Market : server=Live")
actual.should == expected
end
it "should handle multiple of same context" do
expected = { :action => "address_filter", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => ['Sin','Market'] }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Sin : app_name=Market : server=Live")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Sin : app_name=Market : server=Live")
actual.should == expected
end
it "should handle no actions" do
expected = { :action => "UNKNOWN_ACTION", :timestamp => "2010-09-21 23:15:20", :server => "Live", :app_name => 'Market' }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 app_name=Market : server=Live")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 app_name=Market : server=Live")
actual.should == expected
end
it "should handle actions with the delimiter (and change the delimiter)" do
expected = { :action => "address:=search-n", :timestamp => "2010-09-21 23:15:20" }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n")
actual.should == expected
expected = { :action => "address::search==--n", :timestamp => "2010-09-21 23:15:20" }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n")
actual.should == expected
end
it "should handle contexts with the delimiter (and change the delimiter)" do
expected = { :action => "address", :timestamp => "2010-09-21 23:15:20", :server => "market:eval=-n" }
- actual = Appstats::Logger.entry_to_hash("0.24.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
+ actual = Appstats::Logger.entry_to_hash("0.25.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n")
actual.should == expected
end
@@ -203,66 +203,66 @@ module Appstats
describe "#entry_to_s" do
it "should handle a statistics entry" do
- expected = "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
+ expected = "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search"
actual = Appstats::Logger.entry_to_s("address_search")
actual.should == expected
end
it "should handle numbers" do
- expected = "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
+ expected = "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=1 : note=2.2"
actual = Appstats::Logger.entry_to_s(1,:note => 2.2)
actual.should == expected
end
it "should handle default contexts" do
Appstats::Logger.default_contexts[:app_name] = "market"
- expected = "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
+ expected = "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : app_name=market"
actual = Appstats::Logger.entry_to_s("address_search")
actual.should == expected
end
it "should handle contexts (and sort them by symbol)" do
- expected = "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
+ expected = "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_filter : app_name=Market : server=Live"
actual = Appstats::Logger.entry_to_s("address_filter", { :server => "Live", :app_name => 'Market' })
actual.should == expected
end
it "should handle actions with the delimiter (and change the delimiter)" do
- expected = "0.24.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
+ expected = "0.25.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=search-n"
actual = Appstats::Logger.entry_to_s("address:=search-n")
actual.should == expected
- expected = "0.24.1 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
+ expected = "0.25.0 setup[:::,===,---n] 2010-09-21 23:15:20 action===address::search==--n"
actual = Appstats::Logger.entry_to_s("address::search==--n")
actual.should == expected
end
it "should handle contexts with the delimiter (and change the delimiter)" do
- expected = "0.24.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
+ expected = "0.25.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address :: server==market:eval=-n"
actual = Appstats::Logger.entry_to_s("address", :server => 'market:eval=-n')
actual.should == expected
end
it "should ignore spaces" do
- expected = "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
+ expected = "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address search"
actual = Appstats::Logger.entry_to_s("address search")
actual.should == expected
end
it "should convert newlines in action" do
- expected = "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
+ expected = "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_-nsearch"
actual = Appstats::Logger.entry_to_s("address_\nsearch")
actual.should == expected
end
it "should convert newlines in context" do
- expected = "0.24.1 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
+ expected = "0.25.0 setup[:,=,-n] 2010-09-21 23:15:20 action=address_search : blah=some-nlong-nstatement"
actual = Appstats::Logger.entry_to_s("address_search",:blah => "some\nlong\nstatement")
actual.should == expected
end
it "should convert newlines based on the delimiter" do
- expected = "0.24.1 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
+ expected = "0.25.0 setup[::,==,--n] 2010-09-21 23:15:20 action==address:=--nsearch-n"
actual = Appstats::Logger.entry_to_s("address:=\nsearch-n")
actual.should == expected
end
Please sign in to comment.
Something went wrong with that request. Please try again.