Module: Flatware
- Extended by:
- Flatware
- Included in:
- Flatware
- Defined in:
- lib/flatware.rb,
lib/flatware/cli.rb,
lib/flatware/job.rb,
lib/flatware/pids.rb,
lib/flatware/sink.rb,
lib/flatware/rspec.rb,
lib/flatware/poller.rb,
lib/flatware/socket.rb,
lib/flatware/worker.rb,
lib/flatware/version.rb,
lib/flatware/cucumber.rb,
lib/flatware/rspec/cli.rb,
lib/flatware/broadcaster.rb,
lib/flatware/sink/client.rb,
lib/flatware/cucumber/cli.rb,
lib/flatware/rspec/summary.rb,
lib/flatware/processor_info.rb,
lib/flatware/cucumber/result.rb,
lib/flatware/rspec/formatter.rb,
lib/flatware/cucumber/runtime.rb,
lib/flatware/rspec/checkpoint.rb,
lib/flatware/cucumber/formatter.rb,
lib/flatware/cucumber/step_result.rb,
lib/flatware/serialized_exception.rb,
lib/flatware/cucumber/scenario_result.rb,
lib/flatware/rspec/example_notification.rb,
lib/flatware/rspec/examples_notification.rb
Defined Under Namespace
Modules: Cucumber, RSpec, Sink
Classes: Broadcaster, CLI, Context, Job, Poller, ProcessorInfo, SerializedClass, SerializedException, Socket, Worker
Constant Summary
collapse
- Error =
Class.new StandardError
- VERSION =
'1.0.0'
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#verbose=(value) ⇒ Object
Sets the attribute verbose
45
46
47
|
# File 'lib/flatware/socket.rb', line 45
def verbose=(value)
@verbose = value
end
|
Instance Method Details
#close(force: false) ⇒ Object
22
23
24
25
26
|
# File 'lib/flatware/socket.rb', line 22
def close(force: false)
@ignore_errors = true if force
context.close(force: force)
@context = nil
end
|
#close! ⇒ Object
28
29
30
|
# File 'lib/flatware/socket.rb', line 28
def close!
close force: true
end
|
#context ⇒ Object
50
51
52
53
54
55
|
# File 'lib/flatware/socket.rb', line 50
def context
@context ||= begin
@ignore_errors = nil
Context.new
end
end
|
#log(*message) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/flatware/socket.rb', line 36
def log(*message)
if Exception === message.first
logger.error message.first
elsif verbose?
logger.info ([$0] + message).join(' ')
end
message
end
|
#logger ⇒ Object
10
11
12
|
# File 'lib/flatware/socket.rb', line 10
def logger
@logger ||= Logger.new($stderr)
end
|
#logger=(logger) ⇒ Object
14
15
16
|
# File 'lib/flatware/socket.rb', line 14
def logger=(logger)
@logger = logger
end
|
#pids ⇒ Object
All the pids of all the processes called flatware on this machine
5
6
7
8
9
|
# File 'lib/flatware/pids.rb', line 5
def pids
pids_command.map do |row|
row =~ /(\d+).*flatware/ and $1.to_i
end.compact
end
|
#pids_command ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/flatware/pids.rb', line 11
def pids_command
case ProcessorInfo.operating_system
when 'Darwin'
`ps -c -opid,pgid,command`
when 'Linux'
`ps -opid,pgid,command`
end.split("\n")[1..-1]
end
|
#pids_of_group(group_pid) ⇒ Object
20
21
22
23
24
|
# File 'lib/flatware/pids.rb', line 20
def pids_of_group(group_pid)
pids_command.map(&:split).map do |pid, pgid, _|
pid.to_i if pgid.to_i == group_pid
end.compact
end
|
#socket(*args) ⇒ Object
18
19
20
|
# File 'lib/flatware/socket.rb', line 18
def socket(*args)
context.socket(*args)
end
|
#socket_error(name = nil) ⇒ Object
32
33
34
|
# File 'lib/flatware/socket.rb', line 32
def socket_error(name=nil)
raise(Error, [$0,name,ZMQ::Util.error_string].compact.join(' - '), caller) unless @ignore_errors
end
|
#verbose? ⇒ Boolean
46
47
48
|
# File 'lib/flatware/socket.rb', line 46
def verbose?
!!@verbose
end
|