fezzik 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -54,9 +54,14 @@ $ fez prod echo
54
54
  ### host_task
55
55
 
56
56
  The `host_task` method is similar to Rake's `task` in functionality, but has a slightly different API due to
57
- its additional options. A host task is defined with a name and three (optional) options: `:args`, `:deps`,
58
- and `:roles`. `:args` and `:deps` correspond to Rake's task arguments and task dependencies, and `:roles` is a
59
- Fezzik-specific option explained later.
57
+ its additional options. A host task is defined with a name some (optional) options. The three primary ones are
58
+ `:args`, `:deps`, and `:roles`. `:args` and `:deps` correspond to Rake's task arguments and task dependencies,
59
+ and `:roles` is a Fezzik-specific option explained later. There are also three additional options which
60
+ control how host tasks run concurrently:
61
+
62
+ - `:num_threads`: the number of threads used to run this task in parallel; defaults to 10.
63
+ - `:serial`: whether to process the command for each connection one at a time; defaults to false
64
+ - `:batch_by`: if set, group the connections into batches of no more than this value
60
65
 
61
66
  A Rake task that looks like this:
62
67
 
@@ -34,15 +34,20 @@ module Fezzik
34
34
  host_task(name, { :args => Array(args), :deps => Array(deps), :roles => Array(roles) }, &block)
35
35
  end
36
36
 
37
+ WEAVE_OPTIONS = [:num_threads, :serial, :batch_by]
38
+
37
39
  def self.host_task(name, options = {}, &block)
38
40
  options = {
39
41
  :args => [],
40
42
  :deps => [],
41
43
  :roles => []
42
44
  }.merge(options)
45
+ weave_options = options.dup.keep_if { |k, v| WEAVE_OPTIONS.include? k }
46
+ options.delete_if { |k, v| WEAVE_OPTIONS.include? k }
43
47
  options.each { |key, value| options[key] = Array(value) }
44
48
  t = HostTask.define_task(name, { options[:args] => options[:deps] }, &block)
45
49
  t.roles += options[:roles]
50
+ t.weave_options = t.weave_options.merge(weave_options)
46
51
  end
47
52
 
48
53
  def self.init(options={})
@@ -1,11 +1,12 @@
1
1
  module Fezzik
2
2
  class HostTask < Rake::Task
3
- attr_accessor :roles
3
+ attr_accessor :roles, :weave_options
4
4
 
5
5
  def initialize(task_name, app)
6
6
  super
7
- @roles = []
8
7
  @host_actions = []
8
+ @roles = []
9
+ @weave_options = {}
9
10
  end
10
11
 
11
12
  def enhance(deps = nil, &block)
@@ -21,7 +22,7 @@ module Fezzik
21
22
  @@connection_pool ||= Weave::ConnectionPool.new
22
23
  @host_actions.each do |action|
23
24
  begin
24
- @@connection_pool.execute_with(hosts, :args => [self, args], &action)
25
+ @@connection_pool.execute_with(hosts, @weave_options.merge(:args => [self, args]), &action)
25
26
  rescue Weave::Error => e
26
27
  STDERR.puts "Error running command in HostTask '#{@name}':"
27
28
  abort e.message
@@ -35,7 +36,8 @@ module Fezzik
35
36
  @@role_connection_pools[role] ||= Weave::ConnectionPool.new
36
37
  @host_actions.each do |action|
37
38
  begin
38
- @@role_connection_pools[role].execute_with(hosts, :args => [self, args], &action)
39
+ @@role_connection_pools[role].execute_with(hosts, @weave_options.merge(:args => [self, args]),
40
+ &action)
39
41
  rescue Weave::Error => e
40
42
  STDERR.puts "Error running command in HostTask '#{@name}' with role '#{role}':"
41
43
  abort e.message
@@ -1,3 +1,3 @@
1
1
  module Fezzik
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fezzik
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Daniel MacDougall
@@ -9,25 +10,28 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-06-04 00:00:00.000000000 Z
13
+ date: 2013-09-27 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rake
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - '>='
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '0'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - '>='
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '0'
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: weave
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - '='
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - '='
40
45
  - !ruby/object:Gem::Version
@@ -42,6 +47,7 @@ dependencies:
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: scope
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
52
  - - ~>
47
53
  - !ruby/object:Gem::Version
@@ -49,6 +55,7 @@ dependencies:
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
60
  - - ~>
54
61
  - !ruby/object:Gem::Version
@@ -88,28 +95,31 @@ files:
88
95
  - test/integration_test_helper.rb
89
96
  homepage: http://github.com/dmacdougall/fezzik
90
97
  licenses: []
91
- metadata: {}
92
98
  post_install_message:
93
99
  rdoc_options: []
94
100
  require_paths:
95
101
  - lib
96
102
  required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
97
104
  requirements:
98
- - - '>='
105
+ - - ! '>='
99
106
  - !ruby/object:Gem::Version
100
107
  version: '0'
108
+ segments:
109
+ - 0
110
+ hash: -3699193931790573527
101
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
+ none: false
102
113
  requirements:
103
- - - '>='
114
+ - - ! '>='
104
115
  - !ruby/object:Gem::Version
105
116
  version: '0'
106
117
  requirements: []
107
118
  rubyforge_project: fezzik
108
- rubygems_version: 2.0.0
119
+ rubygems_version: 1.8.23
109
120
  signing_key:
110
121
  specification_version: 2
111
122
  summary: Fezzik adds remote ssh capabilities to Rake. It simplifies running commands
112
123
  on remote servers and can be used for anything from deploying code to installing
113
124
  libraries remotely.
114
125
  test_files: []
115
- has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 46f03aaa7fe191aeba95f63afef24ca9f2bec9d6
4
- data.tar.gz: 237458033bb4d72fe30414e97213aba3a420f025
5
- SHA512:
6
- metadata.gz: 8a569eaeaa834041ea0273c71e7485a47be4e4e64c3145f9b2fddaaf66c39f75149a3c29cc7f5851dbc0ddc724b8d85ee0a030bee8ff2054f91465989c1b3bce
7
- data.tar.gz: d4096d2c482a9d763f1883ca172fc3848b5e4fa35b8c245416e51b348a68425e9e5749183ed4e378c13c8812837ddf40766ae67bce92149c62ceed8947ec60df