Skip to content

Commit a2b19c7

Browse files
committed
Let live command use live-reload by default
1 parent dac5e2e commit a2b19c7

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

nanoc-live/lib/nanoc/live/commands/live.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
1212
required :o, :host, 'specify the host to listen on (default: 127.0.0.1)'
1313
required :p, :port, 'specify the port to listen on (default: 3000)'
14-
flag :L, :'live-reload', 'reload on changes'
1514

1615
module Nanoc::Live::Commands
1716
class Live < ::Nanoc::CLI::CommandRunner
@@ -20,7 +19,8 @@ def run
2019

2120
Thread.new do
2221
Thread.current.abort_on_exception = true
23-
Nanoc::CLI::Commands::View.new(options, [], self).run
22+
view_options = options.merge('live-reload': true)
23+
Nanoc::CLI::Commands::View.new(view_options, [], self).run
2424
end
2525

2626
Nanoc::Live::LiveRecompiler.new(command_runner: self).run

nanoc-live/spec/nanoc/live/commands/live_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ def run_cmd
4242
end
4343
end
4444

45-
it 'receives websocket connections' do
46-
# TODO
45+
it 'listens for websocket connections' do
46+
run_cmd do
47+
socket = TCPSocket.new('localhost', 35_729)
48+
expect(socket).not_to be_closed
49+
end
4750
end
4851
end

0 commit comments

Comments
 (0)