Skip to content

Commit

Permalink
Add -B/--bind parameter to yard server command
Browse files Browse the repository at this point in the history
Closes #608, #615
  • Loading branch information
Tsyren Ochirov authored and lsegal committed Nov 26, 2012
1 parent 8a307cc commit 2e4cf2f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/yard/cli/server.rb
Expand Up @@ -181,6 +181,9 @@ def optparse(*args)
opts.on('-d', '--daemon', 'Daemonizes the server process') do
server_options[:daemonize] = true
end
opts.on('-B HOST', '--bind', 'The host address to bind to') do |host|
server_options[:Host] = host.to_s
end
opts.on('-p PORT', '--port', 'Serves documentation on PORT') do |port|
server_options[:Port] = port.to_i
end
Expand Down
18 changes: 18 additions & 0 deletions spec/cli/server_spec.rb
Expand Up @@ -173,6 +173,24 @@ def mock_file(filename, content = nil)
run '--daemon'
end

it "should accept -B, --bind" do
@server_options[:Host] = 'example.com'
run '-B', 'example.com'
run '--bind', 'example.com'
end

it "should bind address with WebRick adapter" do
@server_options[:Host] = 'example.com'
run '-B', 'example.com', '-a', 'webrick'
run '--bind', 'example.com', '-a', 'webrick'
end

it "should bind address with Rack adapter" do
@server_options[:Host] = 'example.com'
run '-B', 'example.com', '-a', 'rack'
run '--bind', 'example.com', '-a', 'rack'
end

it "should accept -p, --port" do
@server_options[:Port] = 10
run '-p', '10'
Expand Down

0 comments on commit 2e4cf2f

Please sign in to comment.