Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/dev_environment.rb
Class Method Summary collapse
- .amalgamate(filename, source) ⇒ Object
- .publish(destination, source_dir, source_glob = '**/*') ⇒ Object
Class Method Details
.amalgamate(filename, source) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/dev_environment.rb', line 43 def self.amalgamate filename,source File.open(filename,'w'){|file| source.each{|source_file| file.puts IO.read(source_file) } } end |
.publish(destination, source_dir, source_glob = '**/*') ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/dev_environment.rb', line 51 def self.publish destination, source_dir, source_glob='**/*' output = "\n" if(File.exists?(destination)) #raise "Svn.publish: destination #{destination} already exists" puts "File.publish: destination #{destination} already exists" else # directory FileUtils.mkdir_p destination if !File.exists? destination files=nil Dir.chdir(source_dir) do files=FileList.new(source_glob).to_a end output = output + "\nfiles: #{files}.to_s" Dir.chdir(source_dir) do files.each{|f| FileUtils.cp(f,"#{destination}/#{f}") } end output end end |