5
File.join(File.dirname(__FILE__), '..', '..', 'config', 'micro', file)
9
path = File.expand_path(path)
10
if RUBY_PLATFORM =~ /mingw|mswin32|cygwin/
12
return '"' + path + '"'
17
return path.gsub(' ', '\ ')
21
def locate_file(file, directory, search_paths)
22
search_paths.each do |path|
23
expanded_path = File.expand_path(path)
24
if File.exists?(expanded_path)
25
Find.find(expanded_path) do |current|
26
if File.directory?(current) && current.include?(directory)
27
full_path = File.join(current, file)
28
return self.escape_path(full_path) if File.exists?(full_path)
37
def run_command(command, args=nil)
38
# TODO switch to using posix-spawn instead
39
result = %x{#{command} #{args} 2>&1}
40
unless $?.exitstatus == 0
44
raise "failed to execute #{command} #{args}:\n#{result}"
51
module_function :config_file
52
module_function :escape_path
53
module_function :locate_file
54
module_function :run_command