class Puman::CLI
Public Class Methods
new(args, opts, config)
click to toggle source
Calls superclass method
# File lib/puman/cli.rb, line 9 def initialize(args, opts, config) super @app_list = AppList.new end
Public Instance Methods
list()
click to toggle source
# File lib/puman/cli.rb, line 20 def list puts @app_list.list end
proxy(dir)
click to toggle source
# File lib/puman/cli.rb, line 53 def proxy(dir) target_dir = target_directory(dir) if @app_list.include?(target_dir) puts 'already exists.' else puts 'proxy option has not been implemented yet.' end end
server()
click to toggle source
# File lib/puman/cli.rb, line 25 def server server_command = @app_list.server_command webpack_dev_server_command = @app_list.webpack_dev_server_command if server_command.nil? puts 'no or multiple apps are defind.' exit 1 end if webpack_dev_server_command spawn webpack_dev_server_command end exec server_command rescue end
symlink(dir)
click to toggle source
# File lib/puman/cli.rb, line 42 def symlink(dir) target_dir, basename = target_directory(dir) if @app_list.include?(basename) puts 'already exists.' elnse FileUtils::ln_s(target_dir, File.join(PUMA_DEV_DIR, basename)) puts 'symlink created.' end end
version()
click to toggle source
# File lib/puman/cli.rb, line 15 def version puts Puman::VERSION end
Private Instance Methods
target_directory(arg_dir)
click to toggle source
# File lib/puman/cli.rb, line 64 def target_directory(arg_dir) file = File.expand_path(arg_dir) unless File.exists?(file) puts 'invalid argument.' exit 1 end [file, File.basename(file)] end