lib/overapp/util/dir.rb in overapp-0.4.2 vs lib/overapp/util/dir.rb in overapp-0.5.0

- old
+ new

@@ -2,11 +2,18 @@ class << self def dir_files(dir) res = Dir["#{dir}/**/*"] + Dir["#{dir}/**/.*"] res = res - [".","..",".git"] res.reject { |x| FileTest.file?(x) && File.binary?(x) && !(x =~ /\.txt/) } - #raise rej.inspect unless rej.empty? - #res - rej + 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 => File.read(full_file)} + end end def with_local_path(overapp_path,&b) if Git.repo?(overapp_path) TmpDir.with_repo_path(overapp_path) do |dir| \ No newline at end of file