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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b61c84cfe6968ed5efdacf7d2eecd4c3e5299e53
4
- data.tar.gz: a0893a9ba00e2266a9b00a598f02bac263931005
3
+ metadata.gz: 47c3b4007ea038ef098234f243fda7f4c06c438d
4
+ data.tar.gz: 9d0dda20ef90c44233491bfb065bf4cfe6c56255
5
5
  SHA512:
6
- metadata.gz: c7d1e4f23d7c5492d216f0034c839c0ef1420773f5c83ecebc802b826ca82eeedcea8a1c06031b24d959375c30038c0c290a56532d5d0e03d005c44d4f282f43
7
- data.tar.gz: f88a50587f6e0807ea8ea8ee5c5e80b066d0c85ebb51df4f13c06ab4b4c6e56338f6a25e6626096d2158ed05f21fdb4a9dcdddf75d60eb96b387c0e23354f194
6
+ metadata.gz: 2dcb64bb14b43046117ee51f63ecb233286c78669c226acc06e9ee937b0bd24cb63a710745123c00cc7060f910937f0b8f68bdfe128d79c18145a0c1bb4b978e
7
+ data.tar.gz: bfffd97409a6cd17c34688dfbec0c037836d8e7f0f71687549b3252cb16187bb7e862bf788f54efd6c6e42b6fe770ea15514f7bf35e4d287761dd80073e463e1
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.0.6
4
+
5
+ * Add -> {} only when not exist in rails upgrade snippet
6
+ * Add travis support
7
+
3
8
  ## 0.0.5
4
9
 
5
10
  * Add add_snippet dsl for reuse
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Synvert
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/xinminlabs/synvert.png)](http://travis-ci.org/xinminlabs/synvert)
4
+
3
5
  synvert = syntax + convert, makes it easy to rewrite ruby code
4
6
  automatically.
5
7
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -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 self.include_root_in_json = false
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 to_ast: Parser::CurrentRuby.parse('self.include_root_in_json = false') do
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
- replace_with 'scope {{arguments.first}}, -> { {{arguments.last}} }'
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
 
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module Synvert
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe 'Upgrade rails from 3.2 to 4.0' do
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.5
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-17 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser