Class: RevealCK::Commands::Serve

Inherits:
Object
  • Object
show all
Includes:
Retrieve
Defined in:
lib/reveal-ck/commands/serve.rb

Overview

This Command is responsible for implementing the idea behind “reveal-ck serve.”

This includes taking an action and managing stdout

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Retrieve

included, #retrieve

Constructor Details

#initialize(args) ⇒ Serve

Returns a new instance of Serve.



12
13
14
15
16
17
18
19
20
21
# File 'lib/reveal-ck/commands/serve.rb', line 12

def initialize(args)
  @doc_root    = retrieve(:doc_root, args)
  @port        = retrieve(:port, args)
  @host        = retrieve(:host, args)
  @slides_file = retrieve(:slides_file, args)
  @gem_dir     = retrieve(:gem_dir, args)
  @output_dir  = retrieve(:output_dir, args)
  @user_dir    = retrieve(:user_dir, args)
  @ui          = ServeUI.new
end

Instance Attribute Details

#doc_rootObject (readonly)

Returns the value of attribute doc_root.



9
10
11
# File 'lib/reveal-ck/commands/serve.rb', line 9

def doc_root
  @doc_root
end

#gem_dirObject (readonly)

Returns the value of attribute gem_dir.



10
11
12
# File 'lib/reveal-ck/commands/serve.rb', line 10

def gem_dir
  @gem_dir
end

#hostObject (readonly)

Returns the value of attribute host.



9
10
11
# File 'lib/reveal-ck/commands/serve.rb', line 9

def host
  @host
end

#output_dirObject (readonly)

Returns the value of attribute output_dir.



10
11
12
# File 'lib/reveal-ck/commands/serve.rb', line 10

def output_dir
  @output_dir
end

#portObject (readonly)

Returns the value of attribute port.



9
10
11
# File 'lib/reveal-ck/commands/serve.rb', line 9

def port
  @port
end

#slides_fileObject (readonly)

Returns the value of attribute slides_file.



10
11
12
# File 'lib/reveal-ck/commands/serve.rb', line 10

def slides_file
  @slides_file
end

#uiObject (readonly)

Returns the value of attribute ui.



11
12
13
# File 'lib/reveal-ck/commands/serve.rb', line 11

def ui
  @ui
end

#user_dirObject (readonly)

Returns the value of attribute user_dir.



10
11
12
# File 'lib/reveal-ck/commands/serve.rb', line 10

def user_dir
  @user_dir
end

Instance Method Details

#rebuild_slidesObject



30
31
32
33
34
# File 'lib/reveal-ck/commands/serve.rb', line 30

def rebuild_slides
  RevealCK::Commands::Generate.new(rebuild_options).run
rescue => e
  ui.problem('Failed to Generate Slides:', e)
end

#runObject



23
24
25
26
27
28
# File 'lib/reveal-ck/commands/serve.rb', line 23

def run
  print_banner
  listen_to_reload
  listen_to_rebuild
  start_web_server
end