synvert-hq / synvert-ruby

write snippet code to rewrite your project code
https://synvert.net
MIT License
691 stars 19 forks source link

Do we really need to require the bundler? #107

Open bibendi opened 4 months ago

bibendi commented 4 months ago

Hi! Do we really need to require the bundler here? https://github.com/synvert-hq/synvert-ruby/blob/03e942d543b2fd8c9f7863f11ac4e675c97254fc/lib/synvert.rb#L4 It is not in the gemspec list, actually.

We want to get the list of snippets by running synvert-ruby --list --format json and get the following output

Resolving dependencies...
[{"group":"rails-template","name":"prepare", blablabla

which breaks JSON.parse

Even if we run synvert-ruby -v we get

Resolving dependencies...
1.10.3 (with synvert-core 2.0.1)
flyerhzm commented 4 months ago

@bibendi I don't need to require the bundler here, yes, I will remove it.

But I do need bundler to parse gem versions in synvert-core-ruby https://github.com/synvert-hq/synvert-core-ruby/blob/main/lib/synvert/core/rewriter/gem_spec.rb#L35, so even I remove the line here, it may still get "Resolving dependencies..." in output when analyzing code.

I think it's a bug in the bunlder.

mehanoid commented 4 months ago

But I do need bundler to parse gem versions in synvert-core-ruby

But it is only used in tests? It shouldn't affect the running of synvert itself, should it?

flyerhzm commented 4 months ago

@mehanoid no, it's not for test, synvert has a dsl if_gem, it will check if the current gem version matches, and I use bundler gem to read Gemfile.lock to get current gem versions.