Method: Thin::Controllers::Service#install

Defined in:
lib/thin/controllers/service.rb

#install(config_files_path = DEFAULT_CONFIG_PATH) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/thin/controllers/service.rb', line 34

def install(config_files_path=DEFAULT_CONFIG_PATH)
  if File.exist?(INITD_PATH)
    log ">> Thin service already installed at #{INITD_PATH}"
  else
    log ">> Installing thin service at #{INITD_PATH} ..."
    sh "mkdir -p #{File.dirname(INITD_PATH)}"
    log "writing #{INITD_PATH}"        
    File.open(INITD_PATH, 'w') do |f|
      f << ERB.new(File.read(TEMPLATE)).result(binding)
    end
    sh "chmod +x #{INITD_PATH}" # Make executable
  end

  sh "mkdir -p #{config_files_path}"

  log ''
  log "To configure thin to start at system boot:"
  log "on RedHat like systems:"
  log "  sudo /sbin/chkconfig --level 345 #{NAME} on"
  log "on Debian-like systems (Ubuntu):"
  log "  sudo /usr/sbin/update-rc.d -f #{NAME} defaults"
  log "on Gentoo:"
  log "  sudo rc-update add #{NAME} default"
  log ''
  log "Then put your config files in #{config_files_path}"
end