Class: Candle::Generators::Cli
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Candle::Generators::Cli
- Includes:
- CLIColorize, Thor::Actions
- Defined in:
- lib/candle/generators/cli.rb
Overview
This class bootstrap config/boot
and perform Candle::Generators.load_components!
for handle 3rd party generators
Constant Summary collapse
- RENDER_OPTIONS =
{ :fields => [:category,:command,:description] }
Instance Method Summary collapse
-
#load_boot ⇒ Object
We need to TRY to load boot because some of our app dependencies maybe have custom generators, so is necessary know who are.
- #setup ⇒ Object
Instance Method Details
#load_boot ⇒ Object
We need to TRY to load boot because some of our app dependencies maybe have custom generators, so is necessary know who are.
25 26 27 28 29 30 31 32 |
# File 'lib/candle/generators/cli.rb', line 25 def load_boot begin ENV['BUNDLE_GEMFILE'] = File.join([:root], "Gemfile") if [:root] rescue Exception => e puts "=> Problem loading #{boot}" puts ["=> #{e.}", *e.backtrace].join("\n ") end end |
#setup ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/candle/generators/cli.rb', line 34 def setup Candle::Generators.load_components! generator_kind = ARGV.delete_at(0).to_s.downcase.to_sym if ARGV[0].present? generator_class = Candle::Generators.mappings[generator_kind] if generator_class args = ARGV.empty? && generator_class.require_arguments? ? ["-h"] : ARGV generator_class.start(args) else puts colorize( "Candle Version: #{Candle::Version::STRING}", { :foreground => :red, :background => :white, :config => :underline } ) puts puts "Candle is a rubygem for wax iOS framework which writes iOS application in lua, it contains xcode 4 template generators." puts puts colorize("For more information") puts puts "puer help" puts end end |