Module: GemFast::Util
Defined Under Namespace
Classes: BuildError, ExecutionError
Instance Method Summary
collapse
Instance Method Details
#curl(*args) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/gem-fast/utils.rb', line 5
def curl *args
begin
safe_system 'curl', '-f#LA', RUBYGEMPLUS_USER_AGENT, *args unless args.empty?
rescue ExecutionError => e
if GemFast.curl?
raise e
else
not_install_curl
end
rescue Errno::ENOENT => e
not_install_curl
end
end
|
#not_install_curl ⇒ Object
20
21
22
23
|
# File 'lib/gem-fast/utils.rb', line 20
def not_install_curl
alert_error("use: 'gem uninstall gem-fast' to return back, Curl not installed on your mathine!")
exit(1)
end
|
#safe_system(cmd, *args) ⇒ Object
25
26
27
|
# File 'lib/gem-fast/utils.rb', line 25
def safe_system cmd, *args
raise ExecutionError.new(cmd, args, $?) unless system(cmd, *args)
end
|
#system(cmd, *args) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/gem-fast/utils.rb', line 29
def system cmd, *args
yield if block_given?
args.collect!{|arg| arg.to_s}
`#{cmd} #{args.join(" ")}`
$?.success?
end
|