lib/synvert/cli.rb in synvert-0.14.1 vs lib/synvert/cli.rb in synvert-0.15.0

- old
+ new

@@ -216,11 +216,12 @@ def sync_snippets Snippet.new(default_snippets_home).sync puts 'synvert snippets are synced' core_version = Snippet.fetch_core_version if Gem::Version.new(core_version) > Gem::Version.new(Synvert::Core::VERSION) - puts "synvert-core is updated, please install synvert-core #{core_version}" + puts "synvert-core is updated, installing synvert-core #{core_version}" + system('gem install synvert-core') end end # run snippets def run_snippet @@ -236,11 +237,11 @@ puts "===== #{snippet_name} done =====" elsif json_output? group, name = snippet_name.split('/') rewriter = Core::Rewriter.call group, name output = { - affected_files: rewriter.affected_files.union(rewriter.sub_snippets.map(&:affected_files).reduce([], :+)).to_a, - warnings: rewriter.warnings.union(rewriter.sub_snippets.map(&:warnings).reduce([], :+)), + affected_files: rewriter.affected_files.union(rewriter.sub_snippets.sum([], &:affected_files)).to_a, + warnings: rewriter.warnings.union(rewriter.sub_snippets.sum([], &:warnings)), todo: rewriter.todo } puts JSON.generate(output) end end