Module: Bard::CLI::Run

Defined in:
lib/bard/cli/run.rb

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bard/cli/run.rb', line 4

def self.included mod
  mod.class_eval do

    # HACK: we don't use Thor::Base#run, so its okay to stomp on it here
    original_verbose, $VERBOSE = $VERBOSE, nil
    Thor::THOR_RESERVED_WORDS -= ["run"]
    $VERBOSE = original_verbose

    desc "run <command>", "run the given command on production"
    def run *args
      server = config[:production]
      server.run! *args.join(" "), verbose: true
    rescue Bard::Command::Error => e
      puts red("!!! ") + "Running command failed: #{yellow(e.message)}"
      exit 1
    end

  end
end