Created
January 17, 2012 20:20
-
-
Save elfassy/1628663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "rubygems" # ruby1.9 doesn't "require" it though | |
require "thor" | |
class CloneRails < Thor | |
include Thor::Actions | |
desc "new NAME, TEMPLATE", "Create a new rails app based on a template app" | |
method_options :template => "template" | |
def new(name) | |
puts "Copying the template..." | |
FileUtils.cp_r(options[:template],name) | |
FileUtils.cd(name) | |
puts "Generating your new application..." | |
run "rails g rename_to #{name}" | |
FileUtils.rm_r('vendor/plugins/Rename') | |
# commit to git | |
run "git init" | |
run "git add ." | |
run "git commit -a -m 'create initial application'" | |
puts <<-eos | |
============================================================================ | |
Your new Rails application is ready to go. | |
Don't forget to scroll up for important messages from installed generators. | |
eos | |
end | |
end | |
CloneRails.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment