lib/synvert/cli.rb in synvert-1.4.5 vs lib/synvert/cli.rb in synvert-1.4.6
- old
+ new
@@ -40,15 +40,18 @@
when 'sync'
sync_snippets
when 'generate'
generate_snippet
when 'execute'
+ read_helpers
execute_snippet(@options[:execute_command])
when 'test'
+ read_helpers
rewriter = Synvert::Core::Utils.eval_snippet(@options[:snippet_name])
test_snippet(rewriter)
when 'run'
+ read_helpers
rewriter = Synvert::Core::Utils.eval_snippet(@options[:snippet_name])
run_snippet(rewriter)
else
# nothing to do
end
@@ -151,9 +154,14 @@
end
# read all rewriters.
def read_rewriters
Dir.glob(File.join(default_snippets_home, 'lib/**/*.rb')).each { |file| require file }
+ end
+
+ # read all helpers.
+ def read_helpers
+ Dir.glob(File.join(default_snippets_home, 'lib/helpers/**/*.rb')).each { |file| require file }
end
# List and print all available rewriters.
def list_available_rewriters
if Core::Rewriter.availables.empty?