lib/nanoc/cli/commands/deploy.rb in nanoc-3.4.3 vs lib/nanoc/cli/commands/deploy.rb in nanoc-3.5.0b1
- old
+ new
@@ -7,19 +7,20 @@
deployer_names = deployers.keys.sort_by { |k| k.to_s }
usage 'deploy [options]'
summary 'deploy the compiled site'
description <<-EOS
-Deploys the compiled site. The compiled site contents in the output directory will be uploaded to the destination, which is specified using the -t/--target option.
+Deploys the compiled site. The compiled site contents in the output directory will be uploaded to the destination, which is specified using the `--target` option.
Available deployers: #{deployer_names.join(', ')}
EOS
-option :t, :target, 'specify the location to deploy to', :argument => :required
-flag :L, :list, 'list available locations to deploy to'
-option :n, :'dry-run', 'show what would be deployed'
+option :t, :target, 'specify the location to deploy to (default: `default`)', :argument => :required
+flag :C, :'no-check', 'do not run the issue checks marked for deployment'
+flag :L, :list, 'list available locations to deploy to'
+option :n, :'dry-run', 'show what would be deployed'
module Nanoc::CLI::Commands
class Deploy < ::Nanoc::CLI::CommandRunner
@@ -53,9 +54,20 @@
'rsync'
end
deployer_class = Nanoc::Extra::Deployer.named(name)
if deployer_class.nil?
raise Nanoc::Errors::GenericTrivial, "The specified deploy target has an unrecognised kind “#{name}” (expected one of #{names.join(', ')})."
+ end
+
+ # Check
+ unless options[:'no-check']
+ puts "Running issue checks…"
+ ok = Nanoc::Extra::Checking::Runner.new(site).run_for_deploy
+ if !ok
+ puts "Issues found, deploy aborted."
+ return
+ end
+ puts "No issues found. Deploying!"
end
# Run
deployer = deployer_class.new(
site.config[:output_dir],