reveal-ck 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f1e06722b9bd3463bd12f98d3e2a6018318263e
4
- data.tar.gz: 5c72f4aae233bbc7fabe1b7743e3a9f5649f55d2
3
+ metadata.gz: f42ef4712de98dd2c0eb2f39739bc1921f67e1cb
4
+ data.tar.gz: 551a2fe2ffb941ca3735f127b2cbcd5f99952783
5
5
  SHA512:
6
- metadata.gz: 5f3820c5a88605bb342220cd4acf4d9bea0f6034ff9d72b4f2ec624a0081e319dd83cf79753fc5105be3fdd311799e9ddce31e0cc8a3b53abf70b12790ee8216
7
- data.tar.gz: a4ba292644a45d989db76a75631cb0fd7be287558ed879f9c6c007f1ba548719135d95d0ff3b8dcda941284f74d27bb7d9efca442c1b728556502894d5cebfc9
6
+ metadata.gz: f214ae25beecfe703cf4cd60b57c138129aadbce87c7f04a0cf11bca0f53ff6c596de1033dee70145629709817098bd3e695f4763f96ca8afaab427518e962db
7
+ data.tar.gz: 983a83af3ca8da7ced650cd41ddae8dd3a6fb90343b5925bf8ab8838ab6d592cd8b0c8b78105f37f982943c9d0b5aab6152db30ae7d9bf4ffcb8dbdb951e2fe7
data/bin/reveal-ck CHANGED
@@ -37,47 +37,50 @@ class RevealCKExecutable
37
37
  msg = 'Create a file matching slides.* to proceed, such as slides.md.'
38
38
  exit_now!(msg)
39
39
  end
40
- puts "Generating slides for '#{slides_file}'.."
41
- builder_args = {
40
+ generate_args = {
42
41
  user_dir: Dir.pwd,
43
42
  gem_dir: RevealCK.path,
44
43
  output_dir: options[:dir],
45
44
  slides_file: options[:file]
46
45
  }
47
- slides_builder =
48
- RevealCK::Builders::SlidesBuilder.new(builder_args)
49
- slides_builder.prepare
50
- slides_builder.build
46
+ RevealCK::Commands::Generate.new(generate_args).run
51
47
  end
52
48
  end
53
49
 
54
50
  desc 'Start webserver so slides are available via http'
55
51
  command :serve, :server do |c|
56
52
 
53
+ slide_files = FileList['slides.*']
54
+ default_file = slide_files.empty? ? nil : slide_files.first
55
+
56
+ c.desc 'The file containing your slide content'
57
+ c.flag [:f, :file], default_value: default_file
58
+
57
59
  c.desc 'The directory to serve up'
58
60
  c.flag [:d, :dir], default_value: 'slides'
59
61
 
60
62
  c.desc 'The port to serve on'
61
63
  c.flag [:p, :port], default_value: 10_000
62
64
 
63
- c.action do |_, options, _|
64
- dir = options[:dir]
65
- port = options[:port]
65
+ c.desc 'Exit after starting + n seconds (for testing only)'
66
+ c.flag ['test-quit-after-starting'], type: Integer
66
67
 
67
- require 'webrick'
68
- server = WEBrick::HTTPServer.new Port: port, DocumentRoot: dir
69
- trap('INT') { server.shutdown }
70
-
71
- puts
72
- puts
73
- puts "\tServing up slide content in '#{dir}/'."
74
- puts
75
- puts "\tOpen your browser to 'http://localhost:#{port}'."
76
- puts
77
- puts "\tPress CTRL-C to stop serving slides."
78
- puts
79
- puts
80
- server.start
68
+ c.action do |_, options, _|
69
+ serve_args = {
70
+ doc_root: options[:dir],
71
+ gem_dir: RevealCK.path,
72
+ output_dir: options[:dir],
73
+ port: options[:port],
74
+ slides_file: options[:file],
75
+ user_dir: Dir.pwd
76
+ }
77
+ if options['test-quit-after-starting']
78
+ Thread.new do
79
+ sleep options['test-quit-after-starting']
80
+ exit
81
+ end
82
+ end
83
+ RevealCK::Commands::Serve.new(serve_args).run
81
84
  end
82
85
  end
83
86
  exit run(ARGV)
@@ -0,0 +1,4 @@
1
+ When(/^I temporarily start reveal\-ck serve$/) do
2
+ port = 10_000 + rand(1000)
3
+ run("reveal-ck serve --port #{port} --test-quit-after-starting 2")
4
+ end
@@ -1 +1,6 @@
1
1
  require 'aruba/cucumber'
2
+
3
+ Before do
4
+ @aruba_io_wait_seconds = 10
5
+ @aruba_timeout_seconds = 10
6
+ end
@@ -0,0 +1,5 @@
1
+ notification :off
2
+
3
+ guard 'livereload' do
4
+ watch(/^slides\/index.html$/)
5
+ end
data/lib/reveal-ck.rb CHANGED
@@ -15,6 +15,7 @@ require_relative 'reveal-ck/templates'
15
15
  require_relative 'reveal-ck/builders'
16
16
  require_relative 'reveal-ck/markdown'
17
17
  require_relative 'reveal-ck/tilt/config'
18
+ require_relative 'reveal-ck/commands'
18
19
 
19
20
  # RevealCK::path provides the path where files within the reveal-ck
20
21
  # gem are located on your system.
@@ -0,0 +1,8 @@
1
+ require_relative 'commands/generate'
2
+
3
+ require_relative 'commands/print_banner'
4
+ require_relative 'commands/listen_to_rebuild_slides'
5
+ require_relative 'commands/listen_to_reload_browser'
6
+ require_relative 'commands/start_web_server'
7
+ require_relative 'commands/serve_ui'
8
+ require_relative 'commands/serve'
@@ -0,0 +1,30 @@
1
+ module RevealCK
2
+ module Commands
3
+ # This Command is responsible for implementing the idea behind
4
+ # "reveal-ck generate."
5
+ class Generate
6
+ include Retrieve
7
+ attr_reader :slides_builder, :slides_file, :stdout_prefix
8
+ def initialize(args)
9
+ user_dir = retrieve(:user_dir, args)
10
+ gem_dir = retrieve(:gem_dir, args)
11
+ output_dir = retrieve(:output_dir, args)
12
+ @stdout_prefix = args[:stdout_prefix] || ''
13
+ @slides_file = retrieve(:slides_file, args)
14
+ @slides_builder =
15
+ RevealCK::Builders::SlidesBuilder.new(user_dir: user_dir,
16
+ gem_dir: gem_dir,
17
+ output_dir: output_dir,
18
+ slides_file: slides_file)
19
+ end
20
+
21
+ def run
22
+ msg = "Generating slides for '#{slides_file}'.."
23
+ msg = "#{stdout_prefix} #{msg}" unless stdout_prefix.empty?
24
+ puts msg
25
+ slides_builder.prepare
26
+ slides_builder.build
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,39 @@
1
+ require 'listen'
2
+
3
+ module RevealCK
4
+ module Commands
5
+ # The idea of listening for file system changes and then
6
+ # rebuilding slides.
7
+ class ListenToRebuildSlides
8
+ attr_reader :ui, :rebuild_method
9
+ def initialize(ui, &block)
10
+ @ui, @rebuild_method = ui, block
11
+ end
12
+
13
+ def run
14
+ ::Listen.to('.', ignore: ignored_files_regex) do |mod, add, del|
15
+ message_and_rebuild(mod, add, del)
16
+ end.start
17
+ end
18
+
19
+ private
20
+
21
+ def message_about_files(files, message)
22
+ return if files.empty?
23
+ file_names = files.join(', ')
24
+ ui.message("#{message}: #{file_names}", :rebuild)
25
+ end
26
+
27
+ def ignored_files_regex
28
+ /^slides\/.+$/
29
+ end
30
+
31
+ def message_and_rebuild(mod, add, del)
32
+ message_about_files(mod, 'Modified')
33
+ message_about_files(add, 'Added')
34
+ message_about_files(del, 'Deleted')
35
+ rebuild_method.call
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,20 @@
1
+ module RevealCK
2
+ module Commands
3
+ # The idea of listening for file system changes that indicate its
4
+ # time to tell browsers to reload.
5
+ class ListenToReloadBrowser
6
+ attr_reader :prefix
7
+
8
+ def initialize(ui)
9
+ @prefix = ui.prefix_for(:reload)
10
+ end
11
+
12
+ def run
13
+ require 'guard'
14
+ guardfile = RevealCK.path('files/reveal-ck/Guardfile')
15
+ Guard::UI.options[:template] = "#{prefix} :message"
16
+ Guard.start guardfile: guardfile, no_interactions: true
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ module RevealCK
2
+ module Commands
3
+ # The idea of displaying a banner via an injected ui. Messages
4
+ # sent explain everything to do with the serve command (listening,
5
+ # reloading, and webserving)
6
+ class PrintBanner
7
+ attr_reader :doc_root, :port, :slides_file, :ui
8
+ def initialize(doc_root, port, slides_file, ui)
9
+ @doc_root, @port, @slides_file = doc_root, port, slides_file
10
+ @ui = ui
11
+ end
12
+
13
+ def run
14
+ ui.separator
15
+ ui.message "Serving up slide content in '#{doc_root}/'."
16
+ ui.message "Open your browser to 'http://localhost:#{port}'."
17
+ ui.message 'Press CTRL-C to stop.'
18
+ ui.separator
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,69 @@
1
+ module RevealCK
2
+ module Commands
3
+ # This Command is responsible for implementing the idea behind
4
+ # "reveal-ck serve."
5
+ #
6
+ # This includes taking an action and managing stdout
7
+ class Serve
8
+ include Retrieve
9
+ attr_reader :doc_root, :port
10
+ attr_reader :slides_file, :user_dir, :gem_dir, :output_dir
11
+ attr_reader :ui
12
+ def initialize(args)
13
+ @doc_root = retrieve(:doc_root, args)
14
+ @port = retrieve(:port, args)
15
+ @slides_file = retrieve(:slides_file, args)
16
+ @gem_dir = retrieve(:gem_dir, args)
17
+ @output_dir = retrieve(:output_dir, args)
18
+ @user_dir = retrieve(:user_dir, args)
19
+ @ui = ServeUI.new
20
+ end
21
+
22
+ def run
23
+ print_banner
24
+ listen_to_reload
25
+ listen_to_rebuild
26
+ start_web_server
27
+ end
28
+
29
+ def rebuild_slides
30
+ RevealCK::Commands::Generate.new(rebuild_options).run
31
+ rescue => error
32
+ ui.problem('Failed to Generate Slides:', error)
33
+ end
34
+
35
+ private
36
+
37
+ def print_banner
38
+ PrintBanner.new(doc_root, port, slides_file, ui).run
39
+ end
40
+
41
+ def listen_to_reload
42
+ ui.message('Getting Ready to Reload Browsers.')
43
+ ListenToReloadBrowser.new(ui).run
44
+ end
45
+
46
+ def listen_to_rebuild
47
+ ui.message('Getting Ready to Rebuild Slides.')
48
+ ListenToRebuildSlides.new(ui) do
49
+ rebuild_slides
50
+ end.run
51
+ end
52
+
53
+ def start_web_server
54
+ ui.message('Starting Webserver.')
55
+ StartWebServer.new(doc_root, port).run
56
+ end
57
+
58
+ def rebuild_options
59
+ {
60
+ slides_file: @slides_file,
61
+ gem_dir: @gem_dir,
62
+ output_dir: @output_dir,
63
+ user_dir: @user_dir,
64
+ stdout_prefix: ui.prefix_for(:rebuild)
65
+ }
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,40 @@
1
+ module RevealCK
2
+ module Commands
3
+ # This object represents controls the "User Interface" of the
4
+ # serve command.
5
+ class ServeUI
6
+ PREFIXES = {
7
+ default: '[ reveal-ck ]',
8
+ problem: '[ problem ]',
9
+ rebuild: '[ rebuild ]',
10
+ reload: '[ reload ]'
11
+ }
12
+
13
+ def problem(general_problem, specific_error)
14
+ blank :problem
15
+ message general_problem, :problem
16
+ blank :problem
17
+ message specific_error, :problem
18
+ blank :problem
19
+ end
20
+
21
+ def message(s, type = nil)
22
+ prefix = prefix_for(type)
23
+ puts "#{prefix} #{s}"
24
+ end
25
+
26
+ def prefix_for(type = nil)
27
+ PREFIXES[type] || PREFIXES[:default]
28
+ end
29
+
30
+ def blank(type = nil)
31
+ prefix = PREFIXES[type] || ''
32
+ puts "#{prefix}"
33
+ end
34
+
35
+ def separator
36
+ puts '------------------------------------------------------------'
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,47 @@
1
+ require 'rack'
2
+ require 'webrick'
3
+ require 'rack/livereload'
4
+
5
+ module RevealCK
6
+ module Commands
7
+ # The idea of starting up a webserver to display slides locally.
8
+ class StartWebServer
9
+ attr_reader :doc_root, :port
10
+ def initialize(doc_root, port)
11
+ @doc_root, @port = doc_root, port
12
+ end
13
+
14
+ def run
15
+ Rack::Server.new(app: build_rack_app(doc_root),
16
+ Port: port,
17
+ Logger: server_log,
18
+ AccessLog: access_log).start
19
+ end
20
+
21
+ private
22
+
23
+ def build_rack_app(doc_root)
24
+ Rack::Builder.new do
25
+ use Rack::LiveReload
26
+ use Rack::Static, index: "#{doc_root}/index.html"
27
+ run Rack::Directory.new(doc_root)
28
+ end
29
+ end
30
+
31
+ def server_log
32
+ WEBrick::BasicLog.new(temp_log('reveal-ck-server'))
33
+ end
34
+
35
+ def access_log
36
+ access_log_file = File.open(temp_log('reveal-ck-access'), 'w')
37
+ [[access_log_file, WEBrick::AccessLog::COMMON_LOG_FORMAT]]
38
+ end
39
+
40
+ def temp_log(name)
41
+ require 'tempfile'
42
+ file = Tempfile.new(["#{name}-", '.log'])
43
+ file.path
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,2 +1,12 @@
1
1
  # Direct Tilt to use SlideMarkdownTemplate for "md" files
2
2
  Tilt.register RevealCK::Markdown::SlideMarkdownTemplate, 'md'
3
+
4
+ # The following requires are present to avoid warnings such as:
5
+ #
6
+ # WARN: tilt autoloading 'tilt/erb' in a non thread-safe way; explicit
7
+ # require 'tilt/erb' suggested.
8
+ #
9
+ # The same goes for tilt/haml, tilt/redcloth
10
+ require 'tilt/erb'
11
+ require 'tilt/haml'
12
+ require 'tilt/redcloth'
@@ -1,4 +1,4 @@
1
1
  # RevealCK::VERSION is the current version of reveal-ck
2
2
  module RevealCK
3
- VERSION = '0.4.2'
3
+ VERSION = '0.5.0'
4
4
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ module RevealCK
4
+ module Commands
5
+ describe Generate do
6
+ describe '#run' do
7
+ it 'generates a new set of slides' do
8
+ slides_builder = double
9
+ allow(RevealCK::Builders::SlidesBuilder)
10
+ .to receive(:new)
11
+ .and_return(slides_builder)
12
+
13
+ expect(slides_builder).to receive(:prepare)
14
+ expect(slides_builder).to receive(:build)
15
+
16
+ generate =
17
+ Generate.new(user_dir: 'user_dir',
18
+ gem_dir: 'gem_dir',
19
+ output_dir: 'output_dir',
20
+ slides_file: 'slides_file')
21
+
22
+ expect(generate)
23
+ .to receive(:puts)
24
+ .with("Generating slides for 'slides_file'..")
25
+ generate.run
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+ require 'listen'
3
+
4
+ module RevealCK
5
+ module Commands
6
+ describe ListenToRebuildSlides do
7
+ describe '#run' do
8
+
9
+ let :current_directory do
10
+ '.'
11
+ end
12
+
13
+ let :generated_slides do
14
+ /^slides\/.+$/
15
+ end
16
+
17
+ it 'sets up ::Listen to run when things change' do
18
+ listener = double
19
+ expect(::Listen)
20
+ .to(receive(:to))
21
+ .with(current_directory, ignore: generated_slides)
22
+ .once
23
+ .and_return(listener)
24
+ expect(listener)
25
+ .to(receive(:start))
26
+
27
+ ListenToRebuildSlides.new(double('ui')).run
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+ require 'guard'
3
+
4
+ module RevealCK
5
+ module Commands
6
+ describe ListenToReloadBrowser do
7
+ describe '#run' do
8
+ it 'works with Guard to setup livereload' do
9
+
10
+ serve_ui = double
11
+
12
+ expect(serve_ui)
13
+ .to(receive(:prefix_for))
14
+ .and_return('[prefix]')
15
+
16
+ expect(::Guard)
17
+ .to(receive(:start))
18
+ .once
19
+
20
+ listen_to_reload_browser = ListenToReloadBrowser.new(serve_ui)
21
+ listen_to_reload_browser.run
22
+
23
+ expect(Guard::UI.options[:template]).to eq '[prefix] :message'
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ module RevealCK
4
+ module Commands
5
+ describe PrintBanner do
6
+ describe '#run' do
7
+ it 'sends #messages and #separators to the ui' do
8
+
9
+ serve_ui = double
10
+
11
+ expect(serve_ui)
12
+ .to(receive(:separator))
13
+ .at_least :once
14
+
15
+ expect(serve_ui)
16
+ .to(receive(:message))
17
+ .at_least :once
18
+
19
+ banner = PrintBanner.new('doc_root', 'port', 'slides_file', serve_ui)
20
+ banner.run
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,126 @@
1
+ require 'spec_helper'
2
+ require 'tmpdir'
3
+
4
+ def build_serve
5
+ RevealCK::Commands::Serve
6
+ .new(doc_root: 'doc_root',
7
+ port: 'port',
8
+ user_dir: 'user_dir',
9
+ gem_dir: 'gem_dir',
10
+ output_dir: 'output_dir',
11
+ slides_file: 'slides_file')
12
+ end
13
+
14
+ def expect_new_and_run(klazz)
15
+ mock = double
16
+ expect(klazz)
17
+ .to(receive(:new))
18
+ .and_return(mock)
19
+ expect(mock).to(receive(:run))
20
+ end
21
+
22
+ def allow_new_and_run(klazz)
23
+ mock = double
24
+ allow(klazz)
25
+ .to(receive(:new))
26
+ .and_return(mock)
27
+ allow(mock).to(receive(:run))
28
+ end
29
+
30
+ module RevealCK
31
+ module Commands
32
+ describe Serve do
33
+ describe '#rebuild_slides' do
34
+ it 'relies on Generate' do
35
+ serve = build_serve
36
+ expect_new_and_run(RevealCK::Commands::Generate)
37
+ serve.rebuild_slides
38
+ end
39
+
40
+ it 'reports errors via the ui' do
41
+ serve_ui = double
42
+ expect(ServeUI)
43
+ .to(receive(:new))
44
+ .and_return(serve_ui)
45
+
46
+ expect(serve_ui)
47
+ .to(receive(:prefix_for))
48
+
49
+ expect(serve_ui)
50
+ .to(receive(:problem))
51
+
52
+ generate_command = double
53
+ expect(Generate)
54
+ .to(receive(:new))
55
+ .and_return(generate_command)
56
+ expect(generate_command)
57
+ .to(receive(:run))
58
+ .and_raise('Big Trouble!')
59
+
60
+ build_serve.rebuild_slides
61
+ end
62
+ end
63
+
64
+ describe '#run' do
65
+ it 'coordinates a number of objects to serve up slides and reload' do
66
+ serve_ui = double
67
+ expect(ServeUI)
68
+ .to(receive(:new))
69
+ .and_return(serve_ui)
70
+
71
+ allow(serve_ui)
72
+ .to(receive(:message))
73
+
74
+ print_banner = double
75
+ expect(PrintBanner)
76
+ .to(receive(:new))
77
+ .with('doc_root', 'port', 'slides_file', serve_ui)
78
+ .and_return(print_banner)
79
+ expect(print_banner)
80
+ .to(receive(:run))
81
+
82
+ expect_new_and_run(RevealCK::Commands::ListenToRebuildSlides)
83
+ expect_new_and_run(RevealCK::Commands::ListenToReloadBrowser)
84
+ expect_new_and_run(RevealCK::Commands::StartWebServer)
85
+ build_serve.run
86
+ end
87
+
88
+ it 'actually listens for file system changes' do
89
+ serve_ui = double
90
+ allow(ServeUI)
91
+ .to(receive(:new))
92
+ .and_return(serve_ui)
93
+ allow(serve_ui)
94
+ .to(receive(:message))
95
+
96
+ Dir.mktmpdir do |dir|
97
+ Dir.chdir(dir) do
98
+ print_banner = double
99
+ allow(PrintBanner)
100
+ .to(receive(:new))
101
+ .and_return(print_banner)
102
+ allow(print_banner)
103
+ .to(receive(:run))
104
+
105
+ # Don't stub out ListenToRebuildSlides
106
+ allow_new_and_run(RevealCK::Commands::ListenToReloadBrowser)
107
+ allow_new_and_run(RevealCK::Commands::StartWebServer)
108
+
109
+ serve = build_serve
110
+ serve.run
111
+ expect(serve)
112
+ .to(receive(:rebuild_slides))
113
+ File.open('slides.md', 'w') do |file|
114
+ file.puts('Slides')
115
+ end
116
+ # Creating the file will trigger the call back. But need
117
+ # to wait else the expecation of :rebuild_slides will
118
+ # fail-- it's not instantaneous
119
+ sleep 0.25
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ module RevealCK
4
+ module Commands
5
+ describe ServeUI do
6
+
7
+ let :serve_ui do
8
+ ServeUI.new
9
+ end
10
+
11
+ let :separator do
12
+ '------------------------------------------------------------'
13
+ end
14
+
15
+ let :default_prefix do
16
+ '[ reveal-ck ]'
17
+ end
18
+
19
+ let :problem_prefix do
20
+ '[ problem ]'
21
+ end
22
+
23
+ describe '#message' do
24
+ it 'prints the message (preceeded by a prefix) to standard out' do
25
+ expect(serve_ui).to receive(:puts).with("#{default_prefix} Hello")
26
+ serve_ui.message('Hello')
27
+ end
28
+ end
29
+
30
+ describe '#problem' do
31
+ it 'prints several messages to standard out' do
32
+ expect(serve_ui).to receive(:puts).with("#{problem_prefix}")
33
+ expect(serve_ui)
34
+ .to receive(:puts)
35
+ .with("#{problem_prefix} Compilation Problem")
36
+ expect(serve_ui).to receive(:puts).with("#{problem_prefix}")
37
+ expect(serve_ui)
38
+ .to receive(:puts)
39
+ .with("#{problem_prefix} on line 12")
40
+ expect(serve_ui).to receive(:puts).with("#{problem_prefix}")
41
+ serve_ui.problem('Compilation Problem', 'on line 12')
42
+ end
43
+ end
44
+
45
+ describe '#blank' do
46
+ it 'prints a blank line' do
47
+ expect(serve_ui).to receive(:puts).with ''
48
+ serve_ui.blank
49
+ end
50
+ end
51
+
52
+ describe '#separator' do
53
+ it 'prints a bunch of dashes' do
54
+ expect(serve_ui)
55
+ .to receive(:puts).with separator
56
+ serve_ui.separator
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+ require 'tmpdir'
3
+
4
+ module RevealCK
5
+ module Commands
6
+ describe StartWebServer do
7
+ describe '#run' do
8
+ it 'works with Rack to start an application' do
9
+ start_web_server =
10
+ StartWebServer.new('doc_root', 'port')
11
+ rack_server = double
12
+ expect(::Rack::Server)
13
+ .to(receive(:new))
14
+ .and_return(rack_server)
15
+ expect(rack_server)
16
+ .to(receive(:start))
17
+ start_web_server.run
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reveal-ck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jed Northridge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-27 00:00:00.000000000 Z
11
+ date: 2014-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: RedCloth
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-livereload
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.3'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.3'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: haml
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +108,48 @@ dependencies:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '1.9'
111
+ - !ruby/object:Gem::Dependency
112
+ name: listen
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rack
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.5'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.5'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rack-livereload
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.3'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.3'
97
153
  - !ruby/object:Gem::Dependency
98
154
  name: rake
99
155
  requirement: !ruby/object:Gem::Requirement
@@ -280,8 +336,10 @@ files:
280
336
  - features/data/images/ruby100.png
281
337
  - features/step_definitions/file_management_steps.rb
282
338
  - features/step_definitions/html_match_steps.rb
339
+ - features/step_definitions/serve_steps.rb
283
340
  - features/support/env.rb
284
341
  - features/support/file_management.rb
342
+ - files/reveal-ck/Guardfile
285
343
  - files/reveal-ck/css/reveal-ck.css
286
344
  - files/reveal-ck/templates/index.html/body.html.erb
287
345
  - files/reveal-ck/templates/index.html/head.html.erb
@@ -383,6 +441,14 @@ files:
383
441
  - lib/reveal-ck/builders/reveal_js_files.rb
384
442
  - lib/reveal-ck/builders/slides_builder.rb
385
443
  - lib/reveal-ck/builders/user_files.rb
444
+ - lib/reveal-ck/commands.rb
445
+ - lib/reveal-ck/commands/generate.rb
446
+ - lib/reveal-ck/commands/listen_to_rebuild_slides.rb
447
+ - lib/reveal-ck/commands/listen_to_reload_browser.rb
448
+ - lib/reveal-ck/commands/print_banner.rb
449
+ - lib/reveal-ck/commands/serve.rb
450
+ - lib/reveal-ck/commands/serve_ui.rb
451
+ - lib/reveal-ck/commands/start_web_server.rb
386
452
  - lib/reveal-ck/config.rb
387
453
  - lib/reveal-ck/filtered_html_string.rb
388
454
  - lib/reveal-ck/markdown.rb
@@ -436,6 +502,13 @@ files:
436
502
  - spec/lib/reveal-ck/builders/reveal_js_files_spec.rb
437
503
  - spec/lib/reveal-ck/builders/slides_builder_spec.rb
438
504
  - spec/lib/reveal-ck/builders/user_files_spec.rb
505
+ - spec/lib/reveal-ck/commands/generate_spec.rb
506
+ - spec/lib/reveal-ck/commands/listen_to_rebuild_slides_spec.rb
507
+ - spec/lib/reveal-ck/commands/listen_to_reload_browser_spec.rb
508
+ - spec/lib/reveal-ck/commands/print_banner_spec.rb
509
+ - spec/lib/reveal-ck/commands/serve_spec.rb
510
+ - spec/lib/reveal-ck/commands/serve_ui_spec.rb
511
+ - spec/lib/reveal-ck/commands/start_web_server_spec.rb
439
512
  - spec/lib/reveal-ck/config_spec.rb
440
513
  - spec/lib/reveal-ck/markdown/slide_markdown_spec.rb
441
514
  - spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb
@@ -476,6 +549,7 @@ test_files:
476
549
  - features/data/images/ruby100.png
477
550
  - features/step_definitions/file_management_steps.rb
478
551
  - features/step_definitions/html_match_steps.rb
552
+ - features/step_definitions/serve_steps.rb
479
553
  - features/support/env.rb
480
554
  - features/support/file_management.rb
481
555
  - spec/data/builders/index_html/slides.html
@@ -505,6 +579,13 @@ test_files:
505
579
  - spec/lib/reveal-ck/builders/reveal_js_files_spec.rb
506
580
  - spec/lib/reveal-ck/builders/slides_builder_spec.rb
507
581
  - spec/lib/reveal-ck/builders/user_files_spec.rb
582
+ - spec/lib/reveal-ck/commands/generate_spec.rb
583
+ - spec/lib/reveal-ck/commands/listen_to_rebuild_slides_spec.rb
584
+ - spec/lib/reveal-ck/commands/listen_to_reload_browser_spec.rb
585
+ - spec/lib/reveal-ck/commands/print_banner_spec.rb
586
+ - spec/lib/reveal-ck/commands/serve_spec.rb
587
+ - spec/lib/reveal-ck/commands/serve_ui_spec.rb
588
+ - spec/lib/reveal-ck/commands/start_web_server_spec.rb
508
589
  - spec/lib/reveal-ck/config_spec.rb
509
590
  - spec/lib/reveal-ck/markdown/slide_markdown_spec.rb
510
591
  - spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb