trivial/bin/trivialize
2010-03-21 15:10:08 -04:00

26 lines
1015 B
Ruby
Executable File

#!/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|
FileUtils.cp(File.join(*src), File.join(*dest))
end
puts "Done! Make sure you can use .htaccess files in your Webserver setup."