Class: Texico::CLI::Command::Build

Inherits:
Base
  • Object
show all
Defined in:
lib/texico/cli/command/build.rb

Direct Known Subclasses

Release

Constant Summary collapse

SHADOW_BUILD_DIR =
'.build'.freeze

Instance Attribute Summary

Attributes inherited from Base

#opts, #prompt

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize, #load_config, match, priority, select

Constructor Details

This class inherits a constructor from Texico::CLI::Command::Base

Class Method Details

.match?(command) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/texico/cli/command/build.rb', line 34

def match?(command)
  command == 'build' || command.nil?
end

Instance Method Details

#build(config) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/texico/cli/command/build.rb', line 15

def build(config)
  compiler = Compiler.new output_directory: SHADOW_BUILD_DIR
  build_result = compiler.compile config[:main_file]
  
  return false unless build_result
  copy_build build_result[:file], config
  true
end

#runObject



7
8
9
10
11
12
13
# File 'lib/texico/cli/command/build.rb', line 7

def run
  config = load_config
  
  prompt.say "#{ICON} Building project", color: :bold
  
  build config
end