lib/console_runner.rb in console_runner-0.1.9 vs lib/console_runner.rb in console_runner-0.1.10
- old
+ new
@@ -1,7 +1,7 @@
require 'file_parser'
-require 'trollop_configurator'
+require 'command_line_parser'
require 'runner'
require 'console_runner/version'
# console_runner logic is here
module ConsoleRunner
@@ -17,18 +17,16 @@
"Class and Instance methods have the same name (#{cmd}). Actions names should be unique"
)
end
action = actions.first
action ||= file_parser.run_method
- trol_config = TrollopConfigurator.new(file_parser)
- raise ConsoleRunnerError, "Cannot run! You haven't specify any method to run." unless action
- trol_config.parse_method action
+ trol_config = CommandLineParser.new(file_parser)
+ trol_config.run(action)
puts '======================================================='
puts 'Global options:'
- puts trol_config.global_opts.map { |k, v| " #{k} = #{v}" }.join("\n")
if file_parser.initialize_method
puts "INIT: #{file_parser.initialize_method.name}"
puts 'INIT options:'
puts trol_config.init_method.cmd_opts.map { |k, v| " #{k} = #{v}" }.join("\n")
end
@@ -60,14 +58,7 @@
else
raise ConsoleRunnerError, "Unknown method type: #{method_type}"
end
}
-
-
-# raise ConsoleRunnerError, "#{clazz.name}#initialize method should be specified" unless initialize_method
-#
-# raise ConsoleRunnerError, "At least one method should be marked with @#{FileParser::RUNNABLE_TAG.to_s} tag.
-# Also you may specify #run method and it will be executed by default.
-# #run method don't need any code annotations as well." if runnable_methods.count == 0 unless run_method
end
\ No newline at end of file