class Epuber::Command

Attributes

debug_steps_times[RW]

Public Class Methods

run(argv = []) click to toggle source
Calls superclass method
# File lib/epuber/command.rb, line 26
def self.run(argv = [])
  begin
    UI.current_command = self
    super
    UI.current_command = nil

  rescue Interrupt
    UI.error('[!] Cancelled')
  rescue => e
    UI.error!(e)

    UI.current_command = nil
  end
end

Public Instance Methods

run() click to toggle source
# File lib/epuber/command.rb, line 46
def run
  UI.current_command = self
end
validate!() click to toggle source
Calls superclass method
# File lib/epuber/command.rb, line 41
def validate!
  super
  UI.current_command = self
end

Protected Instance Methods

book() click to toggle source

@return [Epuber::Book::Book]

# File lib/epuber/command.rb, line 58
def book
  Config.instance.bookspec
end
pre_build_checks() click to toggle source
# File lib/epuber/command.rb, line 78
def pre_build_checks
  Config.instance.warn_for_outdated_versions!

  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
end
verify_one_bookspec_exists!() click to toggle source

@return [void]

@raise PlainInformative if no .bookspec file don't exists or there are too many

# File lib/epuber/command.rb, line 66
def verify_one_bookspec_exists!
  bookspec_files = Config.instance.find_all_bookspecs
  raise PlainInformative, "No `.bookspec' found in the project directory." if bookspec_files.empty?
  raise PlainInformative, "Multiple `.bookspec' found in current directory" if bookspec_files.count > 1
end
write_lockfile() click to toggle source
# File lib/epuber/command.rb, line 72
def write_lockfile
  unless Epuber::Config.test?
    Epuber::Config.instance.save_lockfile
  end
end