Sha256: efa4213ffbbe2c9c61088e86dcc3ebc8176cb4df65b562b28da7da9b679a7029

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

#!/usr/bin/env ruby
 
require 'rubygems'
require 'thor'
require 'ruby-debug'
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'beet'
 
class BeetRunner < Thor
  default_task :help

  map "-g" => :generate
  map "-h" => :help
  map "-v" => :version
  map "-l" => :list

  desc 'generate [app_name]', "the main app generate method"
  method_options :templates => :optional, :gems => :optional
  def generate(app_name, type=:rails)
    case type
    when :rails
      puts "Generating rails project #{app_name}..."
      system("rails #{app_name}")
      executor = Beet::Executor.new(app_name, options)
      executor.start
    else
      puts "type not recognized!"
    end
  end

  desc 'list', "list what recipes beet knows about"
  def list
    paths = [] 
    paths << File.dirname(__FILE__) + '/../lib/beet/templates/**/*.rb'
    paths << ENV['BEET_TEMPLATES_DIR'] if ENV['BEET_TEMPLATES_DIR']
    recipes = paths.map do |path|
      Dir.glob(path)
    end.flatten.compact
    pp recipes
  end

  desc 'version', "the current version of beet"
  def version
    version_file = File.dirname(__FILE__) + '/../VERSION'
    if File.exists?(version_file) and version = File.read(version_file)
      puts "Beet version: #{version}"
    end
  end

  desc 'help', 'help output'
  def help
    puts %{
Usage: #{$0} /path/to/your/app [options]

Options:

Beet Info:
    -v, --version                    Show the Beet version number and quit.
    -h, --help                       Show this help message and quit.

General Options:

Description:
  Beet is used to quickly generate applications.

Example:
    beet example_app --git --clean_files 
} 
  end
end
BeetRunner.start

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jackdempsey-beet-0.0.6 bin/beet