Sha256: a970d7da37f969ecdb9befda11379e189eccd48299a71b84410ac521d1088dd1

Contents?: true

Size: 1.53 KB

Versions: 4

Compression:

Stored size: 1.53 KB

Contents

require 'thor'
require 'thor/actions'
# require 'active_support/secure_random'

module IceBreaker
  class CLI < Thor
    include Thor::Actions

    desc "new [app]", "Create a new Rails 3.1 application"
    long_desc <<-D
      IceBreaker 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.1 application.
    D
    
    def new(project)
      
      # Check for a gemset and warn if none
      gemset = `rvm gemset name`.chomp
      unless gemset == project
        say "Your current rvm gemset name is: #{gemset}"
        say "It is recommend that you use a separate RVM gemset called '#{project}' when creating a Rails project with IceBreaker.  This will keep your system gems clean."
        say "You can exit now and create it by running this command: rvm use 1.9.2@#{project} --create"
        if yes?("Would you like to exit now and create a separate RVM gemset for #{project}?")
          exit 0
        end
      end
            
      command = "rails new #{project} --skip-active-record --skip-test-unit --template=#{template} "
      puts "Creating new Rails 3.1 project with: #{command}"
      exec(command)
    end

    desc "version", "Prints IceBreaker's version information"
    def version
      say "IceBreaker version #{IceBreaker::VERSION}" #TODO: This isn't working in installed gem
    end
    map %w(-v --version) => :version

    private

    def template
      File.expand_path(File.dirname(__FILE__) + "/../../templates/bootstrap.rb")
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
icebreaker-0.1.6 lib/icebreaker/cli.rb
icebreaker-0.1.5 lib/icebreaker/cli.rb
icebreaker-0.1.4 lib/icebreaker/cli.rb
icebreaker-0.1.3 lib/icebreaker/cli.rb