concourse-github-status 0.1.1 → 0.2.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 +4 -4
- data/bin/out +1 -1
- data/concourse-github-status.gemspec +1 -1
- data/lib/github-status/core.rb +10 -0
- data/lib/github-status/out.rb +6 -43
- data/lib/github-status/support/params.rb +36 -0
- data/lib/github-status/support/source.rb +26 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 671d1ebaa2e944863686904025ef7252c39b5d0c
|
4
|
+
data.tar.gz: e8c349a3be0ebf7e42a3406ed2d0409024871d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e936d42a8ae1c7620909a0f52bdde2ba6e9830e273551b7391917e277f4ab407db1722307e088f7d912acdf0e3206f6c87b0e73aced85993c860a3ba6805ca3f
|
7
|
+
data.tar.gz: 553996668282beb56a416fddf488560facc85de32ece5ad1be43883094f7c2ff04a5d5ec0c9cf962c377b06c4dee5f55c6ba1d39b903c56e02c550115718d26b
|
data/bin/out
CHANGED
data/lib/github-status/out.rb
CHANGED
@@ -4,9 +4,14 @@ require 'concourse-fuselage'
|
|
4
4
|
require 'contracts'
|
5
5
|
require 'git'
|
6
6
|
require 'octokit'
|
7
|
+
require_relative 'core'
|
8
|
+
require_relative 'support/params'
|
7
9
|
|
8
10
|
module GitHubStatus
|
9
11
|
class Out < Fuselage::Out
|
12
|
+
include Core
|
13
|
+
include Support::Params
|
14
|
+
|
10
15
|
Contract None => Sawyer::Resource
|
11
16
|
def update!
|
12
17
|
github.create_status repo, sha, state, options
|
@@ -20,48 +25,6 @@ module GitHubStatus
|
|
20
25
|
{ 'context@sha' => "#{context}@#{sha}" }
|
21
26
|
end
|
22
27
|
|
23
|
-
Contract None => String
|
24
|
-
def repo
|
25
|
-
@repo ||= source.fetch 'repo'
|
26
|
-
rescue KeyError
|
27
|
-
STDERR.puts 'Source is missing repo'
|
28
|
-
abort
|
29
|
-
end
|
30
|
-
|
31
|
-
Contract None => String
|
32
|
-
def access_token
|
33
|
-
@access_token ||= source.fetch 'access_token'
|
34
|
-
rescue KeyError
|
35
|
-
STDERR.puts 'Source is missing access_token'
|
36
|
-
abort
|
37
|
-
end
|
38
|
-
|
39
|
-
Contract None => String
|
40
|
-
def state
|
41
|
-
@state ||= params.fetch 'state'
|
42
|
-
rescue KeyError
|
43
|
-
STDERR.puts 'Params is missing state'
|
44
|
-
abort
|
45
|
-
end
|
46
|
-
|
47
|
-
Contract None => String
|
48
|
-
def path
|
49
|
-
@path ||= params.fetch 'path'
|
50
|
-
rescue KeyError
|
51
|
-
STDERR.puts 'Params is missing path'
|
52
|
-
abort
|
53
|
-
end
|
54
|
-
|
55
|
-
Contract None => String
|
56
|
-
def context
|
57
|
-
@context ||= params.fetch 'context', 'concourse'
|
58
|
-
end
|
59
|
-
|
60
|
-
Contract None => String
|
61
|
-
def description
|
62
|
-
@description ||= params.fetch 'description', ''
|
63
|
-
end
|
64
|
-
|
65
28
|
Contract None => String
|
66
29
|
def target_url
|
67
30
|
@target_url ||= "#{atc_external_url}/builds/#{build_id}"
|
@@ -86,7 +49,7 @@ module GitHubStatus
|
|
86
49
|
|
87
50
|
Contract None => String
|
88
51
|
def sha
|
89
|
-
@
|
52
|
+
@sha ||= git.revparse 'HEAD'
|
90
53
|
end
|
91
54
|
|
92
55
|
Contract None => Octokit::Client
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'contracts'
|
2
|
+
|
3
|
+
module GitHubStatus
|
4
|
+
module Support
|
5
|
+
module Params
|
6
|
+
include ::Contracts::Core
|
7
|
+
include ::Contracts::Builtin
|
8
|
+
|
9
|
+
Contract None => String
|
10
|
+
def path
|
11
|
+
@path ||= params.fetch 'path'
|
12
|
+
rescue KeyError
|
13
|
+
STDERR.puts 'Params is missing path'
|
14
|
+
abort
|
15
|
+
end
|
16
|
+
|
17
|
+
Contract None => String
|
18
|
+
def state
|
19
|
+
@state ||= params.fetch 'state'
|
20
|
+
rescue KeyError
|
21
|
+
STDERR.puts 'Params is missing state'
|
22
|
+
abort
|
23
|
+
end
|
24
|
+
|
25
|
+
Contract None => String
|
26
|
+
def context
|
27
|
+
@context ||= params.fetch 'context', 'concourse'
|
28
|
+
end
|
29
|
+
|
30
|
+
Contract None => String
|
31
|
+
def description
|
32
|
+
@description ||= params.fetch 'description', ''
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'contracts'
|
2
|
+
|
3
|
+
module GitHubStatus
|
4
|
+
module Support
|
5
|
+
module Source
|
6
|
+
include ::Contracts::Core
|
7
|
+
include ::Contracts::Builtin
|
8
|
+
|
9
|
+
Contract None => String
|
10
|
+
def access_token
|
11
|
+
@access_token ||= source.fetch 'access_token'
|
12
|
+
rescue KeyError
|
13
|
+
STDERR.puts 'Source is missing access_token'
|
14
|
+
abort
|
15
|
+
end
|
16
|
+
|
17
|
+
Contract None => String
|
18
|
+
def repo
|
19
|
+
@repo ||= source.fetch 'repo'
|
20
|
+
rescue KeyError
|
21
|
+
STDERR.puts 'Source is missing repo'
|
22
|
+
abort
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concourse-github-status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Olstrom
|
@@ -84,7 +84,10 @@ files:
|
|
84
84
|
- README.org
|
85
85
|
- bin/out
|
86
86
|
- concourse-github-status.gemspec
|
87
|
+
- lib/github-status/core.rb
|
87
88
|
- lib/github-status/out.rb
|
89
|
+
- lib/github-status/support/params.rb
|
90
|
+
- lib/github-status/support/source.rb
|
88
91
|
homepage:
|
89
92
|
licenses:
|
90
93
|
- Apache-2.0
|