2010-05-06 15:05:24 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'fileutils'
|
2011-01-05 22:44:45 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'rainbow'
|
2010-05-06 15:05:24 +00:00
|
|
|
|
2010-09-15 22:31:29 +00:00
|
|
|
if !ARGV[0]
|
2011-01-05 22:44:45 +00:00
|
|
|
puts "Directory name required.".foreground(:red)
|
2010-09-15 22:31:29 +00:00
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
|
|
|
if File.directory?(ARGV[0])
|
2011-01-05 22:44:45 +00:00
|
|
|
puts "You can't overwrite an existing directory.".foreground(:red)
|
2010-05-06 15:05:24 +00:00
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
2011-01-05 22:44:45 +00:00
|
|
|
puts "Copying skel files...".foreground(:green)
|
2010-05-06 15:05:24 +00:00
|
|
|
FileUtils.cp_r File.expand_path(File.join(File.dirname(__FILE__), '..', 'skel')), ARGV[0]
|
2011-01-05 22:44:45 +00:00
|
|
|
|
|
|
|
puts "Making config directories...".foreground(:green)
|
2010-05-06 15:05:24 +00:00
|
|
|
FileUtils.mkdir_p File.join(ARGV[0], 'source')
|
2011-01-05 22:44:45 +00:00
|
|
|
FileUtils.mkdir_p File.join(ARGV[0], 'conf.d-original')
|
2010-05-06 15:05:24 +00:00
|
|
|
FileUtils.mkdir_p File.join(ARGV[0], 'conf.d')
|
2011-01-05 22:44:45 +00:00
|
|
|
|
|
|
|
print "Complete! ".bright.foreground(:green)
|
|
|
|
print "cd #{ARGV[0]}".bright.foreground(:yellow)
|
|
|
|
print " and run ".foreground(:green)
|
|
|
|
print "bundle exec rake -T ".bright.foreground(:yellow)
|
|
|
|
puts "to get started.".foreground(:green)
|