Sha256: 302e019aebcad2083fd6e3ab472933836ed62df72f9893c18e05c98acf90b6e5
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
require 'thor/group' module Appjam module Generators ## # This class bootstrap +config/boot+ and perform +Appjam::Generators.load_components!+ for handle # 3rd party generators # class Cli < Thor::Group # Include related modules include Thor::Actions class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string # We need to TRY to load boot because some of our app dependencies maybe have # custom generators, so is necessary know who are. def load_boot begin ENV['BUNDLE_GEMFILE'] = File.join(options[:root], "Gemfile") if options[:root] rescue Exception => e puts "=> Problem loading #{boot}" puts ["=> #{e.message}", *e.backtrace].join("\n ") end end def setup Appjam::Generators.load_components! generator_kind = ARGV.delete_at(0).to_s.downcase.to_sym if ARGV[0].present? generator_class = Appjam::Generators.mappings[generator_kind] if generator_class args = ARGV.empty? && generator_class.require_arguments? ? ["-h"] : ARGV generator_class.start(args) else puts "Please specify generator to use (#{Appjam::Generators.mappings.keys.join(", ")})" end end end # Cli end # Generators end # Appjam
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
appjam-0.1.0.pre11 | lib/appjam/generators/cli.rb |
appjam-0.1.0.pre9 | lib/appjam/generators/cli.rb |