Class: Staticz::BuildCommand

Inherits:
Object
  • Object
show all
Includes:
TTY::Option
Defined in:
lib/commands/build_command.rb

Instance Method Summary collapse

Instance Method Details

#runObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/commands/build_command.rb', line 39

def run
  if params[:help]
    print help
    exit
  end

  if !params[:environment]
    puts "Environment must either be development or production"
    exit 1
  end

  if params[:verbose]
    Staticz::Settings.verbose!
  end

  Staticz::Settings.set_environment(params[:environment])

  result = Staticz::Builder.new(listener_class: BuildListener).build

  if result.flatten.include? false
    exit 1
  end
end