Sha256: 9365b5bb121b3d271270ea4db73a280dd31c67b5ae3994dbf0c0d504815e9e22

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env ruby
require 'fileutils'

if !ARGV[0]
	puts "Please specify the name of a new directory to create & trivialize"
	exit 1
end

puts "Trivializing #{ARGV[0]}"
FileUtils.mkdir ARGV[0] if (!File.directory? ARGV[0])
%w{content actions views scripts styles lib}.each do |dir|
	FileUtils.mkdir File.join(ARGV[0], dir) if (!File.directory? File.join(ARGV[0], dir))
end

[
	[ [File.dirname(__FILE__), '..', 'lib', 'trivial.php'], [ARGV[0], 'lib', 'trivial.php'] ],
	[ [File.dirname(__FILE__), '..', 'dist', 'htaccess.dist'], [ARGV[0], '.htaccess'] ],
	[ [File.dirname(__FILE__), '..', 'views', 'application.inc'], [ARGV[0], 'views', 'application.inc'] ],
	[ [File.dirname(__FILE__), '..', 'content', 'index.html'], [ARGV[0], 'content', 'index.html'] ],
	[ [File.dirname(__FILE__), '..', 'styles', 'application.css'], [ARGV[0], 'styles', 'application.css'] ]
].each do |src, dest|
	if !File.exists? File.join(*dest)
		FileUtils.cp(File.join(*src), File.join(*dest))
	else
		puts "Won't overwrite existing #{File.join(*dest)}!"
	end
end

puts "Done! Make sure you can use .htaccess files in your Webserver setup."

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trivial-0.0.5 bin/trivialize
trivial-0.0.4 bin/trivialize