bin/sf in salesforce-deploy-tool-0.8.1 vs bin/sf in salesforce-deploy-tool-0.8.2
- old
+ new
@@ -121,10 +121,18 @@
config[:test] = options.test.nil? ? false : true
# Initialize
sfdt = SalesforceDeployTool::App.new config
+ # Push the code without destructiveChanges.xml. This step is allways necessary
+ # even when it is a destructive change. This is because if a class is referencing
+ # a field to be deleted, then we first need to push the class to remove that
+ # reference and only then SF will allow us to remove the field on the second
+ # push
+ sfdt.build_number = options.build_number if not options.build_number.nil?
+ sfdt.push
+
if ! options.append
# Pull changes from sandbox to temporary directory:
config_tmp = config.clone
config_tmp[:git_dir] = config_tmp[:tmp_dir]
FileUtils.rm_rf config_tmp[:git_dir] if File.exists? config_tmp[:git_dir]
@@ -145,15 +153,13 @@
stringio = StringIO.new
stdout_tmp = $stdout
$stdout = stringio unless options.debug
dc_gen.generate_destructive_changes
$stdout = stdout_tmp
+
+ # Destructive push
+ sfdt.push
end
-
- # Finally push:
- sfdt.build_number = options.build_number if not options.build_number.nil?
- sfdt.push
-
end
end
command :sandbox do |c|
c.syntax = 'sf sandbox SANDBOX_NAME'