Sha256: 11330c6b09e0b44eb170cae68bac8b84d58566f734e07e7c9a628d31d07323ed

Contents?: true

Size: 996 Bytes

Versions: 29

Compression:

Stored size: 996 Bytes

Contents

require 'utopia/version'
require 'fileutils'
require 'find'
require 'rake'

module Utopia
	module Setup
		ROOT = File.join(File.dirname(__FILE__), "setup", "")
		DIRECTORIES = ["access_log", "cache", "cache/meta", "cache/body", "lib", "pages", "public"]
		
		def self.copy(to, config = {})
			$stderr.puts "Copying files from #{ROOT} to #{to}..."
			Find.find(ROOT) do |src|
				dst = File.join(to, src[ROOT.size..-1])
				
				if File.directory?(src)
					FileUtils.mkdir_p(dst)
				else
					if File.exist? dst
						$stderr.puts "File already exists: #{dst}!"
					else
						$stderr.puts "Copying #{src} to #{dst}..."
						FileUtils.cp(src, dst)
					end
				end
			end
			
			DIRECTORIES.each do |path|
				FileUtils.mkdir_p(File.join(to, path))
			end
			
			$stderr.puts "Updating config.ru..."
			config_ru = File.join(to, "config.ru")
			buf = File.read(config_ru).gsub('$UTOPIA_VERSION', Utopia::VERSION::STRING.dump)
			File.open(config_ru, "w") { |fp| fp.write(buf) }
		end
	end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
utopia-0.10.0 lib/utopia/setup.rb
utopia-0.9.61 lib/utopia/setup.rb
utopia-0.9.60 lib/utopia/setup.rb
utopia-0.9.59 lib/utopia/setup.rb
utopia-0.9.58 lib/utopia/setup.rb
utopia-0.9.57 lib/utopia/setup.rb
utopia-0.9.56 lib/utopia/setup.rb
utopia-0.9.55 lib/utopia/setup.rb
utopia-0.9.54 lib/utopia/setup.rb
utopia-0.9.53 lib/utopia/setup.rb
utopia-0.9.52 lib/utopia/setup.rb
utopia-0.9.51 lib/utopia/setup.rb
utopia-0.9.50 lib/utopia/setup.rb
utopia-0.9.49 lib/utopia/setup.rb
utopia-0.9.48 lib/utopia/setup.rb
utopia-0.9.47 lib/utopia/setup.rb
utopia-0.9.46 lib/utopia/setup.rb
utopia-0.9.45 lib/utopia/setup.rb
utopia-0.9.43 lib/utopia/setup.rb
utopia-0.9.42 lib/utopia/setup.rb