require 'thor' require 'thor/actions' module Gypsum class CLI < Thor # Includes include Thor::Actions desc "new [app]", "Create a new Rails 3.1 application" long_desc <<-D Gypsum will ask you a few questions to determine what features you would like to generate. Based on your answers it will setup a new Rails 3 application. D def new( project , template_name = "default" ) # Require the template runner require "#{Gypsum::GEM_ROOT}/templates/#{template_name}/#{template_name}.rb" # Invoke the template runner invoke "gypsum:templates:#{template_name}:on_invocation" # Execute the template exec(<<-COMMAND) rails new #{project} \ --template=#{Gypsum::GEM_ROOT}/templates/#{template_name}/bootstrap.rb \ --skip-test-unit \ --skip-prototype COMMAND end desc "version", "Prints Gypsum's version information" def version say "Gypsum version #{Gypsum::VERSION}" end map %w(-v --version) => :version end end