Sha256: ac6f53c7d6f4f891f5268e9744fc8fb533a589e632ee0ef027f894d44ab12270
Contents?: true
Size: 946 Bytes
Versions: 9
Compression:
Stored size: 946 Bytes
Contents
# frozen_string_literal: true require_relative '../command' require_relative '../from_file/from_file_executor' module Epuber class Command class FromFile < Command self.summary = 'Initialize current folder to use it as Epuber project from existing EPUB file' self.arguments = [ CLAide::Argument.new('EPUB_FILE', true), ] # @param [CLAide::ARGV] argv # def initialize(argv) @filepath = argv.arguments!.first super(argv) end 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 def run super FromFileExecutor.new(@filepath).run end end end end
Version data entries
9 entries across 9 versions & 1 rubygems