class Ramix::AppGenerator
Public Class Methods
class_options_help(shell, groups={})
click to toggle source
Overwrite class options help. Merge class options form rails
Calls superclass method
# File lib/ramix/app_generator.rb, line 29 def self.class_options_help(shell, groups={}) Rails::Generators::AppGenerator.class_options_help( Thor::Shell::Basic.new ) super(Thor::Shell::Basic.new, groups) #TODO - use color shell end
new(args, opts, config)
click to toggle source
Calls superclass method
# File lib/ramix/app_generator.rb, line 34 def initialize(args, opts, config) raise Thor::Error, "Application path should be given. For details run: ramix --help" if args[0].blank? super add_template_option opts, options # Invoke the rails application generator invoke Rails::Generators::AppGenerator end
Protected Instance Methods
add_template_option(opts, class_options)
click to toggle source
Add ‘-m’ #{template} in the ARGV
# File lib/ramix/app_generator.rb, line 56 def add_template_option(opts, class_options) insert_dependence_options(opts, class_options) opts << '-m' opts << build_template(opts, class_options) end
build_template(opts, class_options)
click to toggle source
According to the options and class_options to build template
# File lib/ramix/app_generator.rb, line 49 def build_template(opts, class_options) Ramix::Builder.new do class_options.each { |name, args| import @@templates[name], args unless @@templates[name].nil? or class_options["skip_#{name}".to_sym] } end.run end
insert_dependence_options(opts, class_options)
click to toggle source
if the template recipe has some dependence options then add these into the opts.
# File lib/ramix/app_generator.rb, line 63 def insert_dependence_options(opts, class_options) class_options.each do |name, args| next if @@templates[name].nil? or @@templates[name].dependence.nil? @@templates[name].dependence.each{ |d| opts << d } end end