lib/softcover/commands/publisher.rb in softcover-1.0.beta1 vs lib/softcover/commands/publisher.rb in softcover-1.0.beta2
- old
+ new
@@ -5,11 +5,11 @@
extend self
def publish!(options={})
return false unless current_book
- if current_book.create_or_update
+ if current_book.create_or_update(options)
require 'ruby-progressbar'
require 'curb'
unless options[:quiet] || options[:silent]
puts "Uploading #{current_book.uploader.file_count} files " \
"(#{as_size current_book.uploader.total_size}):"
@@ -45,46 +45,46 @@
@watch = options[:watch]
if options[:daemon]
pid = fork do
- run_publish_media
+ run_publish_media(options)
end
puts "Daemonized, pid: #{pid}"
else
- run_publish_media
+ run_publish_media(options)
end
current_book
end
- def run_publish_media
+ def run_publish_media(options={})
if @watch
puts "Watching..."
Signal.trap("TERM") do
puts "SIGTERM received."
exit_with_message
end
begin
loop do
- process_media
+ process_media(options)
sleep 1
end
rescue Interrupt
puts " Interrupt Received."
exit_with_message
end
else
- process_media
+ process_media(options)
exit_with_message
end
end
- def process_media
- current_book.process_media
+ def process_media(options={})
+ current_book.process_media(options)
end
def exit_with_message
number = current_book.processed_media.size
dir = number == 1 ? "directory" : "directories"