Skip to content

Instantly share code, notes, and snippets.

@elfassy
Created January 17, 2012 20:20
Show Gist options
  • Save elfassy/1628663 to your computer and use it in GitHub Desktop.
Save elfassy/1628663 to your computer and use it in GitHub Desktop.
#!/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