Sha256: da0971569061d1d31789edd5b5d92c31802d92b75b48c58673eb9ff1a231a81d
Contents?: true
Size: 821 Bytes
Versions: 45
Compression:
Stored size: 821 Bytes
Contents
puts __FILE__ if defined?(DEBUG) require 'fileutils' class File def self.amalgamate filename,source File.open(filename,'w'){|file| source.each{|source_file| file.puts IO.read(source_file) } } end def self.publish destination, source_dir, source_glob='**/*', overwrite_existing=false output = "\n" # 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| file="#{destination}/#{f}" dirname=File.dirname(file) FileUtils.mkdir_p dirname if !File.exists? dirname FileUtils.cp(f,file) if !File.exists? file || overwrite_existing } end output end end
Version data entries
45 entries across 45 versions & 1 rubygems