Top Level Namespace
Defined Under Namespace
Modules: Linecook
Classes: Image
Instance Method Summary
collapse
Instance Method Details
#load_config(directory) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/linecook-gem/util/common.rb', line 3
def load_config(directory)
@config ||= begin
Dir.chdir(directory) do
Kitchen::Config.new(
kitchen_root: Dir.pwd,
loader: Kitchen::Loader::YAML.new(
project_config: ENV['KITCHEN_YAML'] || File.join(Dir.pwd, '.kitchen.yml'),
local_config: ENV['KITCHEN_LOCAL_YAML'],
global_config: ENV['KITCHEN_GLOBAL_YAML']
)
)
end
end
end
|
#with_retries(retries, sleep_duration: 5, &block) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/linecook-gem/util/common.rb', line 21
def with_retries(retries, sleep_duration: 5, &block)
attempts = 0
while attempts < retries
begin
return yield
rescue => e
puts "Retrying a failed action, error was:"
puts e.message
sleep sleep_duration
ensure
attempts += 1
end
end
fail "Retries exceed (#{retries})"
end
|