Sha256: cd04552771c0cef0251bb8c6ce35af3582d1eb0f31eda9e2d5beecba8b863766

Contents?: true

Size: 843 Bytes

Versions: 3

Compression:

Stored size: 843 Bytes

Contents

require 'thor/group'
require 'util'
require 'webrick'
require 'launchy'


class Start < Thor::Group
  include Util

  class_option :port,
               :type => :numeric,
               :desc => "the server-port",
               :default => 8080

  argument :presentation_name,
           :type => :string,
           :desc => 'The name of the presentation',
           :required => false

  def start
    root = "#{content_root}/master"
    thr = Thread.new do
      server =
          WEBrick::HTTPServer.new :Port => options[:port], :DocumentRoot => root
      trap 'INT' do server.shutdown end
      server.start
    end
    if @presentation_name
      Launchy.open("http://localhost:#{options[:port]}/slides/#{@presentation_name}")
    else
      Launchy.open("http://localhost:#{options[:port]}/slides/")
    end
    thr.join
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slidemgr-1.0.3 lib/commands/start.rb
slidemgr-1.0.2 lib/commands/start.rb
slidemgr-1.0.1 lib/commands/start.rb