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