class Epuber::Command::FromFile

Public Class Methods

new(argv) click to toggle source

@param [CLAide::ARGV] argv

Calls superclass method Epuber::Command::new
# File lib/epuber/command/from_file.rb, line 16
def initialize(argv)
  @filepath = argv.arguments!.first

  super(argv)
end

Public Instance Methods

run() click to toggle source
Calls superclass method Epuber::Command::run
# File lib/epuber/command/from_file.rb, line 32
def run
  super

  FromFileExecutor.new(@filepath).run
end
validate!() click to toggle source
Calls superclass method
# File lib/epuber/command/from_file.rb, line 22
def validate!
  super

  help! 'You must specify path to existing EPUB file' if @filepath.nil?
  help! "File #{@filepath} doesn't exists" unless File.exist?(@filepath)

  existing = Dir.glob('*.bookspec')
  help! "Can't reinit this folder, #{existing.first} already exists." unless existing.empty?
end