lois 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/lois/ci/circleci.rb +1 -1
- data/lib/lois/ci/travis.rb +17 -0
- data/lib/lois/cli.rb +3 -1
- data/lib/lois/github.rb +7 -7
- data/lib/lois/version.rb +1 -1
- data/lois.gemspec +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7f6a89f90e9bd03ac97be18338caee5b451acf27b6da1613eb181571e612ed3
|
4
|
+
data.tar.gz: 5b8338c28371e7c7fca4a2573b6d41a246bb3bdbe2d2f9b83dc94dff62b18aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a0bea349f231ccd4aaae50f83261faecbd91fe2e4421e9b8874e5571af692bfd3a241ffa0f8d37e8f58bd76aca148a7bfb302a0b0ceddff52b4de727f39c512
|
7
|
+
data.tar.gz: e05b7a73c0951e0cfecf8c51480ef3838bac6294bd9dd762202f28bc3f48d24deffaa342fba9109a8610d509c66274ba002762e035127881121ab0a4ace76770
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Lois [![CircleCI](https://circleci.com/gh/ketiko/lois.svg?style=svg)](https://circleci.com/gh/ketiko/lois)
|
2
2
|
|
3
|
-
Lois reports statuses of CI results to GitHub
|
3
|
+
Lois reports statuses of CI results to GitHub Commit Statuses.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
data/lib/lois/ci/circleci.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Lois
|
2
|
+
module Ci
|
3
|
+
class Travis
|
4
|
+
def organization
|
5
|
+
ENV.fetch('TRAVIS_REPO_SLUG').split('/')[0]
|
6
|
+
end
|
7
|
+
|
8
|
+
def repository
|
9
|
+
ENV.fetch('TRAVIS_REPO_SLUG').split('/')[1]
|
10
|
+
end
|
11
|
+
|
12
|
+
def commit_sha
|
13
|
+
ENV.fetch('TRAVIS_COMMIT')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/lois/cli.rb
CHANGED
@@ -125,6 +125,8 @@ module Lois
|
|
125
125
|
case options[:ci]
|
126
126
|
when 'circleci'
|
127
127
|
config.ci = Lois::Ci::Circleci.new
|
128
|
+
when 'travis'
|
129
|
+
config.ci = Lois::Ci::Travis.new
|
128
130
|
end
|
129
131
|
|
130
132
|
Dir.mkdir('lois') unless Dir.exist?('lois')
|
@@ -133,7 +135,7 @@ module Lois
|
|
133
135
|
config.github_credentials,
|
134
136
|
config.ci.organization,
|
135
137
|
config.ci.repository,
|
136
|
-
config.ci.
|
138
|
+
config.ci.commit_sha
|
137
139
|
)
|
138
140
|
end
|
139
141
|
end
|
data/lib/lois/github.rb
CHANGED
@@ -4,13 +4,13 @@ module Lois
|
|
4
4
|
class Github
|
5
5
|
Status = Struct.new(:state, :context, :description, :artifact_url)
|
6
6
|
|
7
|
-
attr_reader :credentials, :organization, :repository, :
|
7
|
+
attr_reader :credentials, :organization, :repository, :commit_sha
|
8
8
|
|
9
|
-
def initialize(credentials, organization, repository,
|
9
|
+
def initialize(credentials, organization, repository, commit_sha)
|
10
10
|
@credentials = credentials
|
11
11
|
@organization = organization
|
12
12
|
@repository = repository
|
13
|
-
@
|
13
|
+
@commit_sha = commit_sha
|
14
14
|
end
|
15
15
|
|
16
16
|
def pending(context, description, artifact_url = nil)
|
@@ -25,13 +25,13 @@ module Lois
|
|
25
25
|
update_status(Status.new('failure', context, description, artifact_url))
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
29
|
-
@
|
28
|
+
def commit_status_api_url
|
29
|
+
@commit_status_api_url ||= File.join(
|
30
30
|
'https://api.github.com/repos',
|
31
31
|
organization,
|
32
32
|
repository,
|
33
33
|
'statuses',
|
34
|
-
|
34
|
+
commit_sha
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
@@ -46,7 +46,7 @@ module Lois
|
|
46
46
|
description: status.description
|
47
47
|
}
|
48
48
|
body[:target_url] = status.artifact_url if status.artifact_url
|
49
|
-
response = ::HTTParty.post(
|
49
|
+
response = ::HTTParty.post(commit_status_api_url, basic_auth: auth, body: body.to_json)
|
50
50
|
return if response.success?
|
51
51
|
|
52
52
|
puts "Failed to update github: #{response.code}-#{response.body}"
|
data/lib/lois/version.rb
CHANGED
data/lois.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Ryan Hansen']
|
9
9
|
spec.email = ['ketiko@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = 'Lois reports statuses of CI results to Github
|
12
|
-
spec.description = 'Lois reports statuses of CI results to Github
|
11
|
+
spec.summary = 'Lois reports statuses of CI results to Github Commit Statuses.'
|
12
|
+
spec.description = 'Lois reports statuses of CI results to Github Commit Statuses.'
|
13
13
|
spec.homepage = 'https://www.github.com/ketiko/lois'
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lois
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Hansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -234,7 +234,7 @@ dependencies:
|
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
|
-
description: Lois reports statuses of CI results to Github
|
237
|
+
description: Lois reports statuses of CI results to Github Commit Statuses.
|
238
238
|
email:
|
239
239
|
- ketiko@gmail.com
|
240
240
|
executables:
|
@@ -265,6 +265,7 @@ files:
|
|
265
265
|
- lib/lois.rb
|
266
266
|
- lib/lois/ci.rb
|
267
267
|
- lib/lois/ci/circleci.rb
|
268
|
+
- lib/lois/ci/travis.rb
|
268
269
|
- lib/lois/cli.rb
|
269
270
|
- lib/lois/github.rb
|
270
271
|
- lib/lois/version.rb
|
@@ -288,8 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
289
|
version: '0'
|
289
290
|
requirements: []
|
290
291
|
rubyforge_project:
|
291
|
-
rubygems_version: 2.7.
|
292
|
+
rubygems_version: 2.7.6
|
292
293
|
signing_key:
|
293
294
|
specification_version: 4
|
294
|
-
summary: Lois reports statuses of CI results to Github
|
295
|
+
summary: Lois reports statuses of CI results to Github Commit Statuses.
|
295
296
|
test_files: []
|