Module: Teapot::Commands
- Defined in:
- lib/teapot/commands.rb
Defined Under Namespace
Modules: Helpers
Classes: CommandError, Pool
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.make(*args) ⇒ Object
81
82
83
|
# File 'lib/teapot/commands.rb', line 81
def self.make(*args)
run("make", *args, "-j", processor_count)
end
|
.make_install ⇒ Object
85
86
87
|
# File 'lib/teapot/commands.rb', line 85
def self.make_install
make("install")
end
|
.pipeline(parallel = false) ⇒ Object
131
132
133
134
135
136
137
138
139
|
# File 'lib/teapot/commands.rb', line 131
def self.pipeline(parallel = false)
if parallel == false
Commands
else
Pool.new(parallel == true ? {} : parallel)
end
end
|
.processor_count ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/teapot/commands.rb', line 39
def self.processor_count
count = Facter.processorcount.to_i rescue 1
count < 1 ? 1 : count
end
|
.run(*args, &block) ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/teapot/commands.rb', line 54
def self.run(*args, &block)
options = Hash === args.last ? args.pop : {}
options[:passthrough] ||= :all
args = args.flatten.collect &:to_s
puts args.join(' ').color(:blue) + " in #{options[:chdir] || Dir.getwd}"
task = RExec::Task.open(args, options, &block)
if task.wait == 0
true
else
raise CommandError.new("Non-zero exit status: #{args.join(' ')}!")
end
end
|
.run!(*args, &block) ⇒ Object
71
72
73
74
75
|
# File 'lib/teapot/commands.rb', line 71
def self.run!(*args, &block)
run(*args, &block)
rescue CommandError
false
end
|
.split(arg) ⇒ Object
50
51
52
|
# File 'lib/teapot/commands.rb', line 50
def self.split(arg)
Shellwords.split(arg || "")
end
|
Instance Method Details
#wait ⇒ Object
77
78
79
|
# File 'lib/teapot/commands.rb', line 77
def wait
end
|