Class: Pushapp::Generators

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/pushapp/generators.rb

Instance Method Summary collapse

Instance Method Details

#chef_solo(remote) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/pushapp/generators.rb', line 81

def chef_solo(remote)
  options[:remote] = remote

  template 'Cheffile.erb',    'config/deploys/chef/Cheffile'
  template 'Vagrantfile.erb', 'config/deploys/chef/Vagrantfile'
  template 'knife.rb.erb',    'config/deploys/chef/.chef/knife.rb'
  template 'node.json.erb',   "config/deploys/chef/nodes/#{app_host}.json"
  template 'user.json.erb',   "config/deploys/chef/data_bags/users/#{app_user}.json"

  template 'chef.gitignore',  'config/deploys/chef/.gitignore'
end

#unicorn(remote) ⇒ Object



48
49
50
51
52
# File 'lib/pushapp/generators.rb', line 48

def unicorn(remote)
  options[:remote] = remote
  template 'unicorn.rb.erb', 'config/unicorn.rb'
  puts "NOTE: add tmp/pids to your git repo. ( touch tmp/pids/.keep && git add tmp/pids/.keep -f )"
end

#unicorn_nginx(remote) ⇒ Object



36
37
38
39
# File 'lib/pushapp/generators.rb', line 36

def unicorn_nginx(remote)
  options[:remote] = remote
  template 'unicorn_nginx.conf.erb', "config/deploys/#{app_name}.nginx.conf"
end

#unicorn_upstartObject



42
43
44
45
# File 'lib/pushapp/generators.rb', line 42

def unicorn_upstart
  template 'unicorn_upstart.erb', 'bin/unicorn_upstart'
  chmod 'bin/unicorn_upstart', 'a+x'
end

#web(remote) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pushapp/generators.rb', line 16

def web(remote)
  options[:remote]
  options[:listen] = "80"

  uncomment_lines 'Gemfile', /gem 'unicorn'/
  uncomment_lines 'Gemfile', /gem 'therubyracer'/
  insert_into_file 'Gemfile', "\ngem 'pushapp'\ngem 'foreman'\ngem 'dotenv-rails'", after: /gem 'unicorn'/
  unicorn_upstart
  unicorn_nginx(remote)
  unicorn(remote)

  template 'Procfile'
  template '.env.erb', ".env.#{app_env}"
end