Sha256: 9de19d694ea1deb477eef7256224e9f2f497e3441824efa2c0240476011c48bf

Contents?: true

Size: 1.5 KB

Versions: 4

Compression:

Stored size: 1.5 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
require 'juggernaut'

lib_dir = File.join(File.dirname(__FILE__), "..", "lib")
require File.join(lib_dir, "pushify", "install")
require File.join(lib_dir, "pushify", "server")


if (ARGV.to_s.empty? || ARGV.to_s == "help")

  puts
  puts "Pushify - from editor to browser"
  puts "--------------------------------------------"
  puts "pushify start     # start the pushify server"
  puts "pushify stop      # stop the pushify server"
  puts "pushify install   # install into a rails app"
  puts "pushify readme    # print the readme"
  puts "pushify help      # show this message"
  puts
  
elsif (ARGV.to_s == "readme")
  puts
  puts File.open(File.join(File.dirname(__FILE__), "..", "README.markdown")).read
  puts
else

  if (ARGV.include?('install'))
    print "Installing Pushify..."
    Pushify::Install.install!
    puts "success!"

    ARGV.clear
    ARGV.push("start")
  end

  pids = File.join('tmp', 'pids')
  pid = File.join(pids, 'juggernaut.pid')
  if ARGV.include?('stop')
    print "Stopping pushify server..."
    system("kill #{File.read(pid)}")
    system("rm #{pid}")
    system("killall pushify_server.rb")
  else
    print "Starting pushify server..."
    config = File.exist?("config/juggernaut.yml") ? "config/juggernaut.yml" : File.join(File.dirname(__FILE__), "..", "install", "juggernaut.yml")
    system("juggernaut -c#{config} -d -P #{pid}")
    Daemons.run_proc(File.join(pids, 'pushify_server.rb')) { Pushify::Server.run }
  end
  puts "success!"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pushify-1.2.2 bin/pushify
pushify-1.2.1 bin/pushify
pushify-1.2.0 bin/pushify
pushify-1.1.0 bin/pushify