borg-rb 0.1.0 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,6 @@ module Borg
23
23
  end
24
24
 
25
25
  # Mix-in our own behavior
26
- include Applications, Assimilator
26
+ include Assimilator, Applications
27
27
  end
28
28
  end
@@ -3,6 +3,57 @@ require 'borg/configuration/applications'
3
3
  require 'borg/configuration/assimilator'
4
4
  require 'borg/configuration/stages'
5
5
 
6
+ # TODO This is major ugliness here...
7
+ module Capistrano
8
+ class Configuration
9
+ module Namespaces
10
+ def filter_task(name, options={}, &block)
11
+ task(name, options) do
12
+ filter_hosts find_servers_for_task(current_task).join(','), &block
13
+ end
14
+ end
15
+
16
+ def filter_hosts(hosts, &block)
17
+ original_hostfilter = ENV['HOSTFILTER']
18
+ ENV['HOSTFILTER'] = hosts
19
+ logger.info "changing HOSTFILTER from #{original_hostfilter} to #{hosts}".cyan
20
+ block.call
21
+ logger.info "resetting HOSTFILTER to #{original_hostfilter}".cyan
22
+ ENV['HOSTFILTER'] = original_hostfilter
23
+ end
24
+
25
+ def remote_condition(bash_cmd)
26
+ run bash_cmd
27
+ true
28
+ rescue
29
+ false
30
+ end
31
+
32
+ def hosts_failing_remote_condition(bash_cmd)
33
+ failing_hosts = []
34
+ begin
35
+ run bash_cmd
36
+ rescue NoMethodError => e
37
+ raise e
38
+ rescue Exception => e
39
+ failing_hosts = e.hosts
40
+ end
41
+ failing_hosts
42
+ end
43
+
44
+ def on_hosts_passing_remote_condition(bash_cmd, &block)
45
+ failing_hosts = hosts_failing_remote_condition bash_cmd
46
+ filter_hosts find_servers_for_task(current_task).reject{|h| failing_hosts.include?(h)}.join(','), &block
47
+ end
48
+
49
+ def on_hosts_failing_remote_condition(bash_cmd, &block)
50
+ failing_hosts = hosts_failing_remote_condition bash_cmd
51
+ filter_hosts failing_hosts.join(','), &block
52
+ end
53
+ end
54
+ end
55
+ end
56
+
6
57
  module Borg
7
58
  class Configuration < Capistrano::Configuration
8
59
  # Mix-in our own behavior
@@ -1,3 +1,3 @@
1
1
  module Borg
2
- VERSION = '0.1.0'
3
- end
2
+ VERSION = '0.1.4'
3
+ end
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: borg-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.4
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Identified
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-04-01 00:00:00.000000000 Z
12
+ date: 2013-04-16 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: capistrano
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: capistrano_colors
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: colored
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: term-ansicolor
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ! '>='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ! '>='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rspec
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - ! '>='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - ! '>='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: childprocess
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - ! '>='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - ! '>='
95
108
  - !ruby/object:Gem::Version
@@ -157,26 +170,27 @@ files:
157
170
  homepage: https://github.com/B0RG/borg
158
171
  licenses:
159
172
  - MIT
160
- metadata: {}
161
173
  post_install_message:
162
174
  rdoc_options: []
163
175
  require_paths:
164
176
  - lib
165
177
  required_ruby_version: !ruby/object:Gem::Requirement
178
+ none: false
166
179
  requirements:
167
180
  - - ! '>='
168
181
  - !ruby/object:Gem::Version
169
182
  version: 1.9.2
170
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
+ none: false
171
185
  requirements:
172
186
  - - ! '>='
173
187
  - !ruby/object:Gem::Version
174
188
  version: '0'
175
189
  requirements: []
176
190
  rubyforge_project:
177
- rubygems_version: 2.0.3
191
+ rubygems_version: 1.8.23
178
192
  signing_key:
179
- specification_version: 4
193
+ specification_version: 3
180
194
  summary: Ruby-based software provisioning and deployment framework
181
195
  test_files:
182
196
  - spec/acceptance/application_spec.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YjQ4NTU4YjI0N2JiZDRlZjdlYTAwOTY5NDU3MGQxOGM3YjE2OGNjNA==
5
- data.tar.gz: !binary |-
6
- MmYzNTQ1N2FkYjViYzNlZjAyM2Q2ODY5MzYyNzI0OTk5NWFjMWI5Mg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NGJjOWIwNWE3ZGJlM2NiMTM5MTE2N2QxYzgyNTAxZTQ5MGRmZTc5ZjVkMWYz
10
- MGY0NjE4NmE0MTM2MDAyZTYyN2Y2MjZkYjEwZWVkODE2N2M4Yjk2YzA5NTli
11
- NzAxNjJkMGQzY2RkOWYxYmIwODc4YTQwNmJjNmRiMzU4NGUwMjE=
12
- data.tar.gz: !binary |-
13
- MDcxNmIxMTE4ODBiNDYyYzQ2YTQ3YTI4MmJmMzY1YjJkZDE5MzZmZmFiNDg2
14
- ZDU3YTkzN2FmNzZkODY2YjQxZmY4OTJhOWU5ODIwYjM0NTcyMTI2YTQyMDYw
15
- ZTQwOGU5MGIxNjc3YTE4ZDdiYTZmNTczMzNjNjYxMjEwMDM1MmQ=