spring_onion 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/lib/spring_onion.rb +1 -0
- data/lib/spring_onion/config.rb +5 -1
- data/lib/spring_onion/explainer.rb +11 -2
- data/lib/spring_onion/version.rb +1 -1
- data/spring_onion.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce732c781280bd7df0bce88ccc8654d20efcf0d526fadeaa5ebcd263de43102d
|
4
|
+
data.tar.gz: 4d7b643b28a2afd962df5882bdef1d38ba4c12d00dc90ab8ce960d3b3f1f3e37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea8d9b77ed18bd515b75bde75237cc3ab0384c7f9ea64ea3258cb73d66f22589e9320df6e557ac11a8496f8ec2d86a3fef15153c3a9b5eff789a08544be5b6e8
|
7
|
+
data.tar.gz: 75b6de58da35b12b310d30353203f679e930f79faca793c9ee7ec2007dd2d0db057a1cb2f80bbdb66f16a2621048bf15b5167a3a8693cfc2197abea1359c6f6c
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
spring_onion (0.1.
|
4
|
+
spring_onion (0.1.3)
|
5
5
|
activerecord
|
6
|
+
coderay
|
6
7
|
mysql2
|
7
8
|
|
8
9
|
GEM
|
@@ -24,6 +25,7 @@ GEM
|
|
24
25
|
rake
|
25
26
|
thor (>= 0.14.0)
|
26
27
|
ast (2.4.1)
|
28
|
+
coderay (1.1.3)
|
27
29
|
concurrent-ruby (1.1.6)
|
28
30
|
diff-lcs (1.4.4)
|
29
31
|
i18n (1.8.3)
|
data/lib/spring_onion.rb
CHANGED
data/lib/spring_onion/config.rb
CHANGED
@@ -67,6 +67,8 @@ module SpringOnion
|
|
67
67
|
end
|
68
68
|
|
69
69
|
@trace_len = 3
|
70
|
+
@json_pretty = (/\A(1|true)\z/i =~ ENV['SPRING_ONION_JSON_PRETTY'])
|
71
|
+
@color = /\A(1|true)\z/i =~ ENV.fetch('SPRING_ONION_COLOR', $stdout.tty?.to_s)
|
70
72
|
|
71
73
|
class << self
|
72
74
|
attr_accessor :enabled,
|
@@ -75,6 +77,8 @@ module SpringOnion
|
|
75
77
|
:sql_filter_re, :ignore_sql_filter_re, :sql_filter,
|
76
78
|
:source_filter_re, :ignore_source_filter_re, :source_filter,
|
77
79
|
:logger,
|
78
|
-
:trace_len
|
80
|
+
:trace_len,
|
81
|
+
:json_pretty,
|
82
|
+
:color
|
79
83
|
end
|
80
84
|
end
|
@@ -43,12 +43,21 @@ module SpringOnion
|
|
43
43
|
|
44
44
|
return if violation_names_by_line.empty?
|
45
45
|
|
46
|
-
|
46
|
+
h = {
|
47
47
|
sql: sql,
|
48
48
|
explain: exp.each_with_index.map { |r, i| { line: i + 1 }.merge(r) },
|
49
49
|
violations: violation_names_by_line,
|
50
50
|
backtrace: trace.slice(0, SpringOnion.trace_len),
|
51
|
-
}
|
51
|
+
}
|
52
|
+
|
53
|
+
line = if SpringOnion.json_pretty
|
54
|
+
JSON.pretty_generate(h)
|
55
|
+
else
|
56
|
+
JSON.dump(h)
|
57
|
+
end
|
58
|
+
|
59
|
+
line = CodeRay.scan(line, :json).terminal if SpringOnion.color
|
60
|
+
SpringOnion.logger.info(line)
|
52
61
|
end
|
53
62
|
end
|
54
63
|
end
|
data/lib/spring_onion/version.rb
CHANGED
data/spring_onion.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
26
|
spec.add_dependency 'activerecord'
|
27
|
+
spec.add_dependency 'coderay'
|
27
28
|
spec.add_dependency 'mysql2'
|
28
29
|
spec.add_development_dependency 'appraisal'
|
29
30
|
spec.add_development_dependency 'bundler'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spring_onion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- winebarrel
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coderay
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: mysql2
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|