Sha256: fc332ffc689d524aa45e7ca502b36550ae21759eb22a8b9662fd2ec927ca86a6

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

module Plezi
	module Base
		module Builder

			GEM_ROOT = ::File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..'))

			def self.write_files files, parent = "."
				if files.is_a? Hash
					files.each do |k, v|
						if v.is_a? Hash
							begin
								Dir.mkdir k
								puts "    created #{parent}/#{k}".green
							rescue => e
								puts "    exists #{parent}/#{k}".red
							end
							Dir.chdir k
							write_files v, (parent + "/" + k)
							Dir.chdir ".."
						elsif v.is_a? String
							if ::File.exists? k
								if false #%w{Gemfile rakefile.rb}.include? k
									# old = IO.read k
									# old = (old.lines.map {|l| "\##{l}"}).join
									# IO.write k, "#####################\n#\n# OLD DATA COMMENTED OUT - PLEASE REVIEW\n#\n##{old}\n#{v}"
									# puts "    #{parent}/#{k} WAS OVERWRITTEN, old data was preserved by comenting it out.".pink
									# puts "    #{parent}/#{k} PLEASE REVIEW.".pink
									# @end_comments << "#{parent}/#{k} WAS OVERWRITTEN, old data was preserved by comenting it out. PLEASE REVIEW."
								else
									puts "    EXISTS(!) #{parent}/#{k}".red
								end
							else
								IO.write k, v
								puts "    wrote #{parent}/#{k}".yellow
							end
						end
					end
				end
			end
		end
	end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
plezi-0.12.22 lib/plezi/builders/builder.rb
plezi-0.12.21 lib/plezi/builders/builder.rb
plezi-0.12.20 lib/plezi/builders/builder.rb
plezi-0.12.19 lib/plezi/builders/builder.rb
plezi-0.12.18 lib/plezi/builders/builder.rb
plezi-0.12.17 lib/plezi/builders/builder.rb
plezi-0.12.16 lib/plezi/builders/builder.rb
plezi-0.12.15 lib/plezi/builders/builder.rb
plezi-0.12.14 lib/plezi/builders/builder.rb