Class: RailsWizard::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/rails_wizard/command.rb

Instance Method Summary collapse

Instance Method Details

#list(category = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rails_wizard/command.rb', line 26

def list(category = nil)
  if category
    recipes = RailsWizard::Recipes.for(category).map{|r| RailsWizard::Recipe.from_mongo(r) }
  else
    recipes = RailsWizard::Recipes.list_classes
  end

  recipes.each do |recipe|
    puts recipe.key.ljust(15) + "# #{recipe.description}"
  end
end

#new(name) ⇒ Object



10
11
12
13
14
# File 'lib/rails_wizard/command.rb', line 10

def new(name)
  recipes, defaults = load_defaults
  recipes = ask_for_recipes(recipes)
  run_template(name, recipes, defaults, nil)
end

#template(template_name) ⇒ Object



19
20
21
22
23
# File 'lib/rails_wizard/command.rb', line 19

def template(template_name)
  recipes, defaults = load_defaults
  recipes = ask_for_recipes(recipes)
  run_template(nil, recipes, defaults, template_name)
end