puppet-autostager 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/circle.yml +1 -1
- data/lib/autostager.rb +6 -3
- data/lib/autostager/cli.rb +2 -0
- data/lib/autostager/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/autostager_spec.rb +34 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTc4YTFlMGVhODg4YjcxODdhNjlmNjc5ZGZjNDFmMWRlMTU5MmNkNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTU4ZmI3YzI2MmFhMjFjNjczNGZmY2E3NzEzNWE2NThjNjUxMzNhOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWFlZWE2YmRlYjBkMDk4OTQ0MDVlYWY5OWI0MTAwNjJjMGYzMDAzN2ZlOTMy
|
10
|
+
NmM5MTA4YzYyMzVmNmI0MmY3NTZmNjAxOTA3YWVjZjZjYWYyZWQxYzBlNjI3
|
11
|
+
NzFjNWQ1OTZlMjNiYjhhYmIxZjAzOTcyNTg4M2ZiZjI0YWE5Y2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmMwMmZkZTRhNTYyNmRhMTk3MjU5MWZiZDZmMmNlN2NjZDc4YjBjYzJmMWE5
|
14
|
+
N2JhOTI4YmE2MzQ0NDUyODFhYjJlZjg3ODA5MjQ2NTA3YTQwYmFlYzkxMGQw
|
15
|
+
NzMzYjEzNDg4NDkyMzRhNWIxZGM2YTVhMGJiZjgyYTM2ZjJmNGY=
|
data/circle.yml
CHANGED
data/lib/autostager.rb
CHANGED
@@ -127,9 +127,12 @@ module Autostager
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def timeout_seconds
|
130
|
-
|
131
|
-
|
132
|
-
|
130
|
+
result = 120
|
131
|
+
if ENV.key?('timeout')
|
132
|
+
result = ENV['timeout'].to_i
|
133
|
+
fail 'timeout must be greater than zero seconds' if result <= 0
|
134
|
+
end
|
135
|
+
result
|
133
136
|
end
|
134
137
|
|
135
138
|
# A list of directories we never discard.
|
data/lib/autostager/cli.rb
CHANGED
@@ -8,6 +8,7 @@ module Autostager
|
|
8
8
|
|
9
9
|
# Entry point for the app.
|
10
10
|
# Stage pull requests on a 30-second loop.
|
11
|
+
# rubocop:disable MethodLength
|
11
12
|
def run
|
12
13
|
trap_interrupt
|
13
14
|
loop do
|
@@ -23,6 +24,7 @@ module Autostager
|
|
23
24
|
log 'Exit on interrupt'
|
24
25
|
exit!(0)
|
25
26
|
end
|
27
|
+
# rubocop:enable MethodLength
|
26
28
|
|
27
29
|
def sleep_interval
|
28
30
|
ENV['sleep_interval'].to_i || 30
|
data/lib/autostager/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Autostager do
|
5
|
+
describe 'timeout_seconds' do
|
6
|
+
it 'defaults to 120 seconds' do
|
7
|
+
ENV['timeout'] = nil
|
8
|
+
Autostager.timeout_seconds.should eql(120)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should use ENV["timeout"] if exists' do
|
12
|
+
ENV['timeout'] = '1'
|
13
|
+
Autostager.timeout_seconds.should eql(1)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'fails if timeout is zero' do
|
17
|
+
ENV['timeout'] = '0'
|
18
|
+
expect { Autostager.timeout_seconds }.to raise_error(RuntimeError)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'fails if timeout is negative' do
|
22
|
+
ENV['timeout'] = '-5'
|
23
|
+
expect { Autostager.timeout_seconds }.to raise_error(RuntimeError)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'dynamically adjusts based on env var' do
|
27
|
+
ENV['timeout'] = '1'
|
28
|
+
Autostager.timeout_seconds.should eql(1)
|
29
|
+
|
30
|
+
ENV['timeout'] = '2'
|
31
|
+
Autostager.timeout_seconds.should eql(2)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-autostager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -231,6 +231,7 @@ files:
|
|
231
231
|
- script/test
|
232
232
|
- spec/functional/placeholder_spec.rb
|
233
233
|
- spec/spec_helper.rb
|
234
|
+
- spec/unit/autostager_spec.rb
|
234
235
|
- spec/unit/friction_spec.rb
|
235
236
|
- templates/credentials
|
236
237
|
homepage: https://github.com/jumanjiman/autostager
|
@@ -260,4 +261,5 @@ summary: Create a puppet enviroment for each pull request
|
|
260
261
|
test_files:
|
261
262
|
- spec/functional/placeholder_spec.rb
|
262
263
|
- spec/spec_helper.rb
|
264
|
+
- spec/unit/autostager_spec.rb
|
263
265
|
- spec/unit/friction_spec.rb
|