Sha256: 6ad55e5a1e2a7691e64b86963be66826eec8abc438cdf73a759f7628247986c8

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

# encoding: UTF-8

module Vines
  module Command
    class Start
      def run(opts)
        raise 'vines [--pid FILE] start' unless opts[:args].size == 0
        require opts[:config]

        config = Config.instance
        if opts[:debug]
          config.debug = true
          config.log("debug")
        end

        server = XmppServer.new(config)
        daemonize(opts) if opts[:daemonize]
        server.start
      end

      private

      def daemonize(opts)
        daemon = Daemon.new(:pid => opts[:pid], :stdout => opts[:log],
          :stderr => opts[:log])
        if daemon.running?
          raise "Vines is running as process #{daemon.pid}"
        else
          puts "Vines has started"
          daemon.start
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vinesmod-0.4.5.2 lib/vines/command/start.rb