Class: Statique::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/statique/cli.rb,
lib/statique/cli/init.rb,
lib/statique/cli/build.rb,
lib/statique/cli/server.rb

Defined Under Namespace

Classes: Build, Init, Server

Constant Summary collapse

COMMAND_ALIASES =
{
  "version" => %w[-v --version]
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



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

def initialize(*args)
  super
end

Class Method Details

.aliases_for(command_name) ⇒ Object



25
26
27
# File 'lib/statique/cli.rb', line 25

def self.aliases_for(command_name)
  COMMAND_ALIASES.select { |k, _| k == command_name }.invert
end

.exit_on_failure?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/statique/cli.rb', line 21

def self.exit_on_failure?
  true
end

Instance Method Details

#buildObject



42
43
44
45
# File 'lib/statique/cli.rb', line 42

def build
  statique.mode.build!
  Build.new(options.dup, statique).run
end

#initObject



31
32
33
# File 'lib/statique/cli.rb', line 31

def init
  Init.new(name).run
end

#serverObject



36
37
38
39
# File 'lib/statique/cli.rb', line 36

def server
  statique.mode.server!
  Server.new(statique).run
end

#versionObject



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

def version
  Statique.ui.info "Statique v#{Statique::VERSION}"
end