lib/r10k/cli/deploy.rb in r10k-3.16.0 vs lib/r10k/cli/deploy.rb in r10k-4.0.0.pre

- old
+ new

@@ -8,10 +8,23 @@ require 'cri' module R10K::CLI module Deploy + + class TransformExcludeSpec + def call(input) + # To be backward compatible with the 3.x flag version of this setting, + # r10k allows this flag to have an optional argument. When no argument + # is supplied, cri defaults to setting the class to true, so we check + # for TrueClass here as well as "true". + return true if input == true || input == 'true' + return false if input == 'false' + raise ArgumentError + end + end + def self.command @cmd ||= Cri::Command.define do name 'deploy' usage 'deploy <subcommand>' summary 'Puppet dynamic environment deployment' @@ -22,10 +35,11 @@ DESCRIPTION option nil, :cachedir, 'Specify a cachedir, overriding the value in config', argument: :required flag nil, :'no-force', 'Prevent the overwriting of local module modifications' flag nil, :'generate-types', 'Run `puppet generate types` after updating an environment' - flag nil, :'exclude-spec', 'Exclude the module\'s spec dir from deployment' + option nil, :'exclude-spec', 'Exclude the module\'s spec dir for deployment', argument: :optional, + transform: TransformExcludeSpec.new option nil, :'puppet-path', 'Path to puppet executable', argument: :required do |value, cmd| unless File.executable? value $stderr.puts "The specified puppet executable #{value} is not executable." puts cmd.help exit 1