Sha256: 8221a066ea3b3dda7df309f1240a142ac1804f8d7d974f8f827c14acca8e01ed

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

#!/usr/bin/ruby -w
#
# backlog      Startup script for the backlog application
#
# chkconfig: 345 88 12
# description: Backlog

require 'rubygems'
require 'fileutils'

APPLICATION = 'backlog'
GEM = Gem::searcher.find(APPLICATION)
if GEM
  INSTALL_DIR = "/usr/lib/ruby/gems/1.8/gems/#{APPLICATION}-#{GEM.version}"
else
  INSTALL_DIR = "/usr/local/backlog/current"
end

LOG_DIR = "#{INSTALL_DIR}/log"

# See how we were called.
case ARGV[0]
  when 'start':
        Dir.mkdir LOG_DIR unless File.exists? LOG_DIR
    `mongrel_rails start -p 3000 -e production -c #{INSTALL_DIR} -d -m #{INSTALL_DIR}/config/mime_types.yaml 1>#{LOG_DIR}/stdout.log 2>#{LOG_DIR}/stderr.log`
  when 'stop':
    `mongrel_rails stop -c #{INSTALL_DIR}`
  when 'restart':
    puts `mongrel_rails restart -c #{INSTALL_DIR}`
  when 'status'
    puts `ps -ef | grep backlog`
  when 'setup'
    FileUtils.cp "#{INSTALL_DIR}/bin/#{APPLICATION}_init.d", "/etc/init.d/#{APPLICATION}"
    dbs = `su - postgres -c "echo '\\l' | psql postgres"`
    puts dbs
    unless dbs =~ /#{APPLICATION}_production/
      puts `su - postgres -c "createdb #{APPLICATION}_production"`
      Dir.chdir INSTALL_DIR
    end
    puts `rake db:migrate RAILS_ENV=production`
  else
    puts "Usage: #$0 {start|stop|restart|status|setup}"
    exit 1
end

exit 0

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backlog-0.1.2 bin/backlog
backlog-0.2.0 bin/backlog
backlog-0.2.1 bin/backlog
backlog-0.3.0 bin/backlog