puppet-autostager 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzU0ZTkxMjMwYzUyNDRiNjg3ZTdiNmY1YTc3MjUyYjkwZGYwMjczMQ==
4
+ ZTc4YTFlMGVhODg4YjcxODdhNjlmNjc5ZGZjNDFmMWRlMTU5MmNkNQ==
5
5
  data.tar.gz: !binary |-
6
- ZGU1ZjkzYTAzZTU4NDY5YWYyY2VmMThkMTYxMjQ5YjhhODQxOTY0ZA==
6
+ YTU4ZmI3YzI2MmFhMjFjNjczNGZmY2E3NzEzNWE2NThjNjUxMzNhOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWI5MWIxOWZmMDhhYjU5OWUyNTkwYzM4ZGRlY2Y0ZjM0YmQ4N2RmMDU3M2Uy
10
- ZDUxODNiNmNiYzQ2ZTg1Nzk1Yzk3NmFhMzkxNWFhYjFkYzE3OGFlNjBmMzcy
11
- NjEyMjFmMjk2ZWZjYmRiNzcxZTIzOWI3NjcwMGI1MWUzMzE2YjE=
9
+ YWFlZWE2YmRlYjBkMDk4OTQ0MDVlYWY5OWI0MTAwNjJjMGYzMDAzN2ZlOTMy
10
+ NmM5MTA4YzYyMzVmNmI0MmY3NTZmNjAxOTA3YWVjZjZjYWYyZWQxYzBlNjI3
11
+ NzFjNWQ1OTZlMjNiYjhhYmIxZjAzOTcyNTg4M2ZiZjI0YWE5Y2M=
12
12
  data.tar.gz: !binary |-
13
- YjEyOTg3ZjdjM2ViNzUzMWE0NzI2ODE2ZjliZjhkNTgxZWIyZDY0MzA2ZjE2
14
- NzE3YjNlYzMxYzgwZTkzYjIxNDJhMWJjZDFhYWQyNzUxODA5NjE2NmY1YjVl
15
- YWUzNmFjZDhlZTk2M2FhZWRiNzY0YTI1NWI4ZTkzZmM2ZmJmY2Y=
13
+ MmMwMmZkZTRhNTYyNmRhMTk3MjU5MWZiZDZmMmNlN2NjZDc4YjBjYzJmMWE5
14
+ N2JhOTI4YmE2MzQ0NDUyODFhYjJlZjg3ODA5MjQ2NTA3YTQwYmFlYzkxMGQw
15
+ NzMzYjEzNDg4NDkyMzRhNWIxZGM2YTVhMGJiZjgyYTM2ZjJmNGY=
data/circle.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  machine:
2
2
  environment:
3
3
  # If you change this, you need to change lib/autostager/version.rb
4
- VERSION: 0.0.9
4
+ VERSION: 0.0.10
5
5
 
6
6
  test:
7
7
  post:
@@ -127,9 +127,12 @@ module Autostager
127
127
  end
128
128
 
129
129
  def timeout_seconds
130
- ENV['timeout'].to_i || 120
131
- rescue
132
- 120
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.
@@ -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
@@ -3,5 +3,5 @@
3
3
  #
4
4
  # If you change this, you need to also change circle.yaml
5
5
  module Autostager
6
- VERSION = '0.0.9'
6
+ VERSION = '0.0.10'
7
7
  end
@@ -4,6 +4,7 @@ require 'mocha/setup'
4
4
  require 'English'
5
5
  require 'tempfile'
6
6
  require 'pp'
7
+ require 'autostager'
7
8
 
8
9
  RSpec.configure do |c|
9
10
  c.mock_with :mocha
@@ -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.9
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-03 00:00:00.000000000 Z
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