marginalia 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of marginalia might be problematic. Click here for more details.
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/Gemfile.lock +2 -0
- data/README.md +2 -2
- data/Rakefile +36 -9
- data/lib/marginalia/railtie.rb +6 -0
- data/lib/marginalia.rb +4 -2
- data/marginalia.gemspec +2 -1
- data/test/query_comments_test.rb +1 -1
- metadata +25 -14
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# marginalia
|
1
|
+
# marginalia [![Build Status](https://secure.travis-ci.org/37signals/marginalia.png?branch=master)](http://travis-ci.org/37signals/marginalia)
|
2
2
|
|
3
3
|
Attach comments to your ActiveRecord queries. By default, it adds the application, controller, and action names as a
|
4
4
|
comment at the end of each query.
|
@@ -19,7 +19,7 @@ This gem was created at 37signals. You can read more about how we use it [on
|
|
19
19
|
our blog](http://37signals.com/svn/posts/3130-tech-note-mysql-query-comments-in-rails).
|
20
20
|
|
21
21
|
This has been tested and used in production with both the mysql and mysql2 gems,
|
22
|
-
tested on Rails 2.3.5 through 3.2-stable. It has also been
|
22
|
+
tested on Rails 2.3.5 through 3.2-stable. It has also been tested for sqlite3 and postgres.
|
23
23
|
|
24
24
|
Patches are welcome for other database adapters.
|
25
25
|
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ task :default => ['test:all']
|
|
5
5
|
|
6
6
|
namespace :test do
|
7
7
|
desc "test all drivers"
|
8
|
-
task :all => [:mysql, :mysql2, :sqlite]
|
8
|
+
task :all => [:mysql, :mysql2, :postgresql, :sqlite]
|
9
9
|
|
10
10
|
desc "test mysql driver"
|
11
11
|
task :mysql do
|
@@ -17,6 +17,11 @@ namespace :test do
|
|
17
17
|
sh "DRIVER=mysql2 ruby -Ilib -Itest test/*_test.rb"
|
18
18
|
end
|
19
19
|
|
20
|
+
desc "test PostgreSQL driver"
|
21
|
+
task :postgresql do
|
22
|
+
sh "DRIVER=postgresql DB_USERNAME=postgres ruby -Ilib -Itest test/*_test.rb"
|
23
|
+
end
|
24
|
+
|
20
25
|
desc "test sqlite3 driver"
|
21
26
|
task :sqlite do
|
22
27
|
sh "DRIVER=sqlite3 ruby -Ilib -Itest test/*_test.rb"
|
@@ -24,16 +29,38 @@ namespace :test do
|
|
24
29
|
end
|
25
30
|
|
26
31
|
namespace :db do
|
27
|
-
desc "reset database"
|
28
|
-
task :reset => [:drop, :create]
|
29
32
|
|
30
|
-
desc "
|
31
|
-
task :
|
32
|
-
|
33
|
+
desc "reset all databases"
|
34
|
+
task :reset => [:"mysql:reset", :"postgresql:reset"]
|
35
|
+
|
36
|
+
namespace :mysql do
|
37
|
+
desc "reset MySQL database"
|
38
|
+
task :reset => [:drop, :create]
|
39
|
+
|
40
|
+
desc "create MySQL database"
|
41
|
+
task :create do
|
42
|
+
sh 'mysql -u root -e "create database marginalia_test;"'
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "drop MySQL database"
|
46
|
+
task :drop do
|
47
|
+
sh 'mysql -u root -e "drop database if exists marginalia_test;"'
|
48
|
+
end
|
33
49
|
end
|
34
50
|
|
35
|
-
|
36
|
-
|
37
|
-
|
51
|
+
namespace :postgresql do
|
52
|
+
desc "reset PostgreSQL database"
|
53
|
+
task :reset => [:drop, :create]
|
54
|
+
|
55
|
+
desc "create PostgreSQL database"
|
56
|
+
task :create do
|
57
|
+
sh 'createdb -U postgres marginalia_test'
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "drop PostgreSQL database"
|
61
|
+
task :drop do
|
62
|
+
sh 'psql -d postgres -U postgres -c "DROP DATABASE IF EXISTS marginalia_test"'
|
63
|
+
end
|
38
64
|
end
|
65
|
+
|
39
66
|
end
|
data/lib/marginalia/railtie.rb
CHANGED
@@ -48,6 +48,12 @@ module Marginalia
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
52
|
+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.module_eval do
|
53
|
+
include Marginalia::ActiveRecordInstrumentation
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
51
57
|
if defined? ActiveRecord::ConnectionAdapters::SQLiteAdapter
|
52
58
|
ActiveRecord::ConnectionAdapters::SQLiteAdapter.module_eval do
|
53
59
|
include Marginalia::ActiveRecordInstrumentation
|
data/lib/marginalia.rb
CHANGED
@@ -9,8 +9,10 @@ module Marginalia
|
|
9
9
|
Marginalia.application_name = Rails.application.class.name.split("::").first
|
10
10
|
end
|
11
11
|
instrumented_class.class_eval do
|
12
|
-
|
13
|
-
|
12
|
+
if defined? :execute
|
13
|
+
alias_method :execute_without_marginalia, :execute
|
14
|
+
alias_method :execute, :execute_with_marginalia
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
data/marginalia.gemspec
CHANGED
@@ -8,13 +8,14 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.test_files = `git ls-files -- {test}/*`.split("\n")
|
9
9
|
gem.name = "marginalia"
|
10
10
|
gem.require_paths = ["lib"]
|
11
|
-
gem.version = "1.0.
|
11
|
+
gem.version = "1.0.3"
|
12
12
|
|
13
13
|
gem.add_runtime_dependency "actionpack", ">= 2.3", "< 3.3"
|
14
14
|
gem.add_runtime_dependency "activerecord", ">= 2.3", "< 3.3"
|
15
15
|
gem.add_development_dependency "rake"
|
16
16
|
gem.add_development_dependency "mysql"
|
17
17
|
gem.add_development_dependency "mysql2"
|
18
|
+
gem.add_development_dependency "pg"
|
18
19
|
gem.add_development_dependency "sqlite3"
|
19
20
|
|
20
21
|
gem.summary = description = %q{Attach comments to your ActiveRecord queries.}
|
data/test/query_comments_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marginalia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-04-
|
14
|
+
date: 2012-04-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: actionpack
|
18
|
-
requirement: &
|
18
|
+
requirement: &14527580 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -26,10 +26,10 @@ dependencies:
|
|
26
26
|
version: '3.3'
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
|
-
version_requirements: *
|
29
|
+
version_requirements: *14527580
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: activerecord
|
32
|
-
requirement: &
|
32
|
+
requirement: &14526420 !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
@@ -40,10 +40,10 @@ dependencies:
|
|
40
40
|
version: '3.3'
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
|
-
version_requirements: *
|
43
|
+
version_requirements: *14526420
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: rake
|
46
|
-
requirement: &
|
46
|
+
requirement: &14525140 !ruby/object:Gem::Requirement
|
47
47
|
none: false
|
48
48
|
requirements:
|
49
49
|
- - ! '>='
|
@@ -51,10 +51,10 @@ dependencies:
|
|
51
51
|
version: '0'
|
52
52
|
type: :development
|
53
53
|
prerelease: false
|
54
|
-
version_requirements: *
|
54
|
+
version_requirements: *14525140
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mysql
|
57
|
-
requirement: &
|
57
|
+
requirement: &14514160 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
@@ -62,10 +62,10 @@ dependencies:
|
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
|
-
version_requirements: *
|
65
|
+
version_requirements: *14514160
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: mysql2
|
68
|
-
requirement: &
|
68
|
+
requirement: &14513460 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
71
71
|
- - ! '>='
|
@@ -73,10 +73,21 @@ dependencies:
|
|
73
73
|
version: '0'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
|
-
version_requirements: *
|
76
|
+
version_requirements: *14513460
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: pg
|
79
|
+
requirement: &14512660 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
type: :development
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: *14512660
|
77
88
|
- !ruby/object:Gem::Dependency
|
78
89
|
name: sqlite3
|
79
|
-
requirement: &
|
90
|
+
requirement: &14511580 !ruby/object:Gem::Requirement
|
80
91
|
none: false
|
81
92
|
requirements:
|
82
93
|
- - ! '>='
|
@@ -84,7 +95,7 @@ dependencies:
|
|
84
95
|
version: '0'
|
85
96
|
type: :development
|
86
97
|
prerelease: false
|
87
|
-
version_requirements: *
|
98
|
+
version_requirements: *14511580
|
88
99
|
description:
|
89
100
|
email:
|
90
101
|
- noah@37signals.com
|