Class: DaemonizeRails::Unicorn

Inherits:
Object
  • Object
show all
Defined in:
lib/daemonize_rails.rb

Instance Method Summary collapse

Constructor Details

#initialize(bindings, app_name) ⇒ Unicorn

Returns a new instance of Unicorn.



6
7
8
9
10
# File 'lib/daemonize_rails.rb', line 6

def initialize(bindings, app_name)
  @bindings = bindings
  @app_name = app_name
  @app_path = Dir.pwd
end

Instance Method Details

#check_and_create_folder(path) ⇒ Object



19
20
21
22
23
24
# File 'lib/daemonize_rails.rb', line 19

def check_and_create_folder(path)
  if !File.exists? path
    Dir.mkdir path
    puts `chmod 755 #{path}`
  end
end

#make_config_fileObject



12
13
14
15
16
17
# File 'lib/daemonize_rails.rb', line 12

def make_config_file
  check_and_create_folder(@app_path + "/tmp")
  check_and_create_folder(@app_path + "/tmp/pids")
  unicorn_file = ERB.new File.new(File.dirname(__FILE__) + "/unicorn_template.erb").read, nil, "%"
  unicorn_file.result(@bindings)
end