mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Add -I option to specify $LOAD_PATH directories
This commit is contained in:
parent
5c2bd100ac
commit
c077e63262
2 changed files with 20 additions and 0 deletions
|
@ -169,6 +169,10 @@ module Puma
|
|||
@options[:config_file] = arg
|
||||
end
|
||||
|
||||
o.on "-I", "--include PATH", "Specify $LOAD_PATH directories" do |arg|
|
||||
$LOAD_PATH.unshift(*arg.split(':'))
|
||||
end
|
||||
|
||||
o.on "-p", "--port PORT", "Define what port TCP port to bind to",
|
||||
"Use -b for more advanced options" do |arg|
|
||||
@options[:binds] << "tcp://#{Configuration::DefaultTCPHost}:#{arg}"
|
||||
|
|
|
@ -109,4 +109,20 @@ class TestCLI < Test::Unit::TestCase
|
|||
assert_equal Process.pid, data["pid"]
|
||||
assert_equal url, data["config"].options[:control_url]
|
||||
end
|
||||
|
||||
def test_load_path
|
||||
cli = Puma::CLI.new ["--include", 'foo/bar']
|
||||
cli.parse_options
|
||||
|
||||
assert_equal 'foo/bar', $LOAD_PATH[0]
|
||||
$LOAD_PATH.shift
|
||||
|
||||
cli = Puma::CLI.new ["--include", 'foo/bar:baz/qux']
|
||||
cli.parse_options
|
||||
|
||||
assert_equal 'foo/bar', $LOAD_PATH[0]
|
||||
$LOAD_PATH.shift
|
||||
assert_equal 'baz/qux', $LOAD_PATH[0]
|
||||
$LOAD_PATH.shift
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue