lib/environment.rb in dev_tasks-0.0.146 vs lib/environment.rb in dev_tasks-0.0.147
- old
+ new
@@ -8,10 +8,33 @@
return "git" if(Dir.exists?(".git"))
return "svn" if(Dir.exists?(".svn"))
"none"
end
+ def self.copy src,dest
+ FileUtils.mkdir_p File.dirname(dest) if !File.exists?(File.dirname(dest))
+ FileUtils.cp(src,dest)
+ end
+
+ def self.copy_files files,dest
+ Console.debug("Environment.copy_files([#{files.to_s}],'#{dest}'')")
+ files.each{|f|
+ if(File.directory?(dest))
+ Console.debug "copying #{f} to #{dest}/#{f}"
+ FileUtils.cp(f,dest + "/" + f)
+ end
+ }
+ end
+
+ def self.svn_add_all dir
+ Dir.chdir(dir) do
+ Dir.glob('**/*').each{|f|
+ puts `svn add #{f}`
+ }
+ end
+ end
+
def self.scm_origin
if(Dir.exists?(".git"))
`git remote show origin`.scan(/Fetch URL: ([\w:\/.-]+)/).each{|m|
return m.first.to_s
}
@@ -28,10 +51,10 @@
if(Dir.exists?(".svn"))
`svn info`.scan(/Last Changed Rev: ([\d]+)/).each{|m|
return m.first.to_s
}
end
- ""
+ "0"
end
def self.dev_root
["DEV_HOME","DEV_ROOT","USERPROFILE","HOME"].each {|v|
return ENV[v].gsub('\\','/') unless ENV[v].nil?
\ No newline at end of file