Class: WagnGenerator::Interactive

Inherits:
Object
  • Object
show all
Defined in:
lib/wagn/generators/wagn/wagn_generator/interactive.rb

Overview

Guides through the wagn deck installation with an interactive menu Offers the possibilitiy to

- edit database config
- edit application.rb
- seed database
- run server

Instance Method Summary collapse

Constructor Details

#initialize(options, destination_root) ⇒ Interactive

Returns a new instance of Interactive.



9
10
11
12
# File 'lib/wagn/generators/wagn/wagn_generator/interactive.rb', line 9

def initialize options, destination_root
  @dev = options["core-dev"] || options["mod-dev"]
  @destination_root = destination_root
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/wagn/generators/wagn/wagn_generator/interactive.rb', line 14

def run
  require config_path("application") # need this for Rails.env
  @menu = ActiveSupport::OrderedHash.new
  add_config_options
  add_seed_options
  add_exit_option
  while (answer = ask(build_menu)) != "x"
    if @menu.key? answer
      @menu[answer][:code].call
    else
      puts "invalid choice"
    end
  end
end