gocd 1.2 → 1.2.1

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: ff9162b128856ee7f0f2a2064e26b86360f37853
4
- data.tar.gz: 325206893d65edebe3193aa5f99ed3cffab5bc73
3
+ metadata.gz: bebfcffbf2b289e8a7b9a9b1c5dcbd71459f77d9
4
+ data.tar.gz: eb5079534dfecfb1328b730b625b07564ce5aa55
5
5
  SHA512:
6
- metadata.gz: 30cb568c05ce92b7e3f6c87a88e1a70a0260645cfe777e39614a75d2a7b7bdf518ad1b00c1b0ee315e2e9af7f96b903fd8c09bc0b050ce7675be54f020f4f383
7
- data.tar.gz: 17a2c1c0464ad067a5fa7e99ba2c6bd34aeb0d11b4d5b617cf82b84fbe98500a8eef80d87579555fe0eaffea922c74861649a452dc5364f9e4aafbe6fae02f6b
6
+ metadata.gz: 5adad969efae52ec49a18ac60d06c70d576c3bf6884caf7eea79241ee751cd2a878e77291709584f739d607ab01636453af150367c0a5f52e1389b8750e62dd7
7
+ data.tar.gz: dd8d446f38e5c3d3f45a0f1a42a40e3682a26fbebdf587ce3de573376c007e588720e3fed8a300fa6cdd3e9c6abbe309e63a5fcde73142195fa30de182762dd5
data/gocd.gemspec CHANGED
@@ -6,7 +6,7 @@ require_relative './lib/gocd/version.rb'
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'gocd'
8
8
  s.version = GOCD::VERSION
9
- s.date = '2017-02-25'
9
+ s.date = '2017-03-01'
10
10
  s.summary = 'Get info from gocd using its apis'
11
11
  s.description = s.summary
12
12
  s.authors = ['Ajit Singh']
@@ -25,7 +25,7 @@ module GOCD
25
25
  rescue => e
26
26
  error = <<-ERROR
27
27
  Could not fetch history for #{job.pipeline}::#{job.stage}::#{job.name}
28
- Response received from server: #{e.response}
28
+ Response received from server: #{e}
29
29
  ERROR
30
30
  response = nil
31
31
  puts error
@@ -1,3 +1,5 @@
1
+ require_relative './pipeline'
2
+
1
3
  module GOCD
2
4
  module PIPELINE_CONFIG
3
5
  class Template < Pipeline
@@ -23,5 +23,21 @@ module GOCD
23
23
  def green?
24
24
  @pipeline['lastBuildStatus'] == 'Success'
25
25
  end
26
+
27
+ def web_url
28
+ @pipeline['webUrl']
29
+ end
30
+
31
+ def last_build_time
32
+ @pipeline['lastBuildTime']
33
+ end
34
+
35
+ def last_build_label
36
+ @pipeline['lastBuildLabel']
37
+ end
38
+
39
+ def to_hash
40
+ @pipeline
41
+ end
26
42
  end
27
43
  end
data/lib/gocd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GOCD
2
- VERSION = '1.2'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -4,7 +4,7 @@ RSpec.describe GOCD::Pipeline, 'pipeline' do
4
4
 
5
5
  context 'when last build status is success' do
6
6
  before(:each) do
7
- @raw_pipeline = { 'name' => 'pipeline 1', 'activity' => 'sleeping', 'lastBuildStatus' => 'Success' }
7
+ @raw_pipeline = {'name' => 'pipeline 1', 'activity' => 'sleeping', 'lastBuildStatus' => 'Success'}
8
8
  end
9
9
 
10
10
  it '#name should return name' do
@@ -30,7 +30,7 @@ RSpec.describe GOCD::Pipeline, 'pipeline' do
30
30
 
31
31
  context 'when last build status is failure' do
32
32
  before(:each) do
33
- @raw_pipeline = { 'name' => 'pipeline 1', 'activity' => 'sleeping', 'lastBuildStatus' => 'Failure' }
33
+ @raw_pipeline = {'name' => 'pipeline 1', 'activity' => 'sleeping', 'lastBuildStatus' => 'Failure'}
34
34
  end
35
35
 
36
36
  it '#green? should return false' do
@@ -44,4 +44,17 @@ RSpec.describe GOCD::Pipeline, 'pipeline' do
44
44
  end
45
45
  end
46
46
 
47
+ it 'should have other details' do
48
+ @raw_pipeline = {
49
+ 'name' => 'pipeline 1', 'activity' => 'sleeping',
50
+ 'lastBuildStatus' => 'Success', 'webUrl' => 'http://someurl.com',
51
+ 'lastBuildLabel' => 'lable', 'lastBuildTime' => '2017-02-28'
52
+ }
53
+
54
+ pipeline = GOCD::Pipeline.new @raw_pipeline
55
+ expect(pipeline.web_url).to eq('http://someurl.com')
56
+ expect(pipeline.last_build_time).to eq('2017-02-28')
57
+ expect(pipeline.last_build_label).to eq('lable')
58
+ expect(pipeline.to_hash).to eq(@raw_pipeline)
59
+ end
47
60
  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
+ version: 1.2.1
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-02-25 00:00:00.000000000 Z
11
+ date: 2017-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport