Module: TorqueBox::Upstart Private

Defined in:
lib/torquebox/upstart.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.check_installObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



55
56
57
58
59
# File 'lib/torquebox/upstart.rb', line 55

def check_install
  TorqueBox::DeployUtils.check_opt_torquebox
  raise "#{init_torquebox} not installed in #{init_dir}" unless ( File.exist?( init_torquebox ) )
  puts "TorqueBox init scripts OK: #{init_torquebox}"
end

.copy_init_script(opts = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/torquebox/upstart.rb', line 40

def copy_init_script(opts={})
  if File.writable?( init_dir )
    if ( server_opts = TorqueBox::DeployUtils.find_option(opts, 'server_opts') )
      to_init_file = File.join( init_dir, File.basename(init_script) )
      File.open( to_init_file, 'w' ) do |f|
        f.write( process_init_template(server_opts) )
      end
    else
      FileUtils.cp( init_script, init_dir )
    end
  else
    puts "Cannot write upstart configuration to #{init_dir}. You'll need to copy #{init_script} to #{init_dir} yourself."
  end
end

.init_dirObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
# File 'lib/torquebox/upstart.rb', line 28

def init_dir
  File.join( TorqueBox::DeployUtils.sys_root, 'etc', 'init' )
end

.init_scriptObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'lib/torquebox/upstart.rb', line 32

def init_script
  File.join( TorqueBox::DeployUtils.torquebox_home, 'share', 'init', 'torquebox.conf' )
end

.init_torqueboxObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/torquebox/upstart.rb', line 36

def init_torquebox
  File.join( init_dir, 'torquebox.conf' )
end

.process_init_template(server_opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

param names are important to the template



62
63
64
65
# File 'lib/torquebox/upstart.rb', line 62

def process_init_template(server_opts)
  template = ERB.new File.new( "#{init_script}.erb" ).read
  template.result(binding)
end