Class: Gumdrop::CLI::External

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/gumdrop/cli/external.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



8
9
10
# File 'lib/gumdrop/cli/external.rb', line 8

def self.source_root
  File.expand_path('../../../..', __FILE__)
end

Instance Method Details

#new(name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gumdrop/cli/external.rb', line 14

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
    return
  end
  # path= File.expand_path(name)
  # puts `cd #{path} && bundle install`
end

#templatesObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/gumdrop/cli/external.rb', line 36

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 ].each do |name|
    say " - #{File.basename name}" if File.directory?(name)
  end
end

#versionObject



48
49
50
# File 'lib/gumdrop/cli/external.rb', line 48

def version
  say "Gumdrop v#{ Gumdrop::VERSION }"
end