codeowners_rs 0.1.0-arm64-darwin
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 +7 -0
- data/.ruby-version +1 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +20 -0
- data/lib/codeowners_rs/3.0/codeowners_rs.bundle +0 -0
- data/lib/codeowners_rs/3.1/codeowners_rs.bundle +0 -0
- data/lib/codeowners_rs/3.2/codeowners_rs.bundle +0 -0
- data/lib/codeowners_rs/3.3/codeowners_rs.bundle +0 -0
- data/lib/codeowners_rs/3.4/codeowners_rs.bundle +0 -0
- data/lib/codeowners_rs/4.0/codeowners_rs.bundle +0 -0
- data/lib/codeowners_rs/rule.rb +21 -0
- data/lib/codeowners_rs/ruleset.rb +27 -0
- data/lib/codeowners_rs/version.rb +5 -0
- data/lib/codeowners_rs.rb +31 -0
- data/sig/codeowners_rs.rbs +4 -0
- metadata +63 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 0a0b1759116808a78ad8fddf55b8dbc421b6f7d056fb2fe31954155690d7b888
|
|
4
|
+
data.tar.gz: 05e88b3af97dddfc1e83fa3d0f2955c3e7cd2ca134ab16e931d55f3dac6417a5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: '0842a4e958c755f3b646ab3ea160a003800299282aacce5c6eaf6d80e7edfffac1f7a502864e2db29a1bc47d727dc574d058b43ce1c207ed0c88984b45bb8403'
|
|
7
|
+
data.tar.gz: 46c51c2be271b6b7592708682abb201f19d64f6fd9f8a93d110f4791e62bfbe6873b84a168c475dd0e733e22aef73f72738e224463652a104a6a7f566ce057f0
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.8
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Reid Lynch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# CodeownersRs
|
|
2
|
+
|
|
3
|
+
[](https://github.com/wrapbook/codeowners_rs/actions/workflows/test.yml?event=push)
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
gem "codeowners_rs"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
codeowners = CodeownersRs.load("/path/to/CODEOWNERS")
|
|
15
|
+
codeowners.rule_for_path("app/models/user.rb")
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Development
|
|
19
|
+
|
|
20
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake compile` to compile the Rust code. Run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
21
|
+
|
|
22
|
+
## Releasing
|
|
23
|
+
|
|
24
|
+
To create a new release, push a new version tag to GitHub, like v0.1.0. The `release.yml` workflow takes care of cross compilation and pushing to RubyGems.
|
|
25
|
+
|
|
26
|
+
## Contributing
|
|
27
|
+
|
|
28
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/wrapbook/codeowners_rs.
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
33
|
+
|
|
34
|
+
## Disclaimer
|
|
35
|
+
|
|
36
|
+
This project is provided as open source under the MIT License and is made available on an **"as is"** basis, without warranty of any kind, express or implied.
|
|
37
|
+
|
|
38
|
+
This repository is **not an official Wrapbook product**. Wrapbook makes no commitments regarding ongoing development, maintenance, bug fixes, security updates, or compatibility.
|
|
39
|
+
|
|
40
|
+
Use of this project is at your own risk.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
require "rubocop/rake_task"
|
|
6
|
+
require "rb_sys/extensiontask"
|
|
7
|
+
|
|
8
|
+
GEMSPEC = Gem::Specification.load("codeowners_rs.gemspec")
|
|
9
|
+
|
|
10
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
11
|
+
RuboCop::RakeTask.new
|
|
12
|
+
|
|
13
|
+
RbSys::ExtensionTask.new("codeowners_rs", GEMSPEC) do |ext|
|
|
14
|
+
ext.lib_dir = "lib/codeowners_rs"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc "Build the native extension and the gem"
|
|
18
|
+
task build: :compile
|
|
19
|
+
|
|
20
|
+
task default: %i[compile spec rubocop]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CodeownersRs
|
|
4
|
+
# Rule class represents a single CODEOWNERS rule
|
|
5
|
+
class Rule
|
|
6
|
+
# Rust bindings provide:
|
|
7
|
+
# attribute :pattern
|
|
8
|
+
# attribute :owners
|
|
9
|
+
# attribute :line_number
|
|
10
|
+
# def self.from_line(line, line_number)
|
|
11
|
+
# def match?(path)
|
|
12
|
+
|
|
13
|
+
def to_s
|
|
14
|
+
"#{pattern} #{owners.join(" ")}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def inspect
|
|
18
|
+
"#<#{self.class} pattern=#{pattern.inspect} owners=#{owners.inspect} line_number=#{line_number}>"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CodeownersRs
|
|
4
|
+
# Ruleset class represents a collection of CODEOWNERS rules
|
|
5
|
+
class Ruleset
|
|
6
|
+
# Rust bindings provide:
|
|
7
|
+
# attribute :path
|
|
8
|
+
# attribute :root
|
|
9
|
+
# attribute :rules
|
|
10
|
+
# def self.load(path, root)
|
|
11
|
+
# def self.build(content, root, path)
|
|
12
|
+
# def rules_for_path(path)
|
|
13
|
+
# def rule_for_path(path)
|
|
14
|
+
# def owners_for_path(path)
|
|
15
|
+
|
|
16
|
+
def owners_for_constant(constant)
|
|
17
|
+
path = Object.const_source_location(constant.to_s)&.first # [path, line_number]
|
|
18
|
+
path ? owners_for_path(path) : []
|
|
19
|
+
rescue NameError
|
|
20
|
+
[]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def inspect
|
|
24
|
+
"#<#{self.class} path=#{path.inspect} root=#{root.inspect}>"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "codeowners_rs/version"
|
|
4
|
+
require_relative "codeowners_rs/rule"
|
|
5
|
+
require_relative "codeowners_rs/ruleset"
|
|
6
|
+
require "codeowners_rs/codeowners_rs"
|
|
7
|
+
|
|
8
|
+
# Top-level module for the CodeownersRs gem
|
|
9
|
+
module CodeownersRs
|
|
10
|
+
class Error < StandardError; end
|
|
11
|
+
|
|
12
|
+
# Ruby interface matching the Elixir implementation
|
|
13
|
+
class << self
|
|
14
|
+
# Load a CODEOWNERS file and parse it
|
|
15
|
+
# @param path [String] Path to the CODEOWNERS file
|
|
16
|
+
# @param root [String] Root directory for the CODEOWNERS rules
|
|
17
|
+
# @return [Codeowners::Ruleset] Parsed CODEOWNERS Ruleset
|
|
18
|
+
def load(path, root: nil)
|
|
19
|
+
Ruleset.load(path.to_s, root)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Build a CODEOWNERS object from content string
|
|
23
|
+
# @param content [String] Content of CODEOWNERS file
|
|
24
|
+
# @param root [String] Root directory
|
|
25
|
+
# @param path [String] Path to the CODEOWNERS file (for reference)
|
|
26
|
+
# @return [Codeowners::Ruleset] Parsed CODEOWNERS Ruleset
|
|
27
|
+
def build(content:, root:, path: nil)
|
|
28
|
+
Ruleset.build(content, root, path)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: codeowners_rs
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: arm64-darwin
|
|
6
|
+
authors:
|
|
7
|
+
- Reid Lynch
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-02-20 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description:
|
|
14
|
+
email:
|
|
15
|
+
- rlynch@wrapbook.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".ruby-version"
|
|
21
|
+
- LICENSE.txt
|
|
22
|
+
- README.md
|
|
23
|
+
- Rakefile
|
|
24
|
+
- lib/codeowners_rs.rb
|
|
25
|
+
- lib/codeowners_rs/3.0/codeowners_rs.bundle
|
|
26
|
+
- lib/codeowners_rs/3.1/codeowners_rs.bundle
|
|
27
|
+
- lib/codeowners_rs/3.2/codeowners_rs.bundle
|
|
28
|
+
- lib/codeowners_rs/3.3/codeowners_rs.bundle
|
|
29
|
+
- lib/codeowners_rs/3.4/codeowners_rs.bundle
|
|
30
|
+
- lib/codeowners_rs/4.0/codeowners_rs.bundle
|
|
31
|
+
- lib/codeowners_rs/rule.rb
|
|
32
|
+
- lib/codeowners_rs/ruleset.rb
|
|
33
|
+
- lib/codeowners_rs/version.rb
|
|
34
|
+
- sig/codeowners_rs.rbs
|
|
35
|
+
homepage: https://github.com/wrapbook/codeowners_rs
|
|
36
|
+
licenses:
|
|
37
|
+
- MIT
|
|
38
|
+
metadata:
|
|
39
|
+
homepage_uri: https://github.com/wrapbook/codeowners_rs
|
|
40
|
+
changelog_uri: https://github.com/wrapbook/codeowners_rs/releases
|
|
41
|
+
post_install_message:
|
|
42
|
+
rdoc_options: []
|
|
43
|
+
require_paths:
|
|
44
|
+
- lib
|
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '3.0'
|
|
50
|
+
- - "<"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 4.1.dev
|
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '0'
|
|
58
|
+
requirements: []
|
|
59
|
+
rubygems_version: 3.5.23
|
|
60
|
+
signing_key:
|
|
61
|
+
specification_version: 4
|
|
62
|
+
summary: A Ruby CODEOWNERS parser powered by Rust
|
|
63
|
+
test_files: []
|