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!, #as_size, #book_file_lines, #chapter_label, #commands, #current_book, #dependency_filename, #digest, #executable, #execute, #in_book_directory?, #language_labels, #linux?, #logged_in?, #master_content, #master_filename, #master_latex_header, #mkdir, #non_comment_lines, #os_x?, #path, #raw_lines, #reset_current_book!, #rm, #silence, #source, #tmpify, #unpublish_slug, #write_master_latex_file, #write_pygments_file

Instance Method Details

#custom_commandsObject

Returns custom commands (if any).



25
26
27
# File 'lib/softcover/commands/deployment.rb', line 25

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

#default_commandsObject

Returns the default commands.



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

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

#deploy!Object

Deploy a book by building and publishing it. The deploy steps can be customized using ‘.poly-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`.



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

def deploy_config
  '.softcover-deploy'
end