Sha256: aa5f3fe7817d4138460280e6c585cbff90663b3bf185f6535c46e072e9f26016
Contents?: true
Size: 1013 Bytes
Versions: 1
Compression:
Stored size: 1013 Bytes
Contents
module Overapp class << self def dir_files(dir) res = Dir["#{dir}/**/*"] + Dir["#{dir}/**/.*"] res = res - [".","..",".git"] res = res.select { |x| FileTest.file?(x) } end def dir_files_full(dir) raise "Dir not there #{dir}" unless FileTest.exist?(dir) dir_files(dir).map do |full_file| f = full_file.gsub("#{dir}/","") raise "bad #{f}" if f == full_file {:file => f, :body => read(full_file)} end end def read(file) if File.binary?(file) File.open(file,"rb") do |f| f.read end else File.read(file) end end def with_local_path(overapp_path,&b) if Git.repo?(overapp_path) TmpDir.with_repo_path(overapp_path) do |dir| b[dir] end else yield overapp_path end end def to_proper_dir(dir) base = File.expand_path(File.dirname(__FILE__) + "/../../..") dir.gsub("OVERAPP_ROOT_DIR",base) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
overapp-0.5.1 | lib/overapp/util/dir.rb |