gocd 1.2.4 → 1.2.5

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: b14d4c281fb1467b3540d3db5972c519373d7806
4
- data.tar.gz: c7d7a0fc282b1ab4a7eb098ac7601b76cd01ee74
3
+ metadata.gz: 593cc65e4e514367d8e90e8e4f0b94b10aab593e
4
+ data.tar.gz: a67d98d2fb10ad7b7737d9ea5af9bf57737a6108
5
5
  SHA512:
6
- metadata.gz: 376a77c2bb64a44768a459bbe5e342ca81a991cc9aba3bc1e483625e42158fbcd73eaf2db20aa29ca0eceb3da521a69ddf02f48cf29eba3945b116e2f8e2ca00
7
- data.tar.gz: 52d507212b4dfe030a93f85f8279d55677d0383e6264ec897823be3034df04820b7953f5432eb0c82613c35dfcf06f4be756c61ab7d208d8d97a772d5e20719c
6
+ metadata.gz: 07a84959366c3fb9115fbaa62784eb67ab843b096217103c622114756bba3fbdc94b9b5ba310baea7eb0bb1b6775f373852be0a6afc7aea34ecbf343a04208f6
7
+ data.tar.gz: 3da89e9e2ceb5a05b235c6b29751286093a2da1cc761f570e6dc6ccf7ddcfc9341f2a2a949594079a84e031254943b485e53109360875355aeed10b0b6abcaef
@@ -0,0 +1,11 @@
1
+ class PipelinesNotFoundException < Exception
2
+ attr_reader :missing_pipelines
3
+
4
+ def initialize(missing_pipelines)
5
+ @missing_pipelines = missing_pipelines
6
+ end
7
+
8
+ def message
9
+ "Could not find #{@missing_pipelines}"
10
+ end
11
+ end
@@ -54,6 +54,18 @@ module GOCD
54
54
 
55
55
  def pipelines
56
56
  all_pipelines = GOCD::PipelineRepository.pipelines
57
+ missing_pipelines = []
58
+ @pipelines.select do |pipeline|
59
+ if all_pipelines.find { |p| p.name == pipeline }.nil?
60
+ missing_pipelines << pipeline
61
+ end
62
+ end
63
+
64
+ unless missing_pipelines.empty?
65
+ exception = PipelinesNotFoundException.new(missing_pipelines)
66
+ raise exception, exception.message
67
+ end
68
+
57
69
  @pipelines.map do |pipeline|
58
70
  all_pipelines.find { |p| p.name == pipeline }
59
71
  end
@@ -1,3 +1,3 @@
1
1
  module GOCD
2
- VERSION = '1.2.4'
2
+ VERSION = '1.2.5'
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require './lib/gocd/pipeline_status/pipelines'
2
2
  require_relative '../../../lib/gocd/pipeline_status/pipeline_repository'
3
+ require_relative '../../../lib/gocd/exception/pipelines_not_found_exception'
3
4
 
4
5
  def mock_pipeline_repository
5
6
  pipeline1 = instance_double("Pipeline", :red? => true, :green? => false, :status => 'failing', :name => 'pipeline1')
@@ -76,5 +77,11 @@ RSpec.describe GOCD::AllPipelines, 'pipelines' do
76
77
  pipeline_group = GOCD::PipelineGroup.new %w(pipeline1 pipeline2)
77
78
  expect(pipeline_group.any_red?).to be_falsy
78
79
  end
80
+
81
+ it '#red_pipelines? should throw PipelinesNotFoundException when any of the pipeline is not present in the go response' do
82
+ mock_pipeline_repository_with_green_pipelines
83
+ pipeline_group = GOCD::PipelineGroup.new %w(pipeline1 pipeline3)
84
+ expect{pipeline_group.any_red?}.to raise_error(PipelinesNotFoundException).with_message("Could not find [\"pipeline3\"]")
85
+ end
79
86
  end
80
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gocd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ajit Singh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-17 00:00:00.000000000 Z
11
+ date: 2017-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -117,6 +117,7 @@ files:
117
117
  - lib/gocd/config/credentials.rb
118
118
  - lib/gocd/config/server.rb
119
119
  - lib/gocd/exception/data_fetch_exception.rb
120
+ - lib/gocd/exception/pipelines_not_found_exception.rb
120
121
  - lib/gocd/history/history_fetcher.rb
121
122
  - lib/gocd/pipeline_config/environment.rb
122
123
  - lib/gocd/pipeline_config/job.rb