if_ruby does not use the good ruby version
Hi,
I tried to use the last version of synvert and I have something which looks like an issue.
What I did:
$> rbenv version
2.1.6
$> gem install synvert
Fetching: synvert-core-0.9.0.gem (100%)
Fetching: synvert-0.9.0.gem (100%)
Successfully installed synvert-core-0.9.0
Successfully installed synvert-0.9.0
Parsing documentation for synvert-0.9.0
Parsing documentation for synvert-core-0.9.0
Installing ri documentation for synvert-0.9.0
Installing ri documentation for synvert-core-0.9.0
Done installing documentation for synvert, synvert-core after 0 seconds
2 gems installed
$> synvert --sync
Cloning into '/Users/work/.synvert'...
remote: Counting objects: 1120, done.
remote: Total 1120 (delta 0), reused 0 (delta 0), pack-reused 1120
Receiving objects: 100% (1120/1120), 187.29 KiB | 102.00 KiB/s, done.
Resolving deltas: 100% (777/777), done.
Checking connectivity... done.
synvert snippets are synced
When I try to run, for example, synvert -r ruby/new_hash_syntax which should replace old hashes by new ones, when ruby is greater than 1.9, nothing happen:
$> synvert -r ruby/new_hash_syntax arena_core
===== ruby/new_hash_syntax started =====
===== ruby/new_hash_syntax done =====
$> git status
## feature-#5950...github/feature-#5950
I tried to add some debug in the synvert gem and the ruby version seems to be set 2.2.0 instead of 1.9 when I run the snippet.
Then, I removed all the snippets except the new_hash_syntax from the .synvert folder. And now the good version of ruby is used, and the task is working.
My guess is: there is a bug in the new if_ruby DSL. It uses the ruby version set in the last snippet loaded instead of using the one from the snippet we want to run. Does that sound right?
Thanks
@kdisneur what ruby version do you mean here? https://github.com/xinminlabs/synvert-core/blob/master/lib/synvert/core/rewriter/ruby_version.rb#L19, RUBY_VERSION or @version
closed as it's outdated