module Crawling
Constants
- HOME_PARENT_DIR
path to repository for user(s)
- N_LINES_DIFF_CONTEXT
- SYSTEM_PARENT_DIR
path to repository for the system
- VERSION
Public Class Methods
child_files_recursive(path)
click to toggle source
# File lib/crawling.rb, line 14 def self.child_files_recursive path Dir.glob("#{path}/**/*", File::FNM_DOTMATCH).reject(&File.method(:directory?)) end
copy_file(src_file, dest_file)
click to toggle source
Like File.cp but also creates the parent directory at destination if it doesn't exist
# File lib/crawling.rb, line 24 def self.copy_file src_file, dest_file dest_parent_dir = File.dirname dest_file FileUtils.mkdir_p dest_parent_dir unless Dir.exist? dest_parent_dir begin FileUtils.cp(src_file, dest_file) rescue raise "could not copy from #{src_file} to #{dest_file}" end end
relative_path_to(target, relative_to)
click to toggle source
relative_to must be an absolute Pathname
# File lib/crawling.rb, line 19 def self.relative_path_to target, relative_to Pathname.new(target).expand_path.relative_path_from relative_to end