Sha256: 1407b29f5307d1da94badc117bb7fdaebbdfcf64d0b72a655721dd25d5a68452
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require 'fileutils' require 'thor' module Gumdrop::CLI class External < Thor include Thor::Actions def self.source_root File.expand_path('../../../..', __FILE__) end desc 'new [NAME]', 'Create new gumdrop project' method_option :template, aliases:'-t', desc:'Template to start from', required:true def new(name) template= options[:template] || 'default' if File.directory? gem_template_path(template) say "New site from template: #{template} (gem)" directory(gem_template_path(template), name) elsif File.directory? home_template_path(template) say "New site from template: #{template} (local)" directory(home_template_path(template), name) else say "Unknown template!!\n" say "Please select from one of the following:\n\n" self.templates end end desc 'templates', 'List templates' def templates say "Gem templates:" Dir[ gem_template_path ].each do |name| say " - #{File.basename name}" if File.directory?(name) end say "Local templates:" Dir[ home_template_path t].each do |name| say " - #{File.basename name}" if File.directory?(name) end end private def gem_template_path(template='*') File.join(self.class.source_root, 'templates', template) end def home_template_path(template='*') File.expand_path File.join( "~", ".gumdrop", 'templates', template) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gumdrop-0.8.0 | lib/gumdrop/cli/external.rb |