Sha256: aea1188f783b2606b8f9d3fe5d9b444fca4ee6ca0a7726dcb2daa09d67c7967d

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 Bytes

Contents

module Octopress
  module Commands
    class Serve < Command
      class << self
        def process(args, options)
          Octopress::Commands::Build.process(args, options)
          serve(args, options)
        end

        def serve(args, options)
          guardPid = Process.spawn("guard --guardfile #{Octopress.root}/lib/octopress/guardfile")
          puts "Starting Rack, serving to http://#{Octopress.configuration[:server_host]}:#{Octopress.configuration[:port]}"
          rackupPid = Process.spawn("rackup --host #{Octopress.configuration[:server_host]} --port #{Octopress.configuration[:port]}")

          trap("INT") {
            [guardPid, rackupPid].each { |pid| Process.kill(3, pid) rescue Errno::ESRCH }
            exit 0
          }

          [guardPid, rackupPid].each { |pid| Process.wait(pid) }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octopress-3.0.0.alpha1 lib/octopress/commands/serve.rb