last_green_go_pipeline 1.0.6 → 1.1.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6388b4c12f572f10f2ea6738487df1bf28a0f15
4
- data.tar.gz: 12e4facf16f3f9c917829cfda01a6140b76bf424
3
+ metadata.gz: ac773370f87965702077d7fee58659c1310dda85
4
+ data.tar.gz: e01e34d68577fb61d6bb6fb229842cb4969e3b62
5
5
  SHA512:
6
- metadata.gz: 67d96b289b42f19a86d7a1681be085257cb7fdf0cd66f48c52d038925384b1356949379afc865fefa0f26b0b41b66300295efcc6831baacd3f00eb4446d458ab
7
- data.tar.gz: dff8e8c217a62fa93e49bada7f3a686b01b21eefda5d8697b59aafbea909244b2532fb68e595eaa7dcfe94f3923be9a26ea316cf73f419b970ff91cc7ab27d1b
6
+ metadata.gz: aafdf4a7a3909dcea875573d12fa8f68e29b8722a4cf43b74c773f48b313583721611caf741f0b8b783f88c71eaa6c4f15c1225ce19c1cde23525a2bad1e6519
7
+ data.tar.gz: 63c63fc489e32ed9adcfabf6875c25c3adf2eb05be2985898321933dfaef5400c3eefc1fa1fe4008bbed106907021d52ec90ec970edb3785bf863f05db9d87a9
@@ -0,0 +1,15 @@
1
+ module GoCD
2
+
3
+ class GreenBuild
4
+
5
+ attr_reader :completed_at, :materials, :dependencies
6
+
7
+ def initialize(stage)
8
+ @completed_at = stage.completed_at
9
+ @materials = stage.pipeline.materials
10
+ @dependencies = stage.pipeline.dependencies
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -3,18 +3,21 @@ Bundler.setup
3
3
  require 'go_api_client'
4
4
  require 'pstore'
5
5
  require 'benchmark'
6
+ require_relative 'green_build'
6
7
 
7
8
  module GoCD
8
9
  class LastGreenBuildFetcher
9
10
 
11
+ PAGE_FETCH_LIMIT = 2
12
+
10
13
  def initialize(options)
11
14
  @options = options
12
15
  @pipeline = @options[:pipeline_name]
13
16
  @stage = @options.delete(:stage_name)
14
- @cache = PStore.new(File.expand_path(File.join(File.dirname(__FILE__), '..', '.last_green_builder_fetcher_cache')))
15
- @options.merge!(:latest_atom_entry_id => recall(:latest_atom_entry_id))
17
+ @cache = PStore.new(File.expand_path('./.last_green_build_fetcher_cache'))
18
+ @options.merge!(:latest_atom_entry_id => recall(:latest_atom_entry_id), :page_fetch_limit => PAGE_FETCH_LIMIT)
16
19
  if @options[:latest_atom_entry_id].nil? && ENV['QUIET'].nil?
17
- puts "Retrieving the feed for #{@options[:pipeline_name]}/#{@stage} for the first time. This could take quite awhile for pipelines with lots of history."
20
+ puts "Retrieving the the first #{PAGE_FETCH_LIMIT} feed pages for #{@options[:pipeline_name]}/#{@stage}."
18
21
  end
19
22
  end
20
23
 
@@ -32,11 +35,12 @@ module GoCD
32
35
  pipelines.reverse.each do |pipeline|
33
36
  stage = pipeline.stages.find { |stage| stage.name == @stage }
34
37
  if stage && stage.result == 'Passed'
35
- return stage.completed_at.tap { |time| remember(:latest_green_build_time, time) }
38
+ stage.pipeline = pipeline
39
+ remember(:last_green_build, GreenBuild.new(stage))
36
40
  end
37
41
  end
38
42
 
39
- recall :latest_green_build_time
43
+ recall :last_green_build
40
44
  end
41
45
 
42
46
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: last_green_go_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill DePhillips
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '1.1'
41
41
  description: friendly wrapper around the go-api-client that looks up the last green
42
42
  build of a Go.CD pipeline
43
43
  email:
@@ -47,6 +47,7 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - lib/go_cd/last_green_build_fetcher.rb
50
+ - lib/go_cd/green_build.rb
50
51
  - LICENSE
51
52
  - README.md
52
53
  homepage: https://github.com/rearadmiral/last_green_go_pipeline