class Epuber::Command
Public Class Methods
Source
# File lib/epuber/command.rb, line 35 def initialize(argv) super UI.logger.verbose = verbose? end
Calls superclass method
Source
# File lib/epuber/command.rb, line 27 def self.run(argv = []) super rescue Interrupt UI.error('[!] Cancelled') rescue StandardError => e UI.error!(e) end
Calls superclass method
Public Instance Methods
Protected Instance Methods
Source
# File lib/epuber/command.rb, line 47 def book Config.instance.bookspec end
@return [Epuber::Book::Book]
Source
# File lib/epuber/command.rb, line 74 def pre_build_checks Config.instance.warn_for_outdated_versions! # remove build caches if we are using different version of Epuber or Bade if !Config.instance.same_version_as_last_run? && File.exist?(Config.instance.working_path) UI.warning('Using different version of Epuber or Bade, removing all build caches') Config.instance.remove_build_caches end # ensure we are in the project directory if Dir.pwd != Config.instance.project_path UI.debug("Changing directory to project directory: #{Config.instance.project_path}") Dir.chdir(Config.instance.project_path) end end
Source
# File lib/epuber/command.rb, line 55 def verify_one_bookspec_exists! project_path = Config.instance.project_path bookspec_files = Config.find_bookspec_files(project_path) if bookspec_files.empty? raise PlainInformative, "No `.bookspec' found in the project directory (or in any parent folders)." end if bookspec_files.count > 1 raise PlainInformative, "Multiple `.bookspec' found in directory (directory: #{project_path})" end end
@return [void]
@raise PlainInformative
if no .bookspec file don’t exists or there are too many
Source
# File lib/epuber/command.rb, line 68 def write_lockfile return if Epuber::Config.test? Epuber::Config.instance.save_lockfile end