Class: Decko::Generators::Deck::DeckGenerator::Interactive
- Inherits:
-
Object
- Object
- Decko::Generators::Deck::DeckGenerator::Interactive
- Defined in:
- lib/generators/deck/deck_generator/interactive.rb
Overview
Guides through the decko deck installation with an interactive menu Offers the possibilitiy to
- edit database config
- edit application.rb
- seed database
- run server
Instance Method Summary collapse
-
#initialize(destination_root, dev = false) ⇒ Interactive
constructor
A new instance of Interactive.
- #run ⇒ Object
Constructor Details
#initialize(destination_root, dev = false) ⇒ Interactive
Returns a new instance of Interactive.
12 13 14 15 |
# File 'lib/generators/deck/deck_generator/interactive.rb', line 12 def initialize destination_root, dev=false @dev = dev @destination_root = destination_root end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/deck/deck_generator/interactive.rb', line 17 def run require config_path("application") # need this for Rails.env @menu = ActiveSupport::OrderedHash.new add_exit_option while (answer = ask()) != "x" if @menu.key? answer @menu[answer][:code].call else puts "invalid choice" end end end |