class Object
Public Instance Methods
get_option(name)
click to toggle source
# File bin/autobuild, line 58 def get_option(name) AutobuildConfig.class_variable_get "@@#{name}".to_sym end
loop_edits(directory) { |path, name| ... }
click to toggle source
loop over events
# File bin/autobuild, line 43 def loop_edits(directory) while 1 wait_edit(directory) { |path, name| yield path, name } end end
match_re_list?(string, list)
click to toggle source
returns true if the regex in a list matches the string
# File bin/autobuild, line 52 def match_re_list?(string, list) return list.select { |re| re.match(string) }.length > 0 end
parse_config(path)
click to toggle source
parse the configuration file
# File bin/autobuild, line 57 def parse_config(path) def get_option(name) AutobuildConfig.class_variable_get "@@#{name}".to_sym end require path options = {} begin options["project_dir"] = get_option("project_directory") options["build"] = get_option("build") options["execute"] = get_option("execute") options["include_files"] = get_option("include_files") options["exclude_files"] = get_option("exclude_files") rescue NameError puts "Required options:" puts " project_directory" puts " build" puts " execute" puts " include_files" puts " exclude_files" exit end options end
pp_cmd(cmd)
click to toggle source
print a command with two spaces before each line.
# File bin/autobuild, line 23 def pp_cmd(cmd) puts "" `#{cmd}`.split("\n").each { |line| puts " #{line}" } end
wait_edit(directory) { |path, name| ... }
click to toggle source
wait for an event on a directory
# File bin/autobuild, line 31 def wait_edit(directory) inotify = Inotify.new inotify.recursive_add_watch(directory, InotifyEvents::IN_MODIFY|InotifyEvents::IN_CLOSE_WRITE) inotify.wait_for_event() { |path, mask, name| yield path, name } inotify.rm_all_watches() end