capistrano-maven 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,20 +35,24 @@ module Capistrano
35
35
  _cset(:mvn_common_environment, {})
36
36
  _cset(:mvn_default_environment) {
37
37
  environment = {}
38
- environment["JAVA_HOME"] = fetch(:mvn_java_home) if exists?(:mvn_java_home)
39
- if exists?(:mvn_java_options)
40
- environment["MAVEN_OPTS"] = [ fetch(:mvn_java_options, []) ].flatten.join(" ")
38
+ if mvn_setup_remotely
39
+ environment["JAVA_HOME"] = fetch(:mvn_java_home) if exists?(:mvn_java_home)
40
+ if exists?(:mvn_java_options)
41
+ environment["MAVEN_OPTS"] = [ fetch(:mvn_java_options, []) ].flatten.join(" ")
42
+ end
43
+ environment["PATH"] = [ mvn_bin_path, "$PATH" ].join(":")
41
44
  end
42
- environment["PATH"] = [ mvn_bin_path, "$PATH" ].join(":") if mvn_setup_remotely
43
45
  _merge_environment(mvn_common_environment, environment)
44
46
  }
45
47
  _cset(:mvn_default_environment_local) {
46
48
  environment = {}
47
- environment["JAVA_HOME"] = fetch(:mvn_java_home_local) if exists?(:mvn_java_home_local)
48
- if exists?(:mvn_java_options_local)
49
- environment["MAVEN_OPTS"] = [ fetch(:mvn_java_options_local, []) ].flatten.join(" ")
49
+ if mvn_setup_locally
50
+ environment["JAVA_HOME"] = fetch(:mvn_java_home_local) if exists?(:mvn_java_home_local)
51
+ if exists?(:mvn_java_options_local)
52
+ environment["MAVEN_OPTS"] = [ fetch(:mvn_java_options_local, []) ].flatten.join(" ")
53
+ end
54
+ environment["PATH"] = [ mvn_bin_path_local, "$PATH" ].join(":")
50
55
  end
51
- environment["PATH"] = [ mvn_bin_path_local, "$PATH" ].join(":") if mvn_setup_locally
52
56
  _merge_environment(mvn_common_environment, environment)
53
57
  }
54
58
  _cset(:mvn_environment) { _merge_environment(mvn_default_environment, fetch(:mvn_extra_environment, {})) }
@@ -336,7 +340,7 @@ module Capistrano
336
340
  system(cmdline)
337
341
  end
338
342
  if $?.to_i > 0 # $? is command exit code (posix style)
339
- raise Capistrano::LocalArgumentError, "Command #{cmd} returned status code #{$?}"
343
+ raise Capistrano::LocalArgumentError, "Command #{cmdline} returned status code #{$?}"
340
344
  end
341
345
  logger.trace "command finished in #{(elapsed * 1000).round}ms"
342
346
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Maven
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -99,6 +99,28 @@ def uninstall_mvn!
99
99
  reset_mvn!
100
100
  end
101
101
 
102
+ def _test_mvn_exec_fails(args=[], options={})
103
+ failed = false
104
+ begin
105
+ mvn.exec(args, options)
106
+ rescue
107
+ failed = true
108
+ ensure
109
+ abort unless failed
110
+ end
111
+ end
112
+
113
+ def _test_mvn_exec_locally_fails(args=[], options={})
114
+ failed = false
115
+ begin
116
+ mvn.exec_locally(args, options)
117
+ rescue
118
+ failed = true
119
+ ensure
120
+ abort unless failed
121
+ end
122
+ end
123
+
102
124
  task(:test_all) {
103
125
  find_and_execute_task("test_default")
104
126
  find_and_execute_task("test_with_remote")
@@ -163,10 +185,18 @@ namespace(:test_default) {
163
185
  mvn.exec("--version")
164
186
  }
165
187
 
188
+ task(:test_mvn_exec_fails) {
189
+ _test_mvn_exec_fails("--MUST-FAIL")
190
+ }
191
+
166
192
  task(:test_mvn_exec_locally) {
167
193
  mvn.exec_locally("--version")
168
194
  }
169
195
 
196
+ task(:test_mvn_exec_locally_fails) {
197
+ _test_mvn_exec_locally_fails("--MUST-FAIL")
198
+ }
199
+
170
200
  task(:test_mvn_artifact) {
171
201
  assert_file_exists(File.join(mvn_target_path, "capistrano-maven-0.0.1-SNAPSHOT.jar"))
172
202
  }
@@ -229,8 +259,16 @@ namespace(:test_with_remote) {
229
259
  mvn.exec("--version")
230
260
  }
231
261
 
262
+ task(:test_mvn_exec_fails) {
263
+ _test_mvn_exec_fails("--MUST-FAIL")
264
+ }
265
+
232
266
  # task(:test_mvn_exec_locally) {
233
267
  # mvn.exec_locally("--version")
268
+ # }
269
+
270
+ # task(:test_mvn_exec_locally_fails) {
271
+ # _test_mvn_exec_locally_fails("--MUST-FAIL")
234
272
  # }
235
273
 
236
274
  task(:test_mvn_artifact) {
@@ -293,12 +331,20 @@ namespace(:test_with_local) {
293
331
 
294
332
  # task(:test_mvn_exec) {
295
333
  # mvn.exec("--version")
334
+ # }
335
+
336
+ # task(:test_mvn_exec_fails) {
337
+ # _test_mvn_exec_fails("--MUST-FAIL")
296
338
  # }
297
339
 
298
340
  task(:test_mvn_exec_locally) {
299
341
  mvn.exec_locally("--version")
300
342
  }
301
343
 
344
+ task(:test_mvn_exec_locally_fails) {
345
+ _test_mvn_exec_locally_fails("--MUST-FAIL")
346
+ }
347
+
302
348
  task(:test_mvn_artifact) {
303
349
  assert_file_exists(File.join(mvn_target_path, "capistrano-maven-0.0.1-SNAPSHOT.jar"))
304
350
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-maven
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: