Sha256: 66b9ebe249a3a4f48b9e78937a55cb8792e119a44a78cffb9fcc943dc44b0efd

Contents?: true

Size: 703 Bytes

Versions: 3

Compression:

Stored size: 703 Bytes

Contents

if ARGV.first == '--help' || ARGV.first == '-h'
  puts File.open(File.join(PAK_PATH, 'commands/USAGE-SERVER')).read
else
  $:.unshift(Dir.pwd)

  require 'app/setup'

  valid_args = true
  if port_arg = ARGV.index("-p")
  	if ARGV[port_arg + 1] =~ /^\d{1,5}$/
	  	Pakyow::Config.server.port = ARGV[port_arg + 1]
	  	ARGV.delete_at(port_arg + 1)
	  	ARGV.delete_at(port_arg)
	  else
	  	valid_args = false
	  end
  elsif port_arg = ARGV.index {|a| a =~ /^--port=\d{1,5}$/}
  	Pakyow::Config.server.port = ARGV[port_arg].gsub(/--port=/, '')
		ARGV.delete_at(port_arg)
  end

  if valid_args
	  Pakyow::App.run(ARGV.first)
	else
		puts File.open(File.join(PAK_PATH, 'commands/USAGE-SERVER')).read
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pakyow-0.10.2 lib/commands/server.rb
pakyow-0.10.1 lib/commands/server.rb
pakyow-0.10.0 lib/commands/server.rb