12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/stickyflag/external_cmds.rb', line 12
def find_external_cmds
EXTERNAL_CMDS.each do |cmd, desc|
path = get_config "#{cmd}_path"
unless path.nil? || path.empty?
unless File.executable? path
say_status :error, "Path set for #{cmd} is invalid", :red unless options.quiet?
path = ''
set_config "#{cmd}_path", ''
set_config "have_#{cmd}", false
else
set_config "have_#{cmd}", true
end
end
if path.nil? || path.empty?
found = which(cmd)
if found.nil?
say_status :warning, "Cannot find #{cmd} in path, will not be able to #{desc}", :yellow unless options.quiet?
set_config "have_#{cmd}", false
next
end
set_config "#{cmd}_path", found
set_config "have_#{cmd}", true
end
end
save_config!
end
|