Class: Rubigen::CLI
Instance Attribute Summary collapse
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
5 6 7 |
# File 'lib/rubigen/cli.rb', line 5 def stdout @stdout end |
Class Method Details
.execute(stdout, arguments, runtime_arguments = {}) ⇒ Object
7 8 9 |
# File 'lib/rubigen/cli.rb', line 7 def self.execute(stdout, arguments, runtime_arguments = {}) self.new.execute(stdout, arguments, runtime_arguments) end |
Instance Method Details
#execute(stdout, arguments, runtime_arguments = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rubigen/cli.rb', line 11 def execute(stdout, arguments, runtime_arguments = {}) @stdout = stdout main_usage and return unless scope = arguments.shift scopes = scope.split(",").map(&:to_sym) runtime_arguments.merge!(:stdout => stdout, :no_exit => true) RubiGen::Base.logger = RubiGen::SimpleLogger.new(stdout) require 'rubigen/scripts/generate' RubiGen::Base.use_component_sources!(scopes) RubiGen::Scripts::Generate.new.run(arguments, runtime_arguments) end |
#main_usage ⇒ Object
24 25 26 27 28 29 |
# File 'lib/rubigen/cli.rb', line 24 def main_usage stdout.puts <<-USAGE.gsub(/^ /, '') Usage: $0 scope generator [options for generator] USAGE true end |