Sha256: 7aded932f1d31a1f66a7d185d6873d74a0ec793e954a695a3ccd52586f5afc5e

Contents?: true

Size: 1.37 KB

Versions: 17

Compression:

Stored size: 1.37 KB

Contents

require 'rubygems'
require 'rake' # for FileList
require 'constants'
require 'fileutils'


class FileWrapper

  def get_expanded_path(path)
    return File.expand_path(path)
  end

  def exist?(filepath)
    return true if (filepath == NULL_FILE_PATH)
    return File.exist?(filepath)
  end

  def directory?(path)
    return File.directory?(path)
  end

  def dirname(path)
    return File.dirname(path)
  end

  def directory_listing(glob)
    return Dir.glob(glob)
  end

  def rm_f(filepath, options={})
    FileUtils.rm_f(filepath, options)
  end

  def rm_r(filepath, options={})
    FileUtils.rm_r(filepath, options={})
  end
  
  def cp(source, destination, options={})
    FileUtils.cp(source, destination, options)
  end

  def compare(from, to)
    return FileUtils.compare_file(from, to)
  end
  
  def open(filepath, flags)
    File.open(filepath, flags) do |file|
      yield(file)
    end
  end

  def read(filepath)
    return File.read(filepath)
  end

  def touch(filepath, options={})
    FileUtils.touch(filepath, options)
  end

  def write(filepath, contents, flags='w')
    File.open(filepath, flags) do |file|
      file.write(contents)
    end    
  end

  def readlines(filepath)
    return File.readlines(filepath)
  end

  def instantiate_file_list(files=[])
    return FileList.new(files)
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ceedling-0.9.4 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.9.2 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.9.0 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.18 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.17 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.16 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.15 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.14 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.13 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.12 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.8 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.7 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.5 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.4 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.3 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.2 new_project_template/vendor/ceedling/lib/file_wrapper.rb
ceedling-0.0.1 new_project_template/vendor/ceedling/lib/file_wrapper.rb