Class: Prologue::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/prologue/cli.rb

Instance Method Summary collapse

Instance Method Details

#new(project) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/prologue/cli.rb', line 20

def new(project)
  opts = options.dup

  # Can't build an admin or roles without devise
  if !opts[:auth]
    opts[:admin] = false;
    opts[:roles] = false;
  end

  # Env vars used in our template
  ENV['PROLOGUE_AUTH']  = "true" if opts[:auth]
  ENV['PROLOGUE_ADMIN'] = "true" if opts[:admin]
  ENV['PROLOGUE_ROLES'] = "true" if opts[:roles]
  ENV['PROLOGUE_USER_NAME'] = git_user_name if opts[:admin]
  ENV['PROLOGUE_USER_EMAIL'] = git_user_email if opts[:admin]
  ENV['PROLOGUE_USER_PASSWORD'] = user_password if opts[:admin]

  exec(<<-COMMAND)
    rails new #{project} \
      --template=#{template} \
      --skip-test-unit \
      --skip-prototype
  COMMAND
end

#versionObject



46
47
48
# File 'lib/prologue/cli.rb', line 46

def version
  say "Prologue version #{Prologue::VERSION}"
end