marginalia 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -9
- data/Gemfile +2 -0
- data/Rakefile +7 -8
- data/ext/mkrf_conf.rb +21 -0
- data/lib/marginalia/comment.rb +8 -0
- data/marginalia.gemspec +4 -3
- data/test/query_comments_test.rb +15 -3
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bda214f48d77afb13f9c9182a550272d4e654c4f
|
4
|
+
data.tar.gz: 5d199a1edd3a808254824a2bb45e22deca536e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7ee0ed6593d2a639c31787a559a86db0367b63ed79dde39966a4264904bbbd77d822e01be212ae40e7a573330281cb75489fc08e577c28e4d059712bcd2a86
|
7
|
+
data.tar.gz: 4963089d9d9609fd5dbdae17c36e6ed001cea24b81550febdf0826fc3fe13d574f34c8bb51a1ffc6b270e30ba68dd6c14b3d693cec8fcc6bfa4370d8fdee144a
|
data/.travis.yml
CHANGED
@@ -1,21 +1,18 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 2.1
|
5
|
-
- 2.2
|
6
4
|
- 2.3.1
|
5
|
+
- 2.4.4
|
6
|
+
- 2.5.1
|
7
7
|
|
8
8
|
sudo: false
|
9
9
|
|
10
10
|
script: bundle exec rake db:reset test:all
|
11
11
|
|
12
12
|
env:
|
13
|
-
- "RAILS_VERSION=3.1.12"
|
14
|
-
- "RAILS_VERSION=3.2.19"
|
15
|
-
- "RAILS_VERSION=4.0.8"
|
16
|
-
- "RAILS_VERSION=4.1.8"
|
17
13
|
- "RAILS_VERSION=4.2.0"
|
18
|
-
- "RAILS_VERSION=
|
19
|
-
- "RAILS_VERSION=
|
20
|
-
- "RAILS_VERSION=4.1.8 TEST_RAILS_API=true"
|
14
|
+
- "RAILS_VERSION=5.0.6"
|
15
|
+
- "RAILS_VERSION=5.1.5"
|
21
16
|
- "RAILS_VERSION=4.2.0 TEST_RAILS_API=true"
|
17
|
+
- "RAILS_VERSION=5.0.6 TEST_RAILS_API=true"
|
18
|
+
- "RAILS_VERSION=5.1.5 TEST_RAILS_API=true"
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -5,26 +5,26 @@ task :default => ['test:all']
|
|
5
5
|
|
6
6
|
namespace :test do
|
7
7
|
desc "test all drivers"
|
8
|
-
task :all => [:
|
8
|
+
task :all => [:mysql2, :postgresql, :sqlite]
|
9
9
|
|
10
10
|
desc "test mysql driver"
|
11
11
|
task :mysql do
|
12
|
-
sh "DRIVER=mysql ruby -Ilib -Itest test/*_test.rb"
|
12
|
+
sh "DRIVER=mysql bundle exec ruby -Ilib -Itest test/*_test.rb"
|
13
13
|
end
|
14
14
|
|
15
15
|
desc "test mysql2 driver"
|
16
16
|
task :mysql2 do
|
17
|
-
sh "DRIVER=mysql2 ruby -Ilib -Itest test/*_test.rb"
|
17
|
+
sh "DRIVER=mysql2 bundle exec ruby -Ilib -Itest test/*_test.rb"
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
desc "test PostgreSQL driver"
|
21
21
|
task :postgresql do
|
22
|
-
sh "DRIVER=postgresql DB_USERNAME=postgres ruby -Ilib -Itest test/*_test.rb"
|
22
|
+
sh "DRIVER=postgresql DB_USERNAME=postgres bundle exec ruby -Ilib -Itest test/*_test.rb"
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
desc "test sqlite3 driver"
|
26
26
|
task :sqlite do
|
27
|
-
sh "DRIVER=sqlite3 ruby -Ilib -Itest test/*_test.rb"
|
27
|
+
sh "DRIVER=sqlite3 bundle exec ruby -Ilib -Itest test/*_test.rb"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -62,5 +62,4 @@ namespace :db do
|
|
62
62
|
sh 'psql -d postgres -U postgres -c "DROP DATABASE IF EXISTS marginalia_test"'
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
66
65
|
end
|
data/ext/mkrf_conf.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/command.rb'
|
3
|
+
require 'rubygems/dependency_installer.rb'
|
4
|
+
|
5
|
+
begin
|
6
|
+
Gem::Command.build_args = ARGV
|
7
|
+
rescue NoMethodError
|
8
|
+
end
|
9
|
+
|
10
|
+
installer = Gem::DependencyInstaller.new
|
11
|
+
begin
|
12
|
+
if RUBY_VERSION < "2.4"
|
13
|
+
installer.install "mysql", ">=0"
|
14
|
+
end
|
15
|
+
rescue
|
16
|
+
exit(1)
|
17
|
+
end
|
18
|
+
|
19
|
+
f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
|
20
|
+
f.write("task :default\n")
|
21
|
+
f.close
|
data/lib/marginalia/comment.rb
CHANGED
@@ -26,9 +26,17 @@ module Marginalia
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
ret.chop!
|
29
|
+
ret = self.escape_sql_comment(ret)
|
29
30
|
ret
|
30
31
|
end
|
31
32
|
|
33
|
+
def self.escape_sql_comment(str)
|
34
|
+
while str.include?('/*') || str.include?('*/')
|
35
|
+
str = str.gsub('/*', '').gsub('*/', '')
|
36
|
+
end
|
37
|
+
str
|
38
|
+
end
|
39
|
+
|
32
40
|
def self.clear!
|
33
41
|
self.marginalia_controller = nil
|
34
42
|
end
|
data/marginalia.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.authors = ["Noah Lorang", "Nick Quaranto", "Taylor Weibley"]
|
3
|
-
gem.email = ["noah@37signals.com", "github
|
3
|
+
gem.email = ["noah@37signals.com", "arthurnn@github.com"]
|
4
4
|
gem.homepage = "https://github.com/basecamp/marginalia"
|
5
5
|
|
6
6
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -8,13 +8,12 @@ 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.
|
11
|
+
gem.version = "1.6.0"
|
12
12
|
gem.license = "MIT"
|
13
13
|
|
14
14
|
gem.add_runtime_dependency "actionpack", ">= 2.3"
|
15
15
|
gem.add_runtime_dependency "activerecord", ">= 2.3"
|
16
16
|
gem.add_development_dependency "rake"
|
17
|
-
gem.add_development_dependency "mysql"
|
18
17
|
gem.add_development_dependency "mysql2"
|
19
18
|
gem.add_development_dependency "pg"
|
20
19
|
gem.add_development_dependency "sqlite3"
|
@@ -22,4 +21,6 @@ Gem::Specification.new do |gem|
|
|
22
21
|
gem.add_development_dependency "mocha"
|
23
22
|
|
24
23
|
gem.summary = gem.description = %q{Attach comments to your ActiveRecord queries.}
|
24
|
+
|
25
|
+
gem.extensions = ["ext/mkrf_conf.rb"]
|
25
26
|
end
|
data/test/query_comments_test.rb
CHANGED
@@ -18,7 +18,7 @@ def adapter_pool_available?
|
|
18
18
|
end
|
19
19
|
|
20
20
|
require "minitest/autorun"
|
21
|
-
require
|
21
|
+
require "mocha/minitest"
|
22
22
|
require 'logger'
|
23
23
|
require 'pp'
|
24
24
|
require 'active_record'
|
@@ -64,7 +64,11 @@ end
|
|
64
64
|
class PostsController < ActionController::Base
|
65
65
|
def driver_only
|
66
66
|
ActiveRecord::Base.connection.execute "select id from posts"
|
67
|
-
|
67
|
+
if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new('5')
|
68
|
+
render body: nil
|
69
|
+
else
|
70
|
+
render nothing: true
|
71
|
+
end
|
68
72
|
end
|
69
73
|
end
|
70
74
|
|
@@ -101,7 +105,6 @@ end
|
|
101
105
|
|
102
106
|
Marginalia::Railtie.insert
|
103
107
|
|
104
|
-
|
105
108
|
class MarginaliaTest < MiniTest::Test
|
106
109
|
def setup
|
107
110
|
@queries = []
|
@@ -272,6 +275,15 @@ class MarginaliaTest < MiniTest::Test
|
|
272
275
|
end
|
273
276
|
end
|
274
277
|
|
278
|
+
def test_good_comment
|
279
|
+
assert_equal Marginalia::Comment.escape_sql_comment('app:foo'), 'app:foo'
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_bad_comments
|
283
|
+
assert_equal Marginalia::Comment.escape_sql_comment('*/; DROP TABLE USERS;/*'), '; DROP TABLE USERS;'
|
284
|
+
assert_equal Marginalia::Comment.escape_sql_comment('**//; DROP TABLE USERS;/*'), '; DROP TABLE USERS;'
|
285
|
+
end
|
286
|
+
|
275
287
|
def teardown
|
276
288
|
Marginalia.application_name = nil
|
277
289
|
Marginalia::Comment.lines_to_ignore = nil
|
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.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Lorang
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-09-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: actionpack
|
@@ -54,20 +54,6 @@ dependencies:
|
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: mysql
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '0'
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
57
|
- !ruby/object:Gem::Dependency
|
72
58
|
name: mysql2
|
73
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,9 +127,10 @@ dependencies:
|
|
141
127
|
description: Attach comments to your ActiveRecord queries.
|
142
128
|
email:
|
143
129
|
- noah@37signals.com
|
144
|
-
- github
|
130
|
+
- arthurnn@github.com
|
145
131
|
executables: []
|
146
|
-
extensions:
|
132
|
+
extensions:
|
133
|
+
- ext/mkrf_conf.rb
|
147
134
|
extra_rdoc_files: []
|
148
135
|
files:
|
149
136
|
- ".gitignore"
|
@@ -153,6 +140,7 @@ files:
|
|
153
140
|
- LICENSE
|
154
141
|
- README.md
|
155
142
|
- Rakefile
|
143
|
+
- ext/mkrf_conf.rb
|
156
144
|
- init.rb
|
157
145
|
- lib/marginalia.rb
|
158
146
|
- lib/marginalia/comment.rb
|
@@ -179,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
167
|
version: '0'
|
180
168
|
requirements: []
|
181
169
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
170
|
+
rubygems_version: 2.4.5.1
|
183
171
|
signing_key:
|
184
172
|
specification_version: 4
|
185
173
|
summary: Attach comments to your ActiveRecord queries.
|