Thor::Group
Responsible for generating new Padrino projects based on the specified project components.
Bundle all required components using bundler and Gemfile
@api private
# File lib/padrino-gen/generators/project.rb, line 85 def bundle_dependencies if options[:bundle] run_bundler end end
Finish message
@api private
# File lib/padrino-gen/generators/project.rb, line 94 def finish_message say say "="*65, :green say "#{name} is ready for development!", :green say "="*65, :green say "$ cd #{options[:root]}/#{name}" say "$ bundle install" unless options[:bundle] say "="*65, :green say end
For each component, retrieve a valid choice and then execute the associated generator
@api private
# File lib/padrino-gen/generators/project.rb, line 72 def setup_components return if options[:template] @_components = options.dup.slice(*self.class.component_types) self.class.component_types.each do |comp| choice = @_components[comp] = resolve_valid_choice(comp) execute_component_setup(comp, choice) end store_component_config('.components') end
Copies over the Padrino base application App
@api private
# File lib/padrino-gen/generators/project.rb, line 51 def setup_project valid_constant?(options[:app] || name) @app_name = (options[:app] || name).gsub(/\W/, "_").underscore.camelize self.destination_root = File.join(options[:root], name) if options[:template] # Run the template to create project execute_runner(:template, options[:template]) else # generate project without template directory("project/", destination_root) empty_directory destination_root("public/images") empty_directory destination_root("public/javascripts") empty_directory destination_root("public/stylesheets") empty_directory destination_root("tmp") store_component_config('.components') app_skeleton('app', options[:tiny]) template "templates/Gemfile.tt", destination_root("Gemfile") end end
Generated with the Darkfish Rdoc Generator 2.