Sha256: caecd54acd95275dda02095c345ead3c3cf8a46ad54f784ff117527eac4249bc
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true puts __FILE__ if defined?(DEBUG) require "fileutils" class File def self.amalgamate(filename, source) File.open(filename, "w") do |file| source.each do |source_file| file.puts IO.read(source_file) end end end # overwrite_existing=false def self.publish(destination, source_dir, source_glob = "**/*", exclude_glob = nil) output = "\n" FileUtils.mkdir_p destination unless File.exist? destination files = nil Dir.chdir(source_dir) do files = FileList.new(source_glob).to_a unless exclude_glob.nil? FileList.new(exclude_glob).to_a.each do |f| files.delete(f) if files.include?(f) end end end output += "\nfiles: #{files}.to_s" Dir.chdir(source_dir) do files.each do |f| file = "#{destination}/#{f}" dirname = File.dirname(file) FileUtils.mkdir_p dirname unless File.exist? dirname FileUtils.cp(f, file) unless File.exist? file # || overwrite_existing end end output end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dev-2.1.154 | lib/base/file.rb |