module Overapp
Public Class Methods
dir_files(dir)
click to toggle source
# File lib/overapp/util/dir.rb, line 3 def dir_files(dir) res = Dir["#{dir}/**/*"] + Dir["#{dir}/**/.*"] res = res - [".","..",".git"] res = res.select { |x| FileTest.file?(x) } end
dir_files_full(dir)
click to toggle source
# File lib/overapp/util/dir.rb, line 8 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
ec(*args)
click to toggle source
# File lib/overapp/util/cmd.rb, line 3 def ec(*args) MharrisExt.ec(*args) end
file_create(*args)
click to toggle source
# File lib/overapp/util/file.rb, line 3 def file_create(*args) File.create(*args) end
load_files!()
click to toggle source
# File lib/overapp.rb, line 13 def self.load_files! %w(files template_file project from_command var).each do |f| load File.dirname(__FILE__) + "/overapp/#{f}.rb" end %w(base instance factory).each do |f| load File.dirname(__FILE__) + "/overapp/load/#{f}.rb" end %w(command raw_dir local_dir repo empty project).each do |f| load File.dirname(__FILE__) + "/overapp/load/types/#{f}.rb" end %w(config write config_entry).each do |f| load File.dirname(__FILE__) + "/overapp/project/#{f}.rb" end %w(tmp_dir git dir cmd write file).each do |f| load File.dirname(__FILE__) + "/overapp/util/#{f}.rb" end %w(params body_mod var_obj).each do |f| load File.dirname(__FILE__) + "/overapp/template_file/#{f}.rb" end end
read(file)
click to toggle source
# File lib/overapp/util/dir.rb, line 17 def read(file) if File.binary?(file) File.open(file,"rb") do |f| f.read end else File.read(file) end end
to_proper_dir(dir)
click to toggle source
# File lib/overapp/util/dir.rb, line 38 def to_proper_dir(dir) base = File.expand_path(File.dirname(__FILE__) + "/../../..") dir.gsub("OVERAPP_ROOT_DIR",base) end
with_local_path(overapp_path) { |overapp_path| ... }
click to toggle source
# File lib/overapp/util/dir.rb, line 28 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
write_project(overapp_path,output_path)
click to toggle source
# File lib/overapp/util/write.rb, line 3 def write_project(overapp_path,output_path) Overapp.with_local_path(overapp_path) do |dir| Overapp::Project.new(:path => dir).write_to!(output_path) end end