Class: Playmo::Recipe
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Playmo::Recipe
- Defined in:
- lib/playmo/recipe.rb
Overview
Base class for all recipes
Direct Known Subclasses
Generators::Recipes::SampleRecipe, Playmo::Recipes::ApplicationControllerRecipe, Playmo::Recipes::ApplicationHelperRecipe, Playmo::Recipes::AssetsRecipe, Playmo::Recipes::CapistranoRecipe, Playmo::Recipes::CompassRecipe, Playmo::Recipes::CongratsRecipe, Playmo::Recipes::DeviseRecipe, Playmo::Recipes::FormsRecipe, Playmo::Recipes::GitRecipe, Playmo::Recipes::HomeControllerRecipe, Playmo::Recipes::JavascriptFrameworkRecipe, Playmo::Recipes::LayoutRecipe, Playmo::Recipes::MarkupRecipe, Playmo::Recipes::RspecRecipe, Playmo::Recipes::RvmRecipe, Playmo::Recipes::SetupDatabaseRecipe
Instance Attribute Summary collapse
-
#application_name ⇒ Object
Returns the value of attribute application_name.
-
#question_instance ⇒ Object
Returns the value of attribute question_instance.
-
#silents ⇒ Object
Returns the value of attribute silents.
Instance Method Summary collapse
-
#cook!(application_name) ⇒ Object
Приготовление рецепта.
- #question(arg, &block) ⇒ Object
- #retrieve(*args) ⇒ Object
- #silently(&block) ⇒ Object
- #store(*args) ⇒ Object
Instance Attribute Details
#application_name ⇒ Object
Returns the value of attribute application_name.
6 7 8 |
# File 'lib/playmo/recipe.rb', line 6 def application_name @application_name end |
#question_instance ⇒ Object
Returns the value of attribute question_instance.
6 7 8 |
# File 'lib/playmo/recipe.rb', line 6 def question_instance @question_instance end |
#silents ⇒ Object
Returns the value of attribute silents.
6 7 8 |
# File 'lib/playmo/recipe.rb', line 6 def silents @silents end |
Instance Method Details
#cook!(application_name) ⇒ Object
Приготовление рецепта
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/playmo/recipe.rb', line 9 def cook!(application_name) self.destination_root = application_name self.application_name = application_name setup unless question_instance.nil? question_instance.set_caller(self) # Ask question question_instance.ask_question! # Ask for choice and make choice question_instance.choice.make_choice! end # Execute all silents unless silents.nil? silents.each do |silent| silent.set_caller(self) silent.execute! end end end |
#question(arg, &block) ⇒ Object
33 34 35 |
# File 'lib/playmo/recipe.rb', line 33 def question(arg, &block) @question_instance = Playmo::Question.new(arg, &block) end |
#retrieve(*args) ⇒ Object
46 47 48 |
# File 'lib/playmo/recipe.rb', line 46 def retrieve(*args) Options.instance.get(*args) end |
#silently(&block) ⇒ Object
37 38 39 40 |
# File 'lib/playmo/recipe.rb', line 37 def silently(&block) @silents ||= [] @silents << Playmo::Silent.new(&block) end |
#store(*args) ⇒ Object
42 43 44 |
# File 'lib/playmo/recipe.rb', line 42 def store(*args) Options.instance.set(*args) end |