code_owners 1.0.1 → 1.0.2

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: bc307747a22792a128d695f174820316e1854c24
4
- data.tar.gz: 3a8d98cb08c68ae917211a158b29851338c1485a
3
+ metadata.gz: 2ec4a3443c169b75a265f905e95b9ff9595c8dfa
4
+ data.tar.gz: e877e2806c91021cffb6973eaed76b99fe51e226
5
5
  SHA512:
6
- metadata.gz: 5d041bcf4991ae7a2a93a79fb9d0504707544d78c7b8e5881cb6e48e58628db9bf5f02d12037d755730360a6954b0abd9ce706503509bdac4efb25df65381572
7
- data.tar.gz: d6e685e7f8815541e0c6278e7dde16572b74218c02cc81ad8dfa97c1c0e940e05db2ac2b9d7e16985acae63103ca908b9c12fc04f4d3a559dca1b578a3a4cbc5
6
+ metadata.gz: db2915fe732ca2f1136f53c4440871bf87d7ebb402a0759296796ff0496d6e9daaa126354bc34b5de6b7c81543a3bffb8e50f369877bb69524dfb017dd3453a3
7
+ data.tar.gz: 95d8fed0a564d327db457f1dee58109bab2cd6847edefa51556a4a3b2342ef4562b2c20b43d58bad2018c70c4312bae50d34d3ba970cdfc4f1c090f116f67ace
@@ -1,13 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code_owners (1.0.0)
5
- rake (~> 12.3)
4
+ code_owners (1.0.2)
5
+ rake
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- byebug (9.0.6)
11
10
  diff-lcs (1.3)
12
11
  rake (12.3.1)
13
12
  rspec (3.7.0)
@@ -28,9 +27,8 @@ PLATFORMS
28
27
  ruby
29
28
 
30
29
  DEPENDENCIES
31
- byebug (~> 9.0)
32
30
  code_owners!
33
- rspec (~> 3.7)
31
+ rspec
34
32
 
35
33
  BUNDLED WITH
36
34
  1.16.1
@@ -0,0 +1,39 @@
1
+ Utility gem for .github/CODEOWNERS introspection
2
+
3
+ Install
4
+ =======
5
+
6
+ gem install code_owners
7
+
8
+ Usage
9
+ =====
10
+
11
+ your/repo/path$ code_owners
12
+
13
+ Output
14
+ ======
15
+
16
+ ```
17
+ vendor/cache/cloudfiles-1.4.16.gem UNOWNED
18
+ vendor/cache/code_owners-1.0.1.gem jcheatham per line 213, vendor/*/code_owners*
19
+ vendor/cache/coderay-1.1.0.gem UNOWNED
20
+ ```
21
+
22
+ Development
23
+ ======
24
+
25
+ Maybe put it in a cleanliness test, like:
26
+
27
+ ```
28
+ it "does not introduce new unowned files" do
29
+ unowned_files = CodeOwners.ownerships.select { |f| f[:owner] == "UNOWNED" }
30
+ # this number should only decrease, never increase!
31
+ assert_equal 12345, unowned_files.count, "Claim ownership of your new files in .github/CODEOWNERS to fix this test!"
32
+ end
33
+ ```
34
+
35
+ Author
36
+ ======
37
+ [Jonathan Cheatham](http://github.com/jcheatham)<br/>
38
+ coaxis@gmail.com<br/>
39
+ License: MIT
@@ -28,7 +28,9 @@ module CodeOwners
28
28
 
29
29
  # read the github file and spit out a slightly formatted list of patterns and their owners
30
30
  def pattern_owners
31
- File.read(".github/CODEOWNERS").split("\n").map do |line|
31
+ current_repo_path = `git rev-parse --show-toplevel`.strip
32
+ codeowner_path = File.join(current_repo_path, ".github/CODEOWNERS")
33
+ File.read(codeowner_path).split("\n").map do |line|
32
34
  line.gsub(/#.*/, '').gsub(/^$/, " @").split(/\s+@/, 2)
33
35
  end
34
36
  end
@@ -1,3 +1,3 @@
1
1
  module CodeOwners
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -25,6 +25,14 @@ RSpec.describe CodeOwners do
25
25
  expect(owners).to include("jcheatham")
26
26
  expect(patterns).to include("lib/*")
27
27
  end
28
+
29
+ it "works when invoked in a repo's subdirectory" do
30
+ Dir.chdir("spec") do
31
+ patterns, owners = CodeOwners.pattern_owners.transpose
32
+ expect(owners).to include("jcheatham")
33
+ expect(patterns).to include("lib/*")
34
+ end
35
+ end
28
36
  end
29
37
 
30
38
  describe ".raw_git_ownership" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_owners
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Cheatham
@@ -50,6 +50,7 @@ files:
50
50
  - Gemfile
51
51
  - Gemfile.lock
52
52
  - LICENSE
53
+ - README.md
53
54
  - Rakefile
54
55
  - bin/code_owners
55
56
  - code_owners.gemspec