Module: Softcover::Commands::Deployment

Extended by:
Deployment
Includes:
Utils
Included in:
Deployment
Defined in:
lib/softcover/commands/deployment.rb

Constant Summary

Constants included from Utils

Utils::UNITS

Instance Method Summary collapse

Methods included from Utils

#add_highlight_class!, #article?, #as_size, #book_file_lines, #chapter_label, #commands, #current_book, #dependency_filename, #digest, #executable, #execute, #filename_or_default, #first_path, #get_filename, #html_extension, #in_book_directory?, #language_labels, #linux?, #logged_in?, #master_content, #master_filename, #master_latex_header, #mkdir, #non_comment_lines, #os_x?, #path, #polytexnic_html, #raw_lines, #reset_current_book!, #rm, #rm_r, #silence, #silence_stream, #source, #template_dir, #tmpify, #unpublish_slug, #write_master_latex_file, #write_pygments_file

Instance Method Details

#custom_commandsObject

Returns custom commands (if any).



29
30
31
# File 'lib/softcover/commands/deployment.rb', line 29

def custom_commands
  commands(File.readlines(deploy_config).map(&:strip))
end

#default_commandsObject

Returns the default commands.



19
20
21
22
23
24
25
26
# File 'lib/softcover/commands/deployment.rb', line 19

def default_commands
  if article?
    commands(['softcover build:all', 'softcover publish'])
  else
    commands(['softcover build:all', 'softcover build:preview',
              'softcover publish'])
  end
end

#deploy!Object

Deploy a book by building and publishing it. The deploy steps can be customized using ‘.softcover-publish` in the book project’s home directory.



10
11
12
13
14
15
16
# File 'lib/softcover/commands/deployment.rb', line 10

def deploy!
  if File.exist?('.softcover-deploy') && !custom_commands.empty?
    execute custom_commands
  else
    execute default_commands
  end
end

#deploy_configObject

Returns the filename for configuring ‘softcover deploy`.



34
35
36
# File 'lib/softcover/commands/deployment.rb', line 34

def deploy_config
  '.softcover-deploy'
end