class FileWrapper
Public Instance Methods
Source
# File lib/ceedling/file_wrapper.rb, line 21 def basename(path, extension=nil) return File.basename(path, extension) if extension return File.basename(path) end
Source
# File lib/ceedling/file_wrapper.rb, line 78 def compare(from, to) return FileUtils.compare_file(from, to) end
Source
# File lib/ceedling/file_wrapper.rb, line 66 def cp(source, destination, options={}) FileUtils.cp(source, destination, **options) end
Source
# File lib/ceedling/file_wrapper.rb, line 70 def cp_r(source, destination, options={}) FileUtils.cp_r(source, destination, **options) end
Source
# File lib/ceedling/file_wrapper.rb, line 36 def directory?(path) return File.directory?(path) end
Is path a directory and does it exist?
Source
# File lib/ceedling/file_wrapper.rb, line 48 def directory_listing(glob) # Note: `sort()` to ensure platform-independent directory listings (Github Issue #860) # FNM_PATHNAME => Case insensitive globs return Dir.glob(glob, File::FNM_PATHNAME).sort() end
Source
# File lib/ceedling/file_wrapper.rb, line 44 def dirname(path) return File.dirname(path) end
Source
# File lib/ceedling/file_wrapper.rb, line 26 def exist?(filepath) return true if (filepath == NULL_FILE_PATH) return File.exist?(filepath) end
Source
# File lib/ceedling/file_wrapper.rb, line 31 def extname(filepath) return File.extname(filepath) end
Source
# File lib/ceedling/file_wrapper.rb, line 17 def get_expanded_path(path) return File.expand_path(path) end
Source
# File lib/ceedling/file_wrapper.rb, line 114 def instantiate_file_list(files=[]) return FileList.new(files) end
Source
# File lib/ceedling/file_wrapper.rb, line 118 def mkdir(folder) return FileUtils.mkdir_p(folder) end
Source
# File lib/ceedling/file_wrapper.rb, line 74 def mv(source, destination, options={}) FileUtils.mv(source, destination, **options) end
Source
# File lib/ceedling/file_wrapper.rb, line 83 def newer?(filepathA, filepathB) return false unless File.exist?(filepathA) return false unless File.exist?(filepathB) return (File.mtime(filepathA) > File.mtime(filepathB)) end
Is filepath A newer than B?
Source
# File lib/ceedling/file_wrapper.rb, line 90 def open(filepath, flags) File.open(filepath, flags) do |file| yield(file) end end
Source
# File lib/ceedling/file_wrapper.rb, line 96 def read(filepath, length=nil) return File.read(filepath, length) end
Source
# File lib/ceedling/file_wrapper.rb, line 110 def readlines(filepath) return File.readlines(filepath) end
Source
# File lib/ceedling/file_wrapper.rb, line 40 def relative?(path) return Pathname.new( path).relative? end
Source
# File lib/ceedling/file_wrapper.rb, line 54 def rm_f(filepath, options={}) FileUtils.rm_f(filepath, **options) end
Source
# File lib/ceedling/file_wrapper.rb, line 58 def rm_r(filepath, options={}) FileUtils.rm_r(filepath, **options={}) end
Source
# File lib/ceedling/file_wrapper.rb, line 62 def rm_rf(path, options={}) FileUtils.rm_rf(path, **options={}) end
Source
# File lib/ceedling/file_wrapper.rb, line 100 def touch(filepath, options={}) FileUtils.touch(filepath, **options) end
Source
# File lib/ceedling/file_wrapper.rb, line 104 def write(filepath, contents, flags='w') File.open(filepath, flags) do |file| file.write(contents) end end