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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a26e3de617087db46be70072c1050e3cb80b0b71
4
- data.tar.gz: 8d54648720abe39d4d99aeb68204d53dcb8593e6
3
+ metadata.gz: ad463eea94421dcb4c862d3f380662754c5fb4e0
4
+ data.tar.gz: 78be3f0f6959e59b2dcb1ff859b6102452f9ba97
5
5
  SHA512:
6
- metadata.gz: 8ffc49c088988240519bc973da1ae0e9ef00c70eac7d4ec4320163ccc7fca6fd52cebc85a94bedf584b1c57e9c43f3ff83c98fbf8b6f7c06477efc40b409d4af
7
- data.tar.gz: b466b6e0049bf5fcc00c3e09ee24424b7a0140ccfa66233423d1a623a3694089962047735a08df7bd760c896102b2235b2cf68827b3efb20595efc7cc743c0cf
6
+ metadata.gz: b930098220e801aa0280a3b146953853a6025fd332564f4b283478b094cf8dec2a0a96fc02aade387c2c5ba0f44b3f9111d2f51b90e6ed839eafbefc8ea6f5c1
7
+ data.tar.gz: bf169fbf0b60e307544ee6dfe0c3952f59ef4451e96330a91038faccb625a75827637acad9f4d770ad5d31f2ed671aa71f38bd8390412c17491eff7c7e495074
data/lib/deis/helpers.rb CHANGED
@@ -1,10 +1,20 @@
1
- require 'pty'
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
- deis_command :login, username: ENV['DEIS_USERNAME'], password: ENV['DEIS_PASSWORD']
79
- (@retry_count += 1) > 3 ? raise(e) : retry
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 { @retry_count = nil }
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
- (@retry_count += 1) > 3 ? raise(e) : retry
113
+ retry
89
114
  rescue Deis::NonZeroExitError => e
90
- deis_command :login, username: ENV['DEIS_USERNAME'], password: ENV['DEIS_PASSWORD']
91
- (@retry_count += 1) > 3 ? raise(e) : retry
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
@@ -1,3 +1,3 @@
1
1
  module Deis
2
- VERSION = "1.0.9 "
2
+ VERSION = "1.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deis-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Waldrip