lib/gumdrop/cli/external.rb in gumdrop-0.8.0 vs lib/gumdrop/cli/external.rb in gumdrop-1.0.0

- old
+ new

@@ -8,11 +8,11 @@ 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 + method_option :template, aliases:'-t', desc:'Template to start from', required:true, default:'default' def new(name) template= options[:template] || 'default' if File.directory? gem_template_path(template) say "New site from template: #{template} (gem)" @@ -34,22 +34,27 @@ 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| + Dir[ home_template_path ].each do |name| say " - #{File.basename name}" if File.directory?(name) end end - private + desc "version", "Displays Gumdrop version" + def version + say "Gumdrop v#{ Gumdrop::VERSION }" + end - def gem_template_path(template='*') - File.join(self.class.source_root, 'templates', template) - end + private - def home_template_path(template='*') - File.expand_path File.join( "~", ".gumdrop", 'templates', template) - end + def gem_template_path(template='*') + self.class.source_root / 'templates' / template + end + + def home_template_path(template='*') + File.expand_path "~" / '.gumdrop' / 'templates' / template + end end end \ No newline at end of file