synvert 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -0
- data/Rakefile +5 -0
- data/lib/synvert/node_ext.rb +4 -0
- data/lib/synvert/snippets/rails/upgrade_3_2_to_4_0.rb +8 -3
- data/lib/synvert/version.rb +1 -1
- data/spec/synvert/snippets/rails/upgrade_3_2_to_4_0_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47c3b4007ea038ef098234f243fda7f4c06c438d
|
4
|
+
data.tar.gz: 9d0dda20ef90c44233491bfb065bf4cfe6c56255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dcb64bb14b43046117ee51f63ecb233286c78669c226acc06e9ee937b0bd24cb63a710745123c00cc7060f910937f0b8f68bdfe128d79c18145a0c1bb4b978e
|
7
|
+
data.tar.gz: bfffd97409a6cd17c34688dfbec0c037836d8e7f0f71687549b3252cb16187bb7e862bf788f54efd6c6e42b6fe770ea15514f7bf35e4d287761dd80073e463e1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/synvert/node_ext.rb
CHANGED
@@ -139,6 +139,10 @@ private
|
|
139
139
|
actual.zip(expected).all? { |a, e| match_value?(instance, a, e) }
|
140
140
|
when NilClass
|
141
141
|
actual.nil?
|
142
|
+
when TrueClass
|
143
|
+
:true == actual.type
|
144
|
+
when FalseClass
|
145
|
+
:false == actual.type
|
142
146
|
when Parser::AST::Node
|
143
147
|
actual == expected
|
144
148
|
else
|
@@ -21,9 +21,12 @@ Synvert::Rewriter.new "upgrade_rails_3_2_to_4_0", "Upgrade rails from 3.2 to 4.0
|
|
21
21
|
end
|
22
22
|
|
23
23
|
within_file 'config/initializers/wrap_parameters.rb' do
|
24
|
-
# remove
|
24
|
+
# remove
|
25
|
+
# ActiveSupport.on_load(:active_record) do
|
26
|
+
# self.include_root_in_json = false
|
27
|
+
# end
|
25
28
|
with_node type: 'block', caller: {receiver: 'ActiveSupport', message: 'on_load', arguments: [':active_record']} do
|
26
|
-
if_only_exist_node
|
29
|
+
if_only_exist_node type: 'send', receiver: 'self', message: 'include_root_in_json=', arguments: [false] do
|
27
30
|
remove
|
28
31
|
end
|
29
32
|
end
|
@@ -105,7 +108,9 @@ Synvert::Rewriter.new "upgrade_rails_3_2_to_4_0", "Upgrade rails from 3.2 to 4.0
|
|
105
108
|
within_files 'app/models/**/*.rb' do
|
106
109
|
# scope :active, where(active: true) => scope :active, -> { where(active: true) }
|
107
110
|
with_node type: 'send', receiver: nil, message: 'scope' do
|
108
|
-
|
111
|
+
unless_exist_node type: 'block', caller: {type: 'send', message: 'lambda'} do
|
112
|
+
replace_with 'scope {{arguments.first}}, -> { {{arguments.last}} }'
|
113
|
+
end
|
109
114
|
end
|
110
115
|
end
|
111
116
|
|
data/lib/synvert/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|