fezzik 0.8.0.beta1 → 0.8.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/fez +0 -3
- data/lib/fezzik/base.rb +5 -2
- data/lib/fezzik/role.rb +13 -6
- data/lib/fezzik/version.rb +1 -1
- data/tasks/command.rake +1 -4
- data/weave_todo.md +9 -1
- metadata +3 -2
data/bin/fez
CHANGED
@@ -102,9 +102,6 @@ def run_fezzik_tasks
|
|
102
102
|
puts Fezzik.color_string("[fail]", :red)
|
103
103
|
exit e.status
|
104
104
|
end
|
105
|
-
rescue Fezzik::CommandFailedError => e
|
106
|
-
puts Fezzik.color_string("[fail]", :red)
|
107
|
-
exit 1
|
108
105
|
rescue StandardError => e
|
109
106
|
puts e.message
|
110
107
|
puts e.backtrace
|
data/lib/fezzik/base.rb
CHANGED
@@ -24,6 +24,10 @@ module Fezzik
|
|
24
24
|
@@settings[name]
|
25
25
|
end
|
26
26
|
|
27
|
+
# TODO(caleb): Private method?
|
28
|
+
def self.clear(name) @@settings.delete(name) end
|
29
|
+
|
30
|
+
# TODO: add deprecation warning for remote_task
|
27
31
|
def self.remote_task(*args, &block)
|
28
32
|
roles = (Hash === args.last && args.last[:roles]) ? args.pop[:roles] : []
|
29
33
|
name, args, deps = Rake.application.resolve_args(args)
|
@@ -36,6 +40,7 @@ module Fezzik
|
|
36
40
|
:deps => [],
|
37
41
|
:roles => []
|
38
42
|
}.merge(options)
|
43
|
+
options.each { |key, value| options[key] = Array(value) }
|
39
44
|
t = HostTask.define_task(name, { options[:args] => options[:deps] }, &block)
|
40
45
|
t.roles += options[:roles]
|
41
46
|
end
|
@@ -62,6 +67,4 @@ module Fezzik
|
|
62
67
|
def self.destinations
|
63
68
|
@destinations ||= Set.new
|
64
69
|
end
|
65
|
-
|
66
|
-
class CommandFailedError < StandardError; end
|
67
70
|
end
|
data/lib/fezzik/role.rb
CHANGED
@@ -6,21 +6,28 @@ module Fezzik
|
|
6
6
|
|
7
7
|
def self.roles() @roles ||= {} end
|
8
8
|
|
9
|
-
# TODO: Consider allowing roles that don't override an existing setting.
|
10
|
-
# Right now you have to do: set :foo nil; role :foo_role {:foo => :bar}
|
11
9
|
def self.with_role(role_name, &block)
|
12
10
|
return block.call if roles[role_name].nil?
|
13
11
|
|
14
|
-
|
12
|
+
overridden_settings = {}
|
13
|
+
new_settings = []
|
14
|
+
roles[role_name].each_key do |name|
|
15
|
+
if @@settings.has_key? name
|
16
|
+
overridden_settings[name] = Fezzik.get(name)
|
17
|
+
else
|
18
|
+
new_settings << name
|
19
|
+
end
|
20
|
+
end
|
15
21
|
override_settings(roles[role_name])
|
16
22
|
begin
|
17
23
|
block.call
|
18
24
|
ensure
|
19
|
-
override_settings(
|
25
|
+
override_settings(overridden_settings, new_settings)
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
23
|
-
def self.override_settings(
|
24
|
-
|
29
|
+
def self.override_settings(to_set, to_clear = [])
|
30
|
+
to_clear.each { |setting| Fezzik.clear setting }
|
31
|
+
to_set.each { |setting, value| Fezzik.set setting, value }
|
25
32
|
end
|
26
33
|
end
|
data/lib/fezzik/version.rb
CHANGED
data/tasks/command.rake
CHANGED
@@ -23,9 +23,6 @@ namespace :fezzik do
|
|
23
23
|
else
|
24
24
|
begin
|
25
25
|
Rake::Task["fezzik:command_execute"].invoke command
|
26
|
-
rescue Fezzik::CommandFailedError => e
|
27
|
-
puts e.message
|
28
|
-
puts e.backtrace
|
29
26
|
ensure
|
30
27
|
Rake::Task["fezzik:command_execute"].reenable
|
31
28
|
end
|
@@ -34,6 +31,6 @@ namespace :fezzik do
|
|
34
31
|
end
|
35
32
|
|
36
33
|
desc "run a single command on destination servers"
|
37
|
-
remote_task(:command_execute, :command) { |t, args| run args[:command] }
|
34
|
+
remote_task(:command_execute, :command) { |t, args| run args[:command], :continue_on_failure => true }
|
38
35
|
end
|
39
36
|
|
data/weave_todo.md
CHANGED
@@ -8,6 +8,14 @@
|
|
8
8
|
|
9
9
|
* Call `warn` for deprecation notices
|
10
10
|
* document --trace and --dry-run passthrough flags
|
11
|
-
* puts is not thread-safe; instead, use print "" + "\n"
|
11
|
+
* puts is not thread-safe; instead, use print "" + "\n" (NOTE: Caleb -- this isn't actually true; the `puts`
|
12
|
+
you get in a `remote_task` is a Weave wrapper, which is thread-safe. However, if you use `STDERR.puts` or
|
13
|
+
`STDOUT.puts` or `print` or anything else, it's not going to be threadsafe. This may be worth pointing out
|
14
|
+
in the docs.)
|
12
15
|
* capture_output captures the host prefix on each line. Instead pass :capture => :output to `run`.
|
13
16
|
You can also use capture_output and pass :capture => raw
|
17
|
+
* We no longer provide `current_path`, which is a RRT-ism. However, this was kind of a convention anyway --
|
18
|
+
RRT sets it to "current" and we generally leave that alone. In fact, if you look at the default deploy task
|
19
|
+
(https://github.com/dmacdougall/fezzik/blob/master/tasks/deploy.rake) you'll see that we use `current_path`
|
20
|
+
in some places and the string "current" in others. The new convention should just be `set :current_path,
|
21
|
+
"#{get :deploy_to}/current"` and then use `current_path` as a normal setting.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fezzik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0.
|
4
|
+
version: 0.8.0.beta2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-02-
|
13
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -138,3 +138,4 @@ summary: Fezzik adds remote ssh capabilities to Rake. It simplifies running comm
|
|
138
138
|
on remote servers and can be used for anything from deploying code to installing
|
139
139
|
libraries remotely.
|
140
140
|
test_files: []
|
141
|
+
has_rdoc:
|