cape 1.0.3 → 1.1.0

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.
@@ -1,6 +1,10 @@
1
1
  # Version history for the _Cape_ project
2
2
 
3
- ## <a name="v1.0.3"></a>v1.0.3, Tue 11/29/2011
3
+ ## <a name="v1.1.0"></a>v1.1.0, Thu 12/29/2011
4
+
5
+ * Allow environment variables for Rake task arguments to be optional
6
+
7
+ ## <a name="v1.0.3"></a>v1.0.3, Thu 12/29/2011
4
8
 
5
9
  * Run Cucumber features from `gem test cape`
6
10
 
@@ -124,7 +124,7 @@ Let’s use Capistrano to view the unabbreviated description of a Rake task reci
124
124
  ------------------------------------------------------------
125
125
  Bags the leaves.
126
126
 
127
- You must set environment variable PAPER_OR_PLASTIC.
127
+ Set environment variable PAPER_OR_PLASTIC to pass a Rake task argument.
128
128
 
129
129
  Here’s how to invoke a task/recipe with arguments. On the local computer, via Rake:
130
130
 
@@ -150,7 +150,7 @@ Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace, witho
150
150
  ------------------------------------------------------------
151
151
  My task with one argument.
152
152
 
153
- You must set environment variable THE_ARG.
153
+ Set environment variable THE_ARG to pass a Rake task argument.
154
154
 
155
155
 
156
156
  """
@@ -215,7 +215,7 @@ Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace, witho
215
215
  ------------------------------------------------------------
216
216
  My task with two arguments.
217
217
 
218
- You must set environment variables MY_ARG1 and MY_ARG2.
218
+ Set environment variables MY_ARG1 and MY_ARG2 to pass Rake task arguments.
219
219
 
220
220
 
221
221
  """
@@ -238,7 +238,8 @@ Feature: The #mirror_rake_tasks DSL method, inside a Capistrano namespace, witho
238
238
  ------------------------------------------------------------
239
239
  My task with three arguments.
240
240
 
241
- You must set environment variables AN_ARG1, AN_ARG2, and AN_ARG3.
241
+ Set environment variables AN_ARG1, AN_ARG2, and AN_ARG3 to pass Rake task
242
+ arguments.
242
243
 
243
244
 
244
245
  """
@@ -138,7 +138,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
138
138
  ------------------------------------------------------------
139
139
  My task with one argument.
140
140
 
141
- You must set environment variable THE_ARG.
141
+ Set environment variable THE_ARG to pass a Rake task argument.
142
142
 
143
143
 
144
144
  """
@@ -213,7 +213,7 @@ Feature: The #mirror_rake_tasks DSL method without arguments
213
213
  ------------------------------------------------------------
214
214
  My task with two arguments.
215
215
 
216
- You must set environment variables MY_ARG1 and MY_ARG2.
216
+ Set environment variables MY_ARG1 and MY_ARG2 to pass Rake task arguments.
217
217
 
218
218
 
219
219
  """
@@ -234,24 +234,31 @@ Feature: The #mirror_rake_tasks DSL method without arguments
234
234
  ------------------------------------------------------------
235
235
  My task with three arguments.
236
236
 
237
- You must set environment variables AN_ARG1, AN_ARG2, and AN_ARG3.
237
+ Set environment variables AN_ARG1, AN_ARG2, and AN_ARG3 to pass Rake task
238
+ arguments.
238
239
 
239
240
 
240
241
  """
241
242
 
242
- Scenario: mirror Rake task 'with_three_args' with its implementation enforcing arguments
243
+ Scenario: mirror Rake task 'with_three_args' with its implementation
243
244
  Given a full-featured Rakefile
244
245
  And a Capfile with:
245
246
  """
246
247
  set :current_path, '/path/to/current/deployed/application'
248
+
247
249
  Cape do
248
250
  mirror_rake_tasks
249
251
  end
250
252
  """
251
- When I run `cap with_three_args AN_ARG1="a value for an_arg1"`
252
- Then the output should contain "Environment variable AN_ARG2 must be set (RuntimeError)"
253
+ When I run `cap with_three_args AN_ARG1="a value for an_arg1" AN_ARG2="a value for an_arg2" AN_ARG3="a value for an_arg3"`
254
+ Then the output should contain:
255
+ """
256
+ * executing `with_three_args'
257
+ * executing "cd /path/to/current/deployed/application && /usr/bin/env rake with_three_args[\"a value for an_arg1\",\"a value for an_arg2\",\"a value for an_arg3\"]"
258
+
259
+ """
253
260
 
254
- Scenario: mirror Rake task 'with_three_args' with its implementation
261
+ Scenario: mirror Rake task 'with_three_args' with its implementation not enforcing arguments
255
262
  Given a full-featured Rakefile
256
263
  And a Capfile with:
257
264
  """
@@ -261,11 +268,11 @@ Feature: The #mirror_rake_tasks DSL method without arguments
261
268
  mirror_rake_tasks
262
269
  end
263
270
  """
264
- When I run `cap with_three_args AN_ARG1="a value for an_arg1" AN_ARG2="a value for an_arg2" AN_ARG3="a value for an_arg3"`
271
+ When I run `cap with_three_args AN_ARG2="a value for an_arg2"`
265
272
  Then the output should contain:
266
273
  """
267
274
  * executing `with_three_args'
268
- * executing "cd /path/to/current/deployed/application && /usr/bin/env rake with_three_args[\"a value for an_arg1\",\"a value for an_arg2\",\"a value for an_arg3\"]"
275
+ * executing "cd /path/to/current/deployed/application && /usr/bin/env rake with_three_args[,\"a value for an_arg2\",]"
269
276
 
270
277
  """
271
278
 
@@ -58,10 +58,14 @@ module Cape
58
58
  unless (parameters = Array(task[:parameters])).empty?
59
59
  noun = Util.pluralize('variable', parameters.length)
60
60
  parameters_list = Util.to_list_phrase(parameters.collect(&:upcase))
61
+ singular = 'Rake task argument'
62
+ noun_phrase = (parameters.length == 1) ?
63
+ "a #{singular}" :
64
+ Util.pluralize(singular)
61
65
  description << <<-end_description
62
66
 
63
67
 
64
- You must set environment #{noun} #{parameters_list}.
68
+ Set environment #{noun} #{parameters_list} to pass #{noun_phrase}.
65
69
  end_description
66
70
  end
67
71
  description.join
@@ -73,10 +77,10 @@ You must set environment #{noun} #{parameters_list}.
73
77
  block = lambda { |context|
74
78
  context.task name.last, :roles => roles do
75
79
  arguments = Array(task[:parameters]).collect do |a|
76
- unless (value = ENV[a.upcase])
77
- fail "Environment variable #{a.upcase} must be set"
80
+ if (value = ENV[a.upcase])
81
+ value = value.inspect
78
82
  end
79
- value.inspect
83
+ value
80
84
  end
81
85
  if arguments.empty?
82
86
  arguments = nil
@@ -1,6 +1,6 @@
1
1
  module Cape
2
2
 
3
3
  # The version of Cape.
4
- VERSION = '1.0.3'
4
+ VERSION = '1.1.0'
5
5
 
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cape
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 3
10
- version: 1.0.3
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nils Jonsson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-29 00:00:00 Z
18
+ date: 2011-12-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: aruba