Sha256: cdedfdaa5b189010a4926d63f610f50dacd0429230020a614132007182a93b1d
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
require 'thor' require 'thor/actions' require 'active_support/secure_random' module Mologue class CLI < Thor include Thor::Actions desc "new [app]", "Create a new Rails 3 application" long_desc <<-D Mologue 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 method_option :mongoid, :type => :boolean, :default => true, :banner => "Sets up mongoid as the ORM (with MongoDB)." method_option :auth, :type => :boolean, :default => true, :banner => "Sets up devise for authentication." method_option :admin, :type => :boolean, :default => true, :banner => "Sets up very basic admin" def new(project) opts = options.dup # Can't build an admin without devise if !opts[:auth] opts[:admin] = false; end # Env vars used in our template ENV['MOLOGUE_MONGOID'] = "true" if opts[:mongoid] ENV['MOLOGUE_AUTH'] = "true" if opts[:auth] ENV['MOLOGUE_ADMIN'] = "true" if opts[:admin] command = "rails new #{project} --template=#{template} --skip-test-unit --skip-prototype" command = "#{command} --skip-active-record" if ENV['MOLOGUE_MONGOID'] puts "Creating new Rails 3 project with: #{command}" exec(command) end desc "version", "Prints Mologue's version information" def version say "Mologue version #{Mologue::VERSION}" end map %w(-v --version) => :version private def template File.expand_path(File.dirname(__FILE__) + "/../../templates/bootstrap.rb") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mologue-0.0.1 | lib/mologue/cli.rb |