Class: Epuber::Command::FromFile
- Inherits:
-
Epuber::Command
- Object
- CLAide::Command
- Epuber::Command
- Epuber::Command::FromFile
- Defined in:
- lib/epuber/command/from_file.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ FromFile
constructor
A new instance of FromFile.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Epuber::Command
Constructor Details
#initialize(argv) ⇒ FromFile
Returns a new instance of FromFile.
16 17 18 19 20 |
# File 'lib/epuber/command/from_file.rb', line 16 def initialize(argv) @filepath = argv.arguments!.first super(argv) end |
Instance Method Details
#run ⇒ Object
32 33 34 35 36 |
# File 'lib/epuber/command/from_file.rb', line 32 def run super FromFileExecutor.new(@filepath).run end |
#validate! ⇒ Object
22 23 24 25 26 27 28 29 30 |
# 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 |