lib/salesforcedeploytool/app.rb in salesforce-deploy-tool-3.2.0 vs lib/salesforcedeploytool/app.rb in salesforce-deploy-tool-3.3.1

- old
+ new

@@ -100,23 +100,20 @@ def pull # Parameter validation raise "package.xml not found under #{@full_src_dir}" if !File.exists? File.join(@full_src_dir,'package.xml') - renderer = ERB.new(@buildxml_erb, nil,'%<>-') - File.open('build.xml','w') {|f| f.write renderer.result(binding) } - env_vars = "" env_vars += " SF_SRC_DIR=" + @full_src_dir env_vars += " SF_USERNAME=" + @username env_vars += " SF_PASSWORD=" + @password env_vars += " SF_SERVERURL=" + @server_url - cmd = " ant" - cmd += " -lib #{@libant}" if @libant - cmd += " retrieveCode" + ant_cmd = " ant" + ant_cmd += " -lib #{@libant}" if @libant + target = " retrieveCode" - full_cmd = env_vars + cmd + full_cmd = env_vars + ant_cmd + target exec_options = { :stderr => @debug, :stdout => @debug, :spinner => ! @debug, @@ -127,11 +124,13 @@ if @debug exec_options[:okmsg] = nil exec_options[:failmsg] = nil end - # Pull the code + # Generate build.xml and run command + renderer = ERB.new(@buildxml_erb, nil,'%<>-') + File.open('build.xml','w') {|f| f.write renderer.result(binding) } exit_code = myexec full_cmd, exec_options # Delete files to be ignored: @deploy_ignore_files.each do |file| FileUtils.rm file if File.exists? file @@ -144,20 +143,10 @@ def push # Parameter validation raise "package.xml not found under #{@full_src_dir}" if !File.exists? File.join(@full_src_dir,'package.xml') - renderer = ERB.new(@buildxml_erb, nil,'%<>-') - File.open('build.xml','w') {|f| f.write renderer.result(binding) } - - # Set env variables to run ant - env_vars = "" - env_vars += " SF_SRC_DIR=" + @full_src_dir - env_vars += " SF_USERNAME=" + @username - env_vars += " SF_PASSWORD=" + @password - env_vars += " SF_SERVERURL=" + @server_url - # myexec options exec_options = { :stderr => @debug, :stdout => @debug, :spinner => ! @debug, @@ -168,33 +157,45 @@ if @debug exec_options[:okmsg] = nil exec_options[:failmsg] = nil end + # Set env variables to run ant + env_vars = "" + env_vars += " SF_SRC_DIR=" + @full_src_dir + env_vars += " SF_USERNAME=" + @username + env_vars += " SF_PASSWORD=" + @password + env_vars += " SF_SERVERURL=" + @server_url + + # Command ant_cmd = " ant" ant_cmd += " -lib #{@libant}" if @libant + + # Target if @run_all_tests - cmd = " deployAndTestCode" + target = " deployAndTestCode" else if ! @run_tests.empty? - cmd = " deployAndRunSpecifiedTests" + target = " deployAndRunSpecifiedTests" else - cmd = " deployCode" + target = " deployCode" end end if @check_only - cmd = " checkOnlyCode" + target = target.gsub('deploy','check') end - full_cmd = env_vars + ant_cmd + cmd + full_cmd = env_vars + ant_cmd + target # Delete files to be ignored: @deploy_ignore_files.each do |file| FileUtils.rm file if File.exists? file end - # Push the code + # Generate build.xml and run command + renderer = ERB.new(@buildxml_erb, nil,'%<>-') + File.open('build.xml','w') {|f| f.write renderer.result(binding) } exit_code = myexec full_cmd, exec_options # exit with exit_code exit exit_code if exit_code != 0