lib/nanoc/cli/commands/deploy.rb in nanoc-3.3.7 vs lib/nanoc/cli/commands/deploy.rb in nanoc-3.4.0

- old
+ new

@@ -26,12 +26,11 @@ def run require_site # Get config deploy_configs = site.config.fetch(:deploy) do - $stderr.puts "The site configuration has no deploy configuration." - exit 1 + raise Nanoc::Errors::GenericTrivial, "The site configuration has no deploy configuration." end # List if options[:list] puts "Available deployment configurations:" @@ -40,30 +39,23 @@ end return end # Get target - target = options.fetch(:target) do - $stderr.puts "The deploy command requires a --target option." - exit 1 - end - target = target.to_sym + target = options.fetch(:target, :default).to_sym config = deploy_configs.fetch(target) do - $stderr.puts "The site configuration has no deploy configuration for #{target}." - exit 1 + raise Nanoc::Errors::GenericTrivial, "The site configuration has no deploy configuration for #{target}." end # Get deployer names = Nanoc::Extra::Deployer.all.keys name = config.fetch(:kind) do $stderr.puts "Warning: The specified deploy target does not have a kind attribute. Assuming rsync." 'rsync' end deployer_class = Nanoc::Extra::Deployer.named(name) if deployer_class.nil? - $stderr.puts "The specified deploy target has an unrecognised kind (#{name})." - $stderr.puts "(expected one of #{names.join(', ')})" - exit 1 + raise Nanoc::Errors::GenericTrivial, "The specified deploy target has an unrecognised kind “#{name}” (expected one of #{names.join(', ')})." end # Run deployer = deployer_class.new( site.config[:output_dir],