lib/rpub/commands/clean.rb in rpub-0.4.0 vs lib/rpub/commands/clean.rb in rpub-0.5.0
- old
+ new
@@ -1,55 +1,10 @@
module Rpub
module Commands
- class Clean < Base
- include CompilationHelpers
-
- identifier 'clean'
-
- def invoke
- super
- remove create_book.filename
- remove 'preview.html'
- end
-
- private
-
- def parser
- OptionParser.new do |opts|
- opts.banner = <<-EOS
-Usage: rpub clean [-d]'
-
-Clean up all generated files, such as the standard generated .epub
-file, package files and preview files.
-
-Options:
-EOS
-
- opts.separator ''
-
- opts.on '-d', '--dry-run', 'Dry-run: only list files to be removed' do
- @dry_run = true
- end
-
- opts.separator ''
- opts.separator 'Generic options:'
- opts.separator ''
-
- opts.on_tail '-h', '--help', 'Display this message' do
- puts opts
- exit
- end
- end
- end
-
- def remove(filename)
- if File.exist?(filename)
- unless @dry_run
- File.unlink(filename)
- else
- puts filename
- end
- end
+ class Clean < Command
+ def run
+ source.remove book.filename, options.dryrun
+ source.remove 'preview.html', options.dryrun
end
end
end
end