Module: Thor::Actions

Included in:
FWToolkit::Bitrise, FWToolkit::CLI, FWToolkit::Cocoapods, FWToolkit::Git, FWToolkit::Project, FWToolkit::Xcode, TemplateDirectory::DSL::Support
Defined in:
lib/fwtoolkit/cli/ext/thor.rb,
lib/fwtoolkit/cli/ext/thor.rb,
lib/fwtoolkit/cli/fw_actions/template_dir.rb

Defined Under Namespace

Classes: EmptyDirectory, TemplateDirectory

Instance Method Summary collapse

Instance Method Details

#run(command, config = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/fwtoolkit/cli/ext/thor.rb', line 6

def run(command, config={})
  command_output = run_base(command, config)
  if config[:raise_errors] && !$?.success?
    command_output.gsub!(/e\[\d+m/, '') #Stripping colors
    say "An error has occured while running: \"#{command}\"", :red
    say 'Command output:'
    raise Thor::Error, "\n***\n#{command_output}***"
  end
end

#run!(command, config = {}) ⇒ Object



16
17
18
19
# File 'lib/fwtoolkit/cli/ext/thor.rb', line 16

def run!(command, config={})
  config.merge!({ :raise_errors => true })
  run command, config
end

#run_baseObject



5
# File 'lib/fwtoolkit/cli/ext/thor.rb', line 5

alias_method :run_base, :run

#template_directory(source, *args, &block) ⇒ Object



8
9
10
11
12
# File 'lib/fwtoolkit/cli/fw_actions/template_dir.rb', line 8

def template_directory(source, *args, &block)
  config = args.last.is_a?(Hash) ? args.pop : {}
  destination = args.first || source
  action TemplateDirectory.new(self, source, destination || source, config, &block)
end