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



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/guides/cli.rb', line 26

def build
  if options[:clean]
    FileUtils.rm_rf(File.join(Guides.root, options[:production] ? 'output' : 'staging'))
  end

  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



52
53
54
# File 'lib/guides/cli.rb', line 52

def preview
  Preview.start(options)
end

#versionObject



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

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