Module: Capistrano::Processable
Defined Under Namespace
Modules: SessionAssociation
Instance Method Summary
collapse
Instance Method Details
#ensure_each_session ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/capistrano/processable.rb', line 40
def ensure_each_session
errors = []
sessions.each do |session|
begin
yield session
rescue Exception => error
errors << SessionAssociation.on(error, session)
end
end
raise errors.first if errors.any?
sessions
end
|
#process_iteration(wait = nil, &block) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/capistrano/processable.rb', line 16
def process_iteration(wait=nil, &block)
ensure_each_session { |session| session.preprocess }
return false if block && !block.call(self)
readers = sessions.map { |session| session.listeners.keys }.flatten.reject { |io| io.closed? }
writers = readers.select { |io| io.respond_to?(:pending_write?) && io.pending_write? }
if readers.any? || writers.any?
readers, writers, = IO.select(readers, writers, nil, wait)
else
return false
end
if readers
ensure_each_session do |session|
ios = session.listeners.keys
session.postprocess(ios & readers, ios & writers)
end
end
true
end
|