deis-rails 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/deis/helpers.rb +37 -7
- data/lib/deis/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad463eea94421dcb4c862d3f380662754c5fb4e0
|
4
|
+
data.tar.gz: 78be3f0f6959e59b2dcb1ff859b6102452f9ba97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b930098220e801aa0280a3b146953853a6025fd332564f4b283478b094cf8dec2a0a96fc02aade387c2c5ba0f44b3f9111d2f51b90e6ed839eafbefc8ea6f5c1
|
7
|
+
data.tar.gz: bf169fbf0b60e307544ee6dfe0c3952f59ef4451e96330a91038faccb625a75827637acad9f4d770ad5d31f2ed671aa71f38bd8390412c17491eff7c7e495074
|
data/lib/deis/helpers.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
|
-
|
1
|
+
require 'pty'
|
2
2
|
require 'benchmark'
|
3
3
|
|
4
4
|
module Deis
|
5
|
+
|
6
|
+
def self.retry_counter
|
7
|
+
@retry_counter ||= 0
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.retry_counter=(int)
|
11
|
+
@retry_counter = int
|
12
|
+
end
|
13
|
+
|
5
14
|
module Helpers
|
6
15
|
|
7
16
|
def run_util(name, *args)
|
17
|
+
reset_retry!
|
8
18
|
status = false
|
9
19
|
time = Benchmark.realtime do
|
10
20
|
status = get_runner(name).new(*args).run
|
@@ -30,6 +40,19 @@ module Deis
|
|
30
40
|
false
|
31
41
|
end
|
32
42
|
|
43
|
+
def increment_retry!
|
44
|
+
Deis.retry_counter += 1
|
45
|
+
end
|
46
|
+
|
47
|
+
def reset_retry!
|
48
|
+
Deis.retry_counter == 0
|
49
|
+
end
|
50
|
+
|
51
|
+
def should_retry?
|
52
|
+
increment_retry!
|
53
|
+
Deis.retry_counter <= 3
|
54
|
+
end
|
55
|
+
|
33
56
|
def status(msg)
|
34
57
|
msg = "| #{msg} |"
|
35
58
|
sep = ''.ljust(msg.size, '-')
|
@@ -75,20 +98,27 @@ module Deis
|
|
75
98
|
rescue Errno::ENOENT
|
76
99
|
deis_local_command *cmds
|
77
100
|
rescue Deis::NonZeroExitError => e
|
78
|
-
|
79
|
-
|
101
|
+
raise e unless should_retry?
|
102
|
+
deis_login!
|
103
|
+
retry
|
80
104
|
end
|
81
105
|
|
82
106
|
def deis_local_command(*cmds)
|
83
107
|
@retry_count ||= 0
|
84
|
-
shell('./deis', *cmds).tap {
|
108
|
+
shell('./deis', *cmds).tap { reset_retry! }
|
85
109
|
rescue Errno::ENOENT => e
|
110
|
+
raise e unless should_retry?
|
86
111
|
shell 'curl -sSL http://deis.io/deis-cli/install.sh | sh -s 1.6.1'
|
87
112
|
singleton_class.send :alias_method, :deis_command, :deis_local_command
|
88
|
-
|
113
|
+
retry
|
89
114
|
rescue Deis::NonZeroExitError => e
|
90
|
-
|
91
|
-
|
115
|
+
raise(e) unless should_retry?
|
116
|
+
deis_login!
|
117
|
+
retry
|
118
|
+
end
|
119
|
+
|
120
|
+
def deis_login!
|
121
|
+
deis_command :login, ENV['DEIS_CONTROLLER_URL'], username: ENV['DEIS_USERNAME'], password: ENV['DEIS_PASSWORD']
|
92
122
|
end
|
93
123
|
|
94
124
|
def git_clone(url, flags = {})
|
data/lib/deis/version.rb
CHANGED