lib/salesforcedeploytool/cli.rb in salesforce-deploy-tool-2.1.1 vs lib/salesforcedeploytool/cli.rb in salesforce-deploy-tool-3.1.0
- old
+ new
@@ -77,20 +77,23 @@
c.option "--exclude CSV_LIST", "-x CSV_LIST", "a CSV list of metadata to exclude when creating destructiveChange.xml"
c.option "--append", "Disable destructive change and do an append deploy"
c.option "--build_number NUMBER","Record build number on version file"
c.option "--run-all-tests", "-T", "Deploy and test"
c.option "--run-tests CSV_LIST", "-r CSV_LIST", "a CSV list of individual classes to run tests"
+ c.option "--check-only", "-c", "Check only, don't deploy"
+ c.option "--include CSV_LIST", "-i CSV_LIST", "A CSV list of metadata type to include when creating destructiveChange.xml"
c.action do |args, options|
# short flag mapping
+ options.check_only = true if options.c
options.run_all_tests = true if options.T
options.run_tests = options.r if options.r
options.exclude = options.x if options.x
options.sandbox = options.s if options.s
+ options.include = options.i if options.i
# Parameter validation:
-
if options.run_all_tests and options.run_tests
puts "warning: --run-tests is ignored as --test has been declared "
end
if options.sandbox.nil? and config[:sandbox].nil?
@@ -117,10 +120,11 @@
# Pull changes from sandbox to temporary directory:
config_tmp = config.clone
config_tmp[:git_dir] = File.join(config[:tmp_dir],'repo_copy')
FileUtils.cp_r config[:git_dir],config_tmp[:git_dir]
sfdt_tmp = SalesforceDeployTool::App.new config_tmp
+ sfdt_tmp.clean_git_dir
print "INFO: Pulling changes from #{config[:sandbox]} using url #{config[:salesforce_url]} to temporary directory to generate destructiveChanges.xml "
print( options.debug.nil? ? "" : "\n\n" )
sfdt_tmp.pull
# Create destructiveChanges.xml
@@ -128,10 +132,11 @@
dc_gen = Dcgen::App.new
dc_gen.master = full_src_dir
dc_gen.destination = File.join(config_tmp[:git_dir],config_tmp[:src_dir])
dc_gen.output = destructive_change_file
dc_gen.exclude = options.exclude.split(',') unless options.exclude.nil?
+ dc_gen.include = options.include.split(',') unless options.include.nil?
dc_gen.verbose = false if not options.debug
dc_gen.generate_destructive_changes
end
@@ -142,9 +147,12 @@
sfdt.set_version
# Enable test if option enabled
sfdt.run_all_tests = options.run_all_tests.nil? ? false : true
sfdt.run_tests = options.run_tests.split(',') unless options.run_tests.nil?
+
+ # Check only option:
+ sfdt.check_only = options.check_only
# Push
print( options.run_all_tests.nil? && options.run_tests.nil? ? "INFO: Deploying code to #{config[:sandbox]}: ": "INFO: Deploying and Testing code to #{config[:sandbox]}: " )
print( options.debug.nil? ? "" : "\n\n" )
sfdt.push