Class: Autopilot::Generators::GoGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/autopilot/go_generator.rb

Instance Method Summary collapse

Instance Method Details

#do_magicObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/generators/autopilot/go_generator.rb', line 6

def do_magic

  if yes?("Do you want to have multiple users per account? [y|n]")
    include_accounts = true
  else
    include_accounts = false
  end

  if yes?("Do you want to include ActiveAdmin? [y|n]")
    include_admin = true
  else
    include_admin = false
  end

  if yes?("Do you want to include a home page? [y|n]")
    include_home = true
  else
    include_home = false
  end

  gem "paranoia", "~> 2.2"

  generate "autopilot:users"
  generate "autopilot:routes #{include_home ? '--home' : nil}"

  if include_accounts
    generate "autopilot:accounts"
  end

  if include_admin
    generate "autopilot:admin"
  end

  rake "db:migrate"
  run "rails s"
end