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

Version Path
dev-2.0.194 lib/base/file.rb
dev-2.0.193 lib/base/file.rb
dev-2.0.192 lib/base/file.rb
dev-2.0.191 lib/base/file.rb
dev-2.0.190 lib/base/file.rb
dev-2.0.189 lib/base/file.rb
dev-2.0.188 lib/base/file.rb
dev-2.0.187 lib/base/file.rb
dev-2.0.186 lib/base/file.rb
dev-2.0.185 lib/base/file.rb
dev-2.0.184 lib/base/file.rb
dev-2.0.183 lib/base/file.rb
dev-2.0.182 lib/base/file.rb
dev-2.0.181 lib/base/file.rb
dev-2.0.180 lib/base/file.rb
dev-2.0.179 lib/base/file.rb
dev-2.0.178 lib/base/file.rb
dev-2.0.177 lib/base/file.rb
dev-2.0.176 lib/base/file.rb
dev-2.0.175 lib/base/file.rb