Class: Snaptoken::Commands::Doc

Inherits:
BaseCommand show all
Defined in:
lib/snaptoken/commands/doc.rb

Defined Under Namespace

Classes: HTMLRouge

Constant Summary

Constants inherited from BaseCommand

BaseCommand::ERROR_MSG

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

#current_or_latest_step, #current_step, inherited, #initialize, #latest_step, #needs!, #select_step, #step_path, #steps

Constructor Details

This class inherits a constructor from Snaptoken::Commands::BaseCommand

Class Method Details

.nameObject



4
5
6
# File 'lib/snaptoken/commands/doc.rb', line 4

def self.name
  "doc"
end

.summaryObject



8
9
10
# File 'lib/snaptoken/commands/doc.rb', line 8

def self.summary
  "Renders files in doc folder into an HTML book"
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/snaptoken/commands/doc.rb', line 12

def run
  needs! :config, :steps_folder, :steps, :doc

  FileUtils.cd(File.join(@config[:path], "doc")) do
    FileUtils.rm_rf("html_out")
    FileUtils.rm_rf("html_offline")
    FileUtils.mkdir("html_out")
    FileUtils.mkdir("html_offline")

    copy_static_files
    write_css
    write_html_files(prerender_diffs)
    create_archive if @args.include? "-z"
  end
end