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 +4 -4
- data/Gemfile.lock +3 -5
- data/README.md +39 -0
- data/lib/code_owners.rb +3 -1
- data/lib/code_owners/version.rb +1 -1
- data/spec/code_owners_spec.rb +8 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ec4a3443c169b75a265f905e95b9ff9595c8dfa
|
4
|
+
data.tar.gz: e877e2806c91021cffb6973eaed76b99fe51e226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db2915fe732ca2f1136f53c4440871bf87d7ebb402a0759296796ff0496d6e9daaa126354bc34b5de6b7c81543a3bffb8e50f369877bb69524dfb017dd3453a3
|
7
|
+
data.tar.gz: 95d8fed0a564d327db457f1dee58109bab2cd6847edefa51556a4a3b2342ef4562b2c20b43d58bad2018c70c4312bae50d34d3ba970cdfc4f1c090f116f67ace
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
code_owners (1.0.
|
5
|
-
rake
|
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
|
31
|
+
rspec
|
34
32
|
|
35
33
|
BUNDLED WITH
|
36
34
|
1.16.1
|
data/README.md
ADDED
@@ -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
|
data/lib/code_owners.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/code_owners/version.rb
CHANGED
data/spec/code_owners_spec.rb
CHANGED
@@ -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.
|
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
|