Class: MnoEnterprise::Generators::PumaStackGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_monitObject



40
41
42
# File 'lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb', line 40

def copy_monit
  template "scripts/monit/app-server.conf", "scripts/#{environment}/monit/app-server.conf"
end

#copy_nginxObject



27
28
29
30
31
# File 'lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb', line 27

def copy_nginx
  @app_domain = ask("What is the domain pointing to your #{environment} application? [#{default_domain}]")
  @app_domain = default_domain if @app_domain.blank?
  template "scripts/nginx/app", "scripts/#{environment}/nginx/app"
end

#copy_setup_scriptObject



23
24
25
# File 'lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb', line 23

def copy_setup_script
  template "scripts/setup.sh", "scripts/#{environment}/setup.sh"
end

#copy_upstartObject



33
34
35
36
37
38
# File 'lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb', line 33

def copy_upstart
  template "scripts/upstart/app.conf", "scripts/#{environment}/upstart/app.conf"
  template "scripts/upstart/app-web.conf", "scripts/#{environment}/upstart/app-web.conf"
  template "scripts/upstart/app-web-server.conf", "scripts/#{environment}/upstart/app-web-server.conf"
  template "scripts/upstart/app-web-hotrestart.conf", "scripts/#{environment}/upstart/app-web-hotrestart.conf"
end

#install_puma_gemObject



16
17
18
19
20
21
# File 'lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb', line 16

def install_puma_gem
  gem "puma"
  @num_cpus = ask("How many CPUs (or vCPU for EC2) does your #{environment} machine have? [1]")
  @num_cpus = "1" if @num_cpus.blank?
  template "scripts/puma.rb", "scripts/#{environment}/puma.rb"
end

#validate_environmentObject



10
11
12
13
14
# File 'lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb', line 10

def validate_environment
  unless available_environments.include?(environment)
    raise Exception.new("Environment '#{environment}' is not defined. Please define this environment in config/environments/#{environment}.rb")
  end
end