Sha256: c9349d39b4ebbdfe7bfa735fed41663484cfe89d847bc8da86c7e75f0316f4c3

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'thor'
require 'xcbootstrap/bootstrap'
require 'xcbootstrap/templates'

module XCBootstrap
  
  class Create < Thor
    
    Templates.all_templates.each do |template_name|
      desc template_name, "Create a project PROJECT_NAME based on the template '#{template_name}'"
      define_method(template_name) do |project_name|
        template_root = File.expand_path(File.join(File.dirname(__FILE__), "../../templates"))
        bootstrapper = Bootstrap.new(template_root, template_name, project_name)
        bootstrapper.process
        bootstrapper.finish
      end
    end
    
  end
  
  class Cli < Thor
    
    desc "list", "list available project templates"
    def list
      puts "Templates:"
      
      Templates.all_templates.each do |template|
        puts "  #{template}"
      end
    end
    
    desc "create", "Create a new project, in the current working directory, based on a specified template"
    subcommand "create", Create
    
    def self.exit_on_failure?
      true
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xcbootstrap-0.1.0 lib/xcbootstrap/cli.rb