rake-remote_task 2.0.6 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,18 @@
1
+ === 2.1.0 / 2012-11-23
2
+
3
+ * 4 minor enhancements:
4
+
5
+ * Allow a set of preliminary commands that will always be run
6
+ * Allow the manipultation of array variable in which one can append values
7
+ * Trust remote umask by default
8
+ * Updated rake dep to be >= 0.8 and < 11.0 for the new wack version scheme. (MichaelXavier)
9
+
10
+ * 3 bug fixes:
11
+
12
+ * Add documentation for +command_prefix+ in +run+
13
+ * Declare append as an operation of Rake:RemoteTask. Fix 7863.
14
+ * Fix misc coding style
15
+
1
16
  === 2.0.6 / 2012-01-04
2
17
 
3
18
  * 1 minor enhancement:
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ Hoe.spec 'rake-remote_task' do
13
13
 
14
14
  self.rubyforge_name = 'hitsquad'
15
15
 
16
- dependency 'rake', '~> 0.8'
16
+ dependency 'rake', ['>= 0.8', '< 11.0']
17
17
  dependency 'open4', '~> 1.0'
18
18
 
19
19
  multiruby_skip << "rubinius"
@@ -8,7 +8,7 @@ $-w = true if $TRACE # asshat, don't mess with my warn.
8
8
 
9
9
  [
10
10
  ["Thread.current[:task]", :get, :put, :rsync, :run, :sudo, :target_host],
11
- ["Rake::RemoteTask", :host, :remote_task, :role, :set]
11
+ ["Rake::RemoteTask", :host, :remote_task, :role, :set, :append]
12
12
  ].each do |methods|
13
13
  receiver = methods.shift
14
14
  methods.each do |method|
@@ -45,7 +45,7 @@ end
45
45
 
46
46
  class Rake::RemoteTask < Rake::Task
47
47
 
48
- VERSION = "2.0.6"
48
+ VERSION = "2.1.0"
49
49
 
50
50
  @@current_roles = []
51
51
 
@@ -169,9 +169,19 @@ class Rake::RemoteTask < Rake::Task
169
169
  ##
170
170
  # Use ssh to execute +command+ on target_host. If +command+ uses sudo, the
171
171
  # sudo password will be prompted for then saved for subsequent sudo commands.
172
+ #
173
+ # If +command_prefix+ has been filled up with one or several commands, they
174
+ # will be run on target_host before +command+.
172
175
 
173
176
  def run command
174
- command = "cd #{target_dir} && #{command}" if target_dir
177
+ commands = []
178
+
179
+ commands << "cd #{target_dir}" if target_dir
180
+ commands += command_prefix.flatten if command_prefix
181
+ commands << "#{command}"
182
+
183
+ command = commands.join(" && ")
184
+
175
185
  cmd = [ssh_cmd, ssh_flags, target_host, command].flatten
176
186
  result = []
177
187
 
@@ -256,6 +266,10 @@ class Rake::RemoteTask < Rake::Task
256
266
  @@env
257
267
  end
258
268
 
269
+ def self.is_array
270
+ @@is_array
271
+ end
272
+
259
273
  ##
260
274
  # Fetches environment variable +name+ from the environment using
261
275
  # default +default+.
@@ -265,11 +279,21 @@ class Rake::RemoteTask < Rake::Task
265
279
  if @@env.has_key? name then
266
280
  protect_env(name) do
267
281
  v = @@env[name]
268
- v = @@env[name] = v.call if Proc === v unless per_thread[name]
269
- v = v.call if Proc === v
282
+ if @@is_array[name] then
283
+ v = v.map do |item|
284
+ Proc === item ? item.call : item
285
+ end
286
+ unless per_thread[name] then
287
+ @@env[name] = v
288
+ @@is_array[name] = false
289
+ end
290
+ elsif Proc === v then
291
+ v = v.call
292
+ @@env[name] = v unless per_thread[name]
293
+ end
270
294
  v
271
295
  end
272
- elsif default || default == false
296
+ elsif default || default == false then
273
297
  v = @@env[name] = default
274
298
  else
275
299
  raise Rake::FetchError
@@ -349,6 +373,7 @@ class Rake::RemoteTask < Rake::Task
349
373
  def self.reset
350
374
  @@def_role_hash = {} # official default role value
351
375
  @@env = {}
376
+ @@is_array = {}
352
377
  @@tasks = {}
353
378
  @@roles = Hash.new { |h,k| h[k] = @@def_role_hash }
354
379
  @@env_locks = Hash.new { |h,k| h[k] = Mutex.new }
@@ -430,6 +455,35 @@ class Rake::RemoteTask < Rake::Task
430
455
  end
431
456
  end
432
457
 
458
+ ##
459
+ # Append +value+ or +default_block+ to environment variable +name+
460
+ #
461
+ # To initialize an empty array, just do append +name+
462
+ #
463
+ # If +default_block+ is defined, the block will be executed the
464
+ # first time the variable is fetched, and the value will be used for
465
+ # every subsequent fetch.
466
+
467
+ def self.append name, value = nil, &default_block
468
+ raise ArgumentError, "cannot provide both a value and a block" if
469
+ value and default_block unless
470
+ value == :per_thread
471
+ raise ArgumentError, "cannot set reserved name: '#{name}'" if
472
+ Rake::RemoteTask.reserved_name?(name) unless $TESTING
473
+
474
+ name = name.to_s
475
+
476
+ set(name, []) unless @@is_array[name]
477
+ Rake::RemoteTask.is_array[name] = true
478
+ Rake::RemoteTask.per_thread[name] ||= default_block && value == :per_thread
479
+
480
+ v = default_block || value
481
+ if v then
482
+ Rake::RemoteTask.default_env[name] << v
483
+ Rake::RemoteTask.env[name] << v
484
+ end
485
+ end
486
+
433
487
  ##
434
488
  # Sets all the default values. Should only be called once. Use reset
435
489
  # if you need to restore values.
@@ -455,12 +509,14 @@ class Rake::RemoteTask < Rake::Task
455
509
  :sudo_cmd, "sudo",
456
510
  :sudo_flags, ['-p Password:'],
457
511
  :sudo_prompt, /^Password:/,
458
- :umask, '02',
512
+ :umask, nil,
459
513
  :mkdirs, [],
460
514
  :shared_paths, {},
461
515
  :perm_owner, nil,
462
516
  :perm_group, nil)
463
517
 
518
+ append :command_prefix, []
519
+
464
520
  set(:current_release) { File.join(releases_path, releases[-1]) }
465
521
  set(:latest_release) {
466
522
  deploy_timestamped ? release_path : current_release
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-remote_task
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 6
10
- version: 2.0.6
10
+ version: 2.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -38,7 +38,7 @@ cert_chain:
38
38
  FBHgymkyj/AOSqKRIpXPhjC6
39
39
  -----END CERTIFICATE-----
40
40
 
41
- date: 2012-01-05 00:00:00 Z
41
+ date: 2012-11-23 00:00:00 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rake
@@ -46,13 +46,20 @@ dependencies:
46
46
  requirement: &id001 !ruby/object:Gem::Requirement
47
47
  none: false
48
48
  requirements:
49
- - - ~>
49
+ - - ">="
50
50
  - !ruby/object:Gem::Version
51
51
  hash: 27
52
52
  segments:
53
53
  - 0
54
54
  - 8
55
55
  version: "0.8"
56
+ - - <
57
+ - !ruby/object:Gem::Version
58
+ hash: 39
59
+ segments:
60
+ - 11
61
+ - 0
62
+ version: "11.0"
56
63
  type: :runtime
57
64
  version_requirements: *id001
58
65
  - !ruby/object:Gem::Dependency
@@ -78,11 +85,11 @@ dependencies:
78
85
  requirements:
79
86
  - - ~>
80
87
  - !ruby/object:Gem::Version
81
- hash: 17
88
+ hash: 29
82
89
  segments:
83
- - 2
84
- - 9
85
- version: "2.9"
90
+ - 4
91
+ - 3
92
+ version: "4.3"
86
93
  type: :development
87
94
  version_requirements: *id003
88
95
  - !ruby/object:Gem::Dependency
@@ -108,11 +115,11 @@ dependencies:
108
115
  requirements:
109
116
  - - ~>
110
117
  - !ruby/object:Gem::Version
111
- hash: 27
118
+ hash: 1
112
119
  segments:
113
- - 2
114
- - 12
115
- version: "2.12"
120
+ - 3
121
+ - 3
122
+ version: "3.3"
116
123
  type: :development
117
124
  version_requirements: *id005
118
125
  description: |-
@@ -170,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
177
  requirements: []
171
178
 
172
179
  rubyforge_project: hitsquad
173
- rubygems_version: 1.8.12
180
+ rubygems_version: 1.8.24
174
181
  signing_key:
175
182
  specification_version: 3
176
183
  summary: Vlad the Deployer's sexy brainchild is rake-remote_task, extending Rake with remote task goodness.
metadata.gz.sig CHANGED
Binary file