lib/gumdrop/cli/internal.rb in gumdrop-1.0.2 vs lib/gumdrop/cli/internal.rb in gumdrop-1.0.3
- old
+ new
@@ -1,7 +1,8 @@
require 'fileutils'
require 'thor'
+require 'launchy'
module Gumdrop::CLI
class Internal < Thor
include Thor::Actions
@@ -23,11 +24,18 @@
end
Gumdrop.run options.merge(mode:'build')
end
desc 'server', 'Run development server'
+ method_option :browser, aliases:'-b', default:false, desc:"Launch a browser to the site address."
+ method_option :port, aliases:'-p', default:4567, desc:"Port to run the server on."
def server
+ Gumdrop.configure do |c|
+ c.server_port= options[:port]
+ end
Gumdrop.site.options = options.merge(mode:'server')
+ Launchy.open "http://127.0.0.1:#{ options[:port] }" if options[:browser]
+ Gumdrop.log.warn "Launching dev server at http://127.0.0.1:#{ options[:port] }"
Gumdrop::Server
end
desc 'template [NAME]', "Create local template from this project"
def template(name)