Class: Guides::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/guides/cli.rb

Constant Summary collapse

ASSETS_ROOT =
File.expand_path("../assets", __FILE__)
SOURCE_ROOT =
File.expand_path("../source", __FILE__)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.basenameObject



11
12
13
# File 'lib/guides/cli.rb', line 11

def self.basename
  "guides"
end

Instance Method Details

#buildObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/guides/cli.rb', line 24

def build
  FileUtils.rm_rf("#{Guides.root}/output") if options[:clean]
  require "guides/generator"

  opts = options.dup

  opts[:only] ||= []

  generator = Guides::Generator.new(opts)
  generator.generate
end

#new(name) ⇒ Object



17
18
19
# File 'lib/guides/cli.rb', line 17

def new(name)
  invoke "guides:new:copy", [name, options[:name] || name]
end

#previewObject



45
46
47
# File 'lib/guides/cli.rb', line 45

def preview
  Preview.start
end

#versionObject



40
41
42
# File 'lib/guides/cli.rb', line 40

def version
  shell.say "Guides #{Guides::VERSION}", :green
end