lois 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 7c723ed91bdb0815a2647d44d14320d512b6744ad2f822d4e4ca49ee5749c4fc
4
- data.tar.gz: 701199c6b460f62d9accc7320aa8e6766b7443cf8a55ae42e03c5ad5604a03e3
3
+ metadata.gz: b7f6a89f90e9bd03ac97be18338caee5b451acf27b6da1613eb181571e612ed3
4
+ data.tar.gz: 5b8338c28371e7c7fca4a2573b6d41a246bb3bdbe2d2f9b83dc94dff62b18aed
5
5
  SHA512:
6
- metadata.gz: a03a811f438d57648a1b95575a2eaf4e4f9baf3390ab87ed3f6ff173fda5e1adcdc47abd135279294eec01c019636a722181e439a2e7424194c06cd2841d324d
7
- data.tar.gz: 21a73e0ba0034f338271780997f2d1303122cfc8ce73264fef64568ff328a4781d858db5e5b06e485c63eaa081a2d6dd985566a813ddc32501b30e1c4e5c2ae7
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 Pull Request Statuses.
3
+ Lois reports statuses of CI results to GitHub Commit Statuses.
4
4
 
5
5
  ## Installation
6
6
 
@@ -9,7 +9,7 @@ module Lois
9
9
  ENV.fetch('CIRCLE_PROJECT_REPONAME')
10
10
  end
11
11
 
12
- def pull_request_sha
12
+ def commit_sha
13
13
  ENV.fetch('CIRCLE_SHA1')
14
14
  end
15
15
  end
@@ -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.pull_request_sha
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, :pull_request_sha
7
+ attr_reader :credentials, :organization, :repository, :commit_sha
8
8
 
9
- def initialize(credentials, organization, repository, pull_request_sha)
9
+ def initialize(credentials, organization, repository, commit_sha)
10
10
  @credentials = credentials
11
11
  @organization = organization
12
12
  @repository = repository
13
- @pull_request_sha = pull_request_sha
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 pull_request_status_api_url
29
- @pull_request_status_api_url ||= File.join(
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
- pull_request_sha
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(pull_request_status_api_url, basic_auth: auth, body: body.to_json)
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
@@ -1,3 +1,3 @@
1
1
  module Lois
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
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 Pull Request Statuses.'
12
- spec.description = 'Lois reports statuses of CI results to Github Pull Request Statuses.'
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.2
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-01-12 00:00:00.000000000 Z
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 Pull Request Statuses.
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.4
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 Pull Request Statuses.
295
+ summary: Lois reports statuses of CI results to Github Commit Statuses.
295
296
  test_files: []