Sha256: dfcc19362a166a67264df61ba03b575b942d51c1dd42f20fac6272871015e794

Contents?: true

Size: 939 Bytes

Versions: 1

Compression:

Stored size: 939 Bytes

Contents

# Allows us to add more option parameter to the serve command
module Mercenary
  class Command
    def command(cmd_name)
      Jekyll.logger.debug "Refined Command"
      cmd = @commands[cmd_name] || Command.new(cmd_name, self)
      yield cmd
      @commands[cmd_name] = cmd
    end
  end
end

# Monkey Patch the Serve command to do a few things before the built-in
# Serve command methods are invoked.
module Jekyll
  module Livereload
    module Serve
      def init_with_program(prog)
        prog.command(:serve) do |c|
          c.option 'livereload', '-L', '--livereload', 'Inject Livereload.js and run a WebSocket Server'
          c.option 'reload_port', '-R', '--reload_port [PORT]', Integer, 'Port to serve Livereload on'
        end

        super prog
      end

      def process(opts)
        Livereload.reactor = Livereload::Reactor.new(opts)
        Livereload.reactor.start
        super opts
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-livereload-0.1.0 lib/jekyll-livereload/serve.rb