salesforce-deploy-tool 3.2.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 564089e30d21649d7dd0d313b63b09c6f8431c73
4
- data.tar.gz: e2422efa9dd61c3ee7449a2aef97f0e3ea5ebbed
3
+ metadata.gz: 46b7b03cb5230e39c5e43b8abe978f495eb9203a
4
+ data.tar.gz: 6477f6b74bb04a2cad94faa32b4d873042959d76
5
5
  SHA512:
6
- metadata.gz: 75f26823c0782c45d5e14946d9329d67d26fe91ade750e53c498c0f72322da8aa35431cf478941d95a62d63c879d7e270b1cbbe0d3e4198b8a4f2648de668654
7
- data.tar.gz: e77174b0e7782992c9bae765ac69099db86e8b50903c23501b875d22725f5ca208718c9f2c9a30b411a20bf2f4f00d60aca3b43dd6c19ba824321d0a3cb41f0b
6
+ metadata.gz: 120c50b4c70e78e777f5b39a220ccf411fbec803d5228ebd1eed012dbc69e84946f8b27d6005534e2ddaa673f0bff1be822fcdf9be5747ef1a1ab46c291805c7
7
+ data.tar.gz: a8276c70f372a0b692028593e2bb3f5692cafb07afbae8d7ebd39cb1b856f9cd34057da8bf59c539a6a97016351f4aeb6f111640a6a8ebf6b98ed6566f1e31d7
data/bin/sf CHANGED
@@ -65,14 +65,19 @@ abort "Config error: username not found in #{GLOBAL_CONFIG_FILE} or through SFDT
65
65
  abort "Config error: password not found in #{GLOBAL_CONFIG_FILE} or through SFDT_PASSWORD" \
66
66
  if config[:password].nil? && !['config','-v'].include?(ARGV.first)
67
67
 
68
- # Create a temporary directory
69
- config[:tmp_dir] = Dir.mktmpdir 'sfdt-'
68
+ # Create a temporary directory if SFDT_TMP_DIR is set, use that and don't delete it
69
+ # This is to facilitate testinig and inspecting build.xml file
70
+ if !ENV['SFDT_TMP_DIR'].nil?
71
+ FileUtils.rm_rf ENV['SFDT_TMP_DIR']
72
+ FileUtils.mkdir ENV['SFDT_TMP_DIR']
73
+ end
74
+ config[:tmp_dir] = ENV['SFDT_TMP_DIR'] || Dir.mktmpdir('sfdt-')
70
75
 
71
- SalesforceDeployTool::CLI.new.run config
72
76
  begin
77
+ SalesforceDeployTool::CLI.new.run config
73
78
  rescue => e
74
79
  puts "ERROR: #{e}"
75
80
  exit 1
76
81
  ensure
77
- FileUtils.rm_rf config[:tmp_dir] if Dir.exists? config[:tmp_dir]
82
+ FileUtils.rm_rf config[:tmp_dir] if Dir.exists? config[:tmp_dir] unless ENV['SFDT_TMP_DIR']
78
83
  end
@@ -7,6 +7,9 @@ Feature: Pull code from salesforce
7
7
  Scenario: Retrieve code from the default sandbox
8
8
  When I run `sf pull`
9
9
  Then the exit status should be 0
10
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
11
+ And the file "/tmp/sfdt-test/build.xml" should match /retrieveTarget/
12
+ And the file "/tmp/sfdt-test/build.xml" should match /unpackaged/
10
13
  And the output should match:
11
14
  """
12
15
  ^INFO: Pulling changes from testEnv using url https://test.salesforce.com.*OK
@@ -15,6 +18,7 @@ Feature: Pull code from salesforce
15
18
  Scenario: Retrieve code from a specific sandbox
16
19
  When I run `sf pull -s testEnvAlt`
17
20
  Then the exit status should be 0
21
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
18
22
  And the output should match:
19
23
  """
20
24
  ^INFO: Pulling changes from testEnvAlt using url https://test.salesforce.com.*OK
@@ -26,6 +30,7 @@ Feature: Pull code from salesforce
26
30
  | SFDT_SALESFORCE_URL | https://invalid_url.salesforce.com |
27
31
  When I run `sf pull`
28
32
  Then the exit status should be 1
33
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
29
34
  And the output should match:
30
35
  """
31
36
  ^INFO: Pulling changes from testEnv using url https://invalid_url.*
@@ -34,6 +39,7 @@ Feature: Pull code from salesforce
34
39
  Scenario: Retrieve code from a production
35
40
  When I run `sf pull -s prod`
36
41
  Then the exit status should be 0
42
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
37
43
  And the output should match:
38
44
  """
39
45
  ^INFO: Pulling changes from prod using url https://login.salesforce.com.*OK$
@@ -42,6 +48,7 @@ Feature: Pull code from salesforce
42
48
  Scenario: Retrieve code from the default sandbox with debug output
43
49
  When I run `sf pull -d`
44
50
  Then the exit status should be 0
51
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
45
52
  And the output should contain "BUILD SUCCESSFUL"
46
53
  And the output should match:
47
54
  """
@@ -51,6 +58,7 @@ Feature: Pull code from salesforce
51
58
  Scenario: Retrieve code from a specific sandbox with debug output
52
59
  When I run `sf pull -s testEnv -d`
53
60
  Then the exit status should be 0
61
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
54
62
  And the output should contain "BUILD SUCCESSFUL"
55
63
  And the output should match:
56
64
  """
@@ -61,6 +69,7 @@ Feature: Pull code from salesforce
61
69
  Scenario: Retrieve code from the default sandbox with debug output and specifying ant library path
62
70
  When I run `sf pull -d -l lib/ant34.jar`
63
71
  Then the exit status should be 0
72
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
64
73
  And the output should match:
65
74
  """
66
75
  ^INFO: Pulling changes from testEnv using url https://test.salesforce.com $
@@ -78,6 +87,7 @@ Feature: Pull code from salesforce
78
87
  | SFDT_ANT_LIB | lib/ant34.jar |
79
88
  When I run `sf pull -d`
80
89
  Then the exit status should be 0
90
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:retrieve/
81
91
  And the output should match:
82
92
  """
83
93
  ^INFO: Pulling changes from testEnv using url https://test.salesforce.com $
@@ -8,6 +8,7 @@ Feature: Push code to salesforce
8
8
  When I run `sf push`
9
9
  Then the exit status should be 0
10
10
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
11
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
11
12
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
12
13
  And the output should match:
13
14
  """
@@ -20,6 +21,7 @@ Feature: Push code to salesforce
20
21
  When I run `sf push -s testEnvAlt`
21
22
  Then the exit status should be 0
22
23
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
24
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
23
25
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
24
26
  And the output should match:
25
27
  """
@@ -31,6 +33,7 @@ Feature: Push code to salesforce
31
33
  Scenario: Push code to production should use the url login.salesorce.com
32
34
  When I run `sf push -s prod`
33
35
  Then the exit status should be 0
36
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
34
37
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
35
38
  And the output should match:
36
39
  """
@@ -53,6 +56,8 @@ Feature: Push code to salesforce
53
56
  Scenario: Push code to a sandbox and trigger all the tests
54
57
  When I run `sf push -T`
55
58
  Then the exit status should be 0
59
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
60
+ And the file "/tmp/sfdt-test/build.xml" should match /runAllTests.*true/
56
61
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
57
62
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
58
63
  And the output should match:
@@ -64,6 +69,8 @@ Feature: Push code to salesforce
64
69
  Scenario: Push code to a sandbox and trigger all the tests in debug mode
65
70
  When I run `sf push -T -d`
66
71
  Then the exit status should be 0
72
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
73
+ And the file "/tmp/sfdt-test/build.xml" should match /runAllTests.*true/
67
74
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
68
75
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
69
76
  And the output should match /^.* testEnv .*BUILD SUCCESSFUL.*Diff between.*Changes detected.*File generated.*Running Test:.*DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL.*$/
@@ -71,6 +78,7 @@ Feature: Push code to salesforce
71
78
  Scenario: Push code to a sandbox in append mode
72
79
  When I run `sf push -a`
73
80
  Then the exit status should be 0
81
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
74
82
  And a file named "repo/salesforce/src/destructiveChanges.xml" should not exist
75
83
  And the output should match:
76
84
  """
@@ -80,6 +88,8 @@ Feature: Push code to salesforce
80
88
  Scenario: Push code to a sandbox in append mode and run all tests
81
89
  When I run `sf push -a -T`
82
90
  Then the exit status should be 0
91
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
92
+ And the file "/tmp/sfdt-test/build.xml" should match /runAllTests.*true/
83
93
  And a file named "repo/salesforce/src/destructiveChanges.xml" should not exist
84
94
  And the output should match:
85
95
  """
@@ -89,6 +99,8 @@ Feature: Push code to salesforce
89
99
  Scenario: Push code to a sandbox in append mode and run all tests and output debug information
90
100
  When I run `sf push -a -T -d`
91
101
  Then the exit status should be 0
102
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
103
+ And the file "/tmp/sfdt-test/build.xml" should match /runAllTests.*true/
92
104
  And a file named "repo/salesforce/src/destructiveChanges.xml" should not exist
93
105
  And the output should match:
94
106
  """
@@ -110,6 +122,7 @@ Feature: Push code to salesforce
110
122
  When I watch "repo/salesforce/src/classes/VersionTest.cls" for changes and copy to "test_file"
111
123
  And I run `sf push --build_number 123456789`
112
124
  Then the exit status should be 0
125
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
113
126
  And the file "test_file" should contain "123456789"
114
127
  And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%BUILD_NUMBER%%"
115
128
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
@@ -131,6 +144,7 @@ Feature: Push code to salesforce
131
144
  And the file "test_file" should contain "aac66ee0d404c124fbcafd32a054664de4fdd3da"
132
145
  And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%COMMIT_HASH%%"
133
146
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
147
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
134
148
  And the output should match:
135
149
  """
136
150
  ^INFO: Pulling changes from testEnv using url https://test.salesforce.com to temporary directory to generate destructiveChanges.xml.*OK$
@@ -162,6 +176,9 @@ Feature: Push code to salesforce
162
176
  When I run `sf push -r individual_test -d`
163
177
  Then the exit status should be 0
164
178
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
179
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
180
+ And the file "/tmp/sfdt-test/build.xml" should match /testLevel.*RunSpecifiedTests/
181
+ And the file "/tmp/sfdt-test/build.xml" should match /runTest/
165
182
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
166
183
  And the output should match:
167
184
  """
@@ -183,6 +200,7 @@ Feature: Push code to salesforce
183
200
  And I run `sf push --build_number 123456789`
184
201
  Then the exit status should be 0
185
202
  And the file "test_file" should contain "123456789"
203
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
186
204
  And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%BUILD_NUMBER%%"
187
205
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
188
206
  And the output should match:
@@ -201,6 +219,7 @@ Feature: Push code to salesforce
201
219
  And I run `sf push`
202
220
  Then the exit status should be 0
203
221
  And the file "test_file" should contain "aac66ee0d404c124fbcafd32a054664de4fdd3da"
222
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
204
223
  And the file "repo/salesforce/src/classes/VersionTest.cls" should contain "%%COMMIT_HASH%%"
205
224
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
206
225
  And the output should match:
@@ -233,6 +252,9 @@ Feature: Push code to salesforce
233
252
  When I run `sf push -r individual_test -d`
234
253
  Then the exit status should be 0
235
254
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
255
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
256
+ And the file "/tmp/sfdt-test/build.xml" should match /testLevel.*RunSpecifiedTests/
257
+ And the file "/tmp/sfdt-test/build.xml" should match /runTest/
236
258
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
237
259
  And the output should match:
238
260
  """
@@ -245,10 +267,31 @@ Feature: Push code to salesforce
245
267
  And the output should match /Running Test: .*/
246
268
  And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
247
269
 
270
+ Scenario: Push code to a sandbox in check only mode using debug and Test
271
+ When I run `sf push -c -d -T`
272
+ Then the exit status should be 0
273
+ And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
274
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
275
+ And the file "/tmp/sfdt-test/build.xml" should match /checkOnly.*true/
276
+ And the file "/tmp/sfdt-test/build.xml" should match /runAllTests.*true/
277
+ And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
278
+ And the output should match:
279
+ """
280
+ ^INFO: Deploying and Testing code to testEnv:.*$
281
+ ^$
282
+ ^Buildfile: .*$
283
+ ^$
284
+ ^checkAndTestCode:$
285
+ """
286
+ And the output should match /Running Test/
287
+ And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
288
+
248
289
  Scenario: Push code to a sandbox in check only mode using debug
249
290
  When I run `sf push -c -d`
250
291
  Then the exit status should be 0
251
292
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
293
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
294
+ And the file "/tmp/sfdt-test/build.xml" should match /checkOnly.*true/
252
295
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
253
296
  And the output should match:
254
297
  """
@@ -256,7 +299,7 @@ Feature: Push code to salesforce
256
299
  ^$
257
300
  ^Buildfile: .*$
258
301
  ^$
259
- ^checkOnlyCode:$
302
+ ^checkCode:$
260
303
  """
261
304
  And the output should match /DEPLOYMENT SUCCEEDED.*BUILD SUCCESSFUL/
262
305
 
@@ -264,6 +307,7 @@ Feature: Push code to salesforce
264
307
  When I run `sf push -e Account.Sort__c -d`
265
308
  Then the exit status should be 0
266
309
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
310
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
267
311
  And the output should match /Pulling.*testEnv.*https:..test.salesforce.com.*destructiveChanges.xml/
268
312
  And the output should match /excluded: Account.Sort__c/
269
313
  And the output should match /INFO: Deploying code to testEnv/
@@ -273,6 +317,7 @@ Feature: Push code to salesforce
273
317
  When I run `sf push -i apexclass -d`
274
318
  Then the exit status should be 0
275
319
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
320
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
276
321
  And the file "repo/salesforce/src/destructiveChanges.xml" should contain "ApexClass"
277
322
  And the file "repo/salesforce/src/destructiveChanges.xml" should not contain "ApexPage"
278
323
  And the output should match /Pulling.*testEnv.*https:..test.salesforce.com.*destructiveChanges.xml/
@@ -284,6 +329,7 @@ Feature: Push code to salesforce
284
329
  When I run `sf push -e NewVersionTest -d`
285
330
  Then the exit status should be 0
286
331
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
332
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
287
333
  And the file "repo/salesforce/src/destructiveChanges.xml" should not contain "ApexClass"
288
334
  And the file "repo/salesforce/src/destructiveChanges.xml" should not contain "NewVersionTest"
289
335
  And the file "repo/salesforce/src/destructiveChanges.xml" should contain "ApexPage"
@@ -300,6 +346,7 @@ Feature: Push code to salesforce
300
346
  When I run `sf push -d`
301
347
  Then the exit status should be 0
302
348
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
349
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
303
350
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
304
351
  And the output should match:
305
352
  """
@@ -316,6 +363,7 @@ Feature: Push code to salesforce
316
363
  When I run `sf push -l lib/ant34.jar -d`
317
364
  Then the exit status should be 0
318
365
  And a file named "repo/salesforce/src/destructiveChanges.xml" should exist
366
+ And the file "/tmp/sfdt-test/build.xml" should match /sf:deploy/
319
367
  And the file "repo/salesforce/src/destructiveChanges.xml" should match /ApexClass|ApexPage/
320
368
  And the output should match:
321
369
  """
@@ -157,7 +157,7 @@ BUILD SUCCESSFUL
157
157
  EOF
158
158
  fi
159
159
  ;;
160
- "deployAndTestCode")
160
+ "deployAndTestCode"|"checkAndTestCode")
161
161
  cat << EOF
162
162
  Buildfile: ${PWD}/build.xml
163
163
 
@@ -213,11 +213,11 @@ ${COMMAND}:
213
213
  BUILD SUCCESSFUL
214
214
  EOF
215
215
  ;;
216
- "checkOnlyCode")
216
+ "checkCode")
217
217
  cat << EOF
218
218
  Buildfile: /home/vagrant/salesforce/build.xml
219
219
 
220
- checkOnlyCode:
220
+ checkCode:
221
221
  [sf:deploy] Request for a deploy submitted successfully.
222
222
  [sf:deploy] Request ID for the current deploy task: 0Afg000000Dwn66CAB
223
223
  [sf:deploy] Waiting for server to finish processing the request...
@@ -9,6 +9,9 @@ ENV["HOME"] = new_home
9
9
  FileUtils.rm_rf new_home if Dir.exists? new_home
10
10
  FileUtils.mkdir new_home
11
11
 
12
+ # Set a temporary dir to inspect build.xml
13
+ ENV["SFDT_TMP_DIR"] = '/tmp/sfdt-test'
14
+
12
15
  # Cucumber / aruba configuration parameters
13
16
  Before do
14
17
  @aruba_timeout_seconds = 300
@@ -102,19 +102,16 @@ module SalesforceDeployTool
102
102
  # Parameter validation
103
103
  raise "package.xml not found under #{@full_src_dir}" if !File.exists? File.join(@full_src_dir,'package.xml')
104
104
 
105
- renderer = ERB.new(@buildxml_erb, nil,'%<>-')
106
- File.open('build.xml','w') {|f| f.write renderer.result(binding) }
107
-
108
105
  env_vars = ""
109
106
  env_vars += " SF_SRC_DIR=" + @full_src_dir
110
107
  env_vars += " SF_USERNAME=" + @username
111
108
  env_vars += " SF_PASSWORD=" + @password
112
109
  env_vars += " SF_SERVERURL=" + @server_url
113
- cmd = " ant"
114
- cmd += " -lib #{@libant}" if @libant
115
- cmd += " retrieveCode"
110
+ ant_cmd = " ant"
111
+ ant_cmd += " -lib #{@libant}" if @libant
112
+ target = " retrieveCode"
116
113
 
117
- full_cmd = env_vars + cmd
114
+ full_cmd = env_vars + ant_cmd + target
118
115
 
119
116
  exec_options = {
120
117
  :stderr => @debug,
@@ -129,7 +126,9 @@ module SalesforceDeployTool
129
126
  exec_options[:failmsg] = nil
130
127
  end
131
128
 
132
- # Pull the code
129
+ # Generate build.xml and run command
130
+ renderer = ERB.new(@buildxml_erb, nil,'%<>-')
131
+ File.open('build.xml','w') {|f| f.write renderer.result(binding) }
133
132
  exit_code = myexec full_cmd, exec_options
134
133
 
135
134
  # Delete files to be ignored:
@@ -146,16 +145,6 @@ module SalesforceDeployTool
146
145
  # Parameter validation
147
146
  raise "package.xml not found under #{@full_src_dir}" if !File.exists? File.join(@full_src_dir,'package.xml')
148
147
 
149
- renderer = ERB.new(@buildxml_erb, nil,'%<>-')
150
- File.open('build.xml','w') {|f| f.write renderer.result(binding) }
151
-
152
- # Set env variables to run ant
153
- env_vars = ""
154
- env_vars += " SF_SRC_DIR=" + @full_src_dir
155
- env_vars += " SF_USERNAME=" + @username
156
- env_vars += " SF_PASSWORD=" + @password
157
- env_vars += " SF_SERVERURL=" + @server_url
158
-
159
148
  # myexec options
160
149
  exec_options = {
161
150
  :stderr => @debug,
@@ -170,30 +159,42 @@ module SalesforceDeployTool
170
159
  exec_options[:failmsg] = nil
171
160
  end
172
161
 
162
+ # Set env variables to run ant
163
+ env_vars = ""
164
+ env_vars += " SF_SRC_DIR=" + @full_src_dir
165
+ env_vars += " SF_USERNAME=" + @username
166
+ env_vars += " SF_PASSWORD=" + @password
167
+ env_vars += " SF_SERVERURL=" + @server_url
168
+
169
+ # Command
173
170
  ant_cmd = " ant"
174
171
  ant_cmd += " -lib #{@libant}" if @libant
172
+
173
+ # Target
175
174
  if @run_all_tests
176
- cmd = " deployAndTestCode"
175
+ target = " deployAndTestCode"
177
176
  else
178
177
  if ! @run_tests.empty?
179
- cmd = " deployAndRunSpecifiedTests"
178
+ target = " deployAndRunSpecifiedTests"
180
179
  else
181
- cmd = " deployCode"
180
+ target = " deployCode"
182
181
  end
183
182
  end
184
183
 
185
184
  if @check_only
186
- cmd = " checkOnlyCode"
185
+ target = target.gsub('deploy','check')
187
186
  end
188
187
 
189
- full_cmd = env_vars + ant_cmd + cmd
188
+ full_cmd = env_vars + ant_cmd + target
190
189
 
191
190
  # Delete files to be ignored:
192
191
  @deploy_ignore_files.each do |file|
193
192
  FileUtils.rm file if File.exists? file
194
193
  end
195
194
 
196
- # Push the code
195
+ # Generate build.xml and run command
196
+ renderer = ERB.new(@buildxml_erb, nil,'%<>-')
197
+ File.open('build.xml','w') {|f| f.write renderer.result(binding) }
197
198
  exit_code = myexec full_cmd, exec_options
198
199
 
199
200
  # exit with exit_code
@@ -21,7 +21,7 @@ def myexec cmd, opts = {}
21
21
  opts[:stderr] = false if opts[:stderr].nil?
22
22
  opts[:stdout] = false if opts[:stdout].nil?
23
23
  opts[:exit_on_error] = true if opts[:exit_on_error].nil?
24
- opts[:timeout] = 600 if opts[:timeout].nil?
24
+ opts[:timeout] = 7200 if opts[:timeout].nil?
25
25
  opts[:spinner] = true if opts[:spinner].nil?
26
26
  opts[:message] = false if opts[:message].nil?
27
27
  opts[:okmsg] = false if opts[:okmsg].nil?
@@ -1,3 +1,3 @@
1
1
  module SalesforceDeployTool
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.1"
3
3
  end
data/tpl/build.xml.erb CHANGED
@@ -2,65 +2,36 @@
2
2
 
3
3
  <property environment="env"/>
4
4
 
5
- <target name="deployCode">
6
- <sf:deploy
7
- username="${env.SF_USERNAME}"
8
- password="${env.SF_PASSWORD}"
9
- serverurl="${env.SF_SERVERURL}"
10
- deployRoot="${env.SF_SRC_DIR}"
5
+ <target name="<%= target.gsub(' ','') %>">
6
+ <sf:<%= target.match(/deploy|check/) ? 'deploy' : 'retrieve'%>
11
7
  maxPoll="200"
12
- rollbackOnError="true" >
13
- </sf:deploy>
14
- </target>
15
-
16
- <target name="checkOnlyCode">
17
- <sf:deploy
18
8
  username="${env.SF_USERNAME}"
19
9
  password="${env.SF_PASSWORD}"
20
10
  serverurl="${env.SF_SERVERURL}"
11
+ <% if target.match(/retrieve/) -%>
12
+ retrieveTarget="${env.SF_SRC_DIR}"
13
+ unpackaged="${env.SF_SRC_DIR}/package.xml"
14
+ <% end -%>
15
+ <% if target.match(/deploy|check/) -%>
21
16
  deployRoot="${env.SF_SRC_DIR}"
22
- maxPoll="200"
17
+ rollbackOnError="true"
18
+ <% end -%>
19
+ <% if @check_only -%>
23
20
  checkOnly="true"
24
- rollbackOnError="true" >
25
- </sf:deploy>
26
- </target>
27
-
28
- <target name="deployAndRunSpecifiedTests">
29
- <sf:deploy
30
- username="${env.SF_USERNAME}"
31
- password="${env.SF_PASSWORD}"
32
- serverurl="${env.SF_SERVERURL}"
33
- deployRoot="${env.SF_SRC_DIR}"
34
- maxPoll="200"
35
- rollbackOnError="true"
36
- testLevel="RunSpecifiedTests">
21
+ <% end -%>
22
+ <% if @run_all_tests -%>
23
+ runAllTests="true"
24
+ <% end -%>
25
+ <% if !@run_tests.empty? -%>
26
+ testLevel="RunSpecifiedTests"
27
+ <% end -%>
28
+ <% if !@check_only -%>
29
+ <% end -%>
30
+ >
37
31
  <% @run_tests.each do |test| -%>
38
32
  <runTest><%= test %></runTest>
39
33
  <% end -%>
40
- </sf:deploy>
41
- </target>
42
-
43
- <target name="deployAndTestCode">
44
- <sf:deploy
45
- username="${env.SF_USERNAME}"
46
- password="${env.SF_PASSWORD}"
47
- serverurl="${env.SF_SERVERURL}"
48
- deployRoot="${env.SF_SRC_DIR}"
49
- maxPoll="200"
50
- runAllTests="true"
51
- rollbackOnError="true" >
52
- </sf:deploy>
53
- </target>
54
-
55
- <target name="retrieveCode">
56
- <sf:retrieve
57
- username="${env.SF_USERNAME}"
58
- password="${env.SF_PASSWORD}"
59
- serverurl="${env.SF_SERVERURL}"
60
- retrieveTarget="${env.SF_SRC_DIR}"
61
- maxPoll="200"
62
- unpackaged="${env.SF_SRC_DIR}/package.xml"
63
- />
34
+ </sf:<%= target.match(/deploy|check/) ? 'deploy' : 'retrieve'%>>
64
35
  </target>
65
36
 
66
37
  </project>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce-deploy-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Breinlinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-09 00:00:00.000000000 Z
11
+ date: 2015-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler