Class: Bear::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/bear/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
44
# File 'lib/bear/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['BEAR_AUTH']  = "true" if opts[:auth]
  ENV['BEAR_ADMIN'] = "true" if opts[:admin]
  ENV['BEAR_ROLES'] = "true" if opts[:roles]
  ENV['BEAR_USER_NAME'] = git_user_name if opts[:admin]
  ENV['BEAR_USER_EMAIL'] = git_user_email if opts[:admin]
  ENV['BEAR_USER_PASSWORD'] = user_password if opts[:admin]

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

#versionObject



47
48
49
# File 'lib/bear/cli.rb', line 47

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