Module: Cuken::Api::Common

Included in:
Cuken::Api::Chef::DataBag, Cuken::Api::Chef::Knife, Cuken::Api::Chef::Role
Defined in:
lib/cuken/api/common.rb

Instance Method Summary collapse

Instance Method Details

#clone_pull_error_check(res) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/cuken/api/common.rb', line 19

def clone_pull_error_check(res)
  if repo = res[/Could not find Repository /]
    raise RuntimeError, "Could not find Repository #{repo}", caller
  end
  if repo = res[/ERROR: (.*) doesn't exist. Did you enter it correctly?/,1]
    raise RuntimeError, "ERROR: #{repo} doesn't exist. Did you enter it correctly? #{repo}", caller
  end
end

#with_args(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cuken/api/common.rb', line 7

def with_args(*args)
  backup = ARGV.dup
  begin
    ARGV.replace(args)
    yield
  rescue Exception => e
    puts e.backtrace.join("\n") if $!.respond_to?(:status) && $!.status && $!.status > 0
  ensure
    ARGV.replace(backup)
  end
end