packs
WIP: Rust implementation of packs and packwerk for ruby
Features
- It's entirely built in Rust, so it's really fast, and doesn't require any external dependencies since the binary contains everything that needed to run
packs! - Currently all
packscan do is generate a cache to be used by the ruby implementation.
Usage
One simple way to try out packs to generate your cache would be to create a bash function which wraps the call to bin/packwerk, like so:
# In your ~/.bash_profile or analogous file
You can also modify the bin/packwerk executable to call packs conditionally, e.g.
# In bin/packwerk
packs_executable = .chomp
if !packs_executable.empty?
if ARGV.first == || ARGV.first ==
puts
system(, , *ARGV[1..-1])
end
end
Verification
As packs is still a work-in-progress, it's possible it will not produce the same results as the ruby implementation (see below). If not, please file an issue!
To verify:
- Run
rm -rf tmp/cache/packwerkto delete the existing cache. - Run
packs generate_cache(see directions below to get binary) - Run
bin/packwerk updateto see how violations change usingpacks.
Downloading the Binary
Deployment ergonomics are still a WIP.
If you want to try it out:
- Go to https://github.com/alexevanczuk/packs/releases
- Download the
packsasset and runchmod +x path/to/packs - Open the containing directory, right click on the binary, click open, and then accept the warning message that says its from an unknown developer (it's me!)
- Execute
path/to/packsto see the CLI help message.
You can add path/to/packs to your PATH so it's available in every terminal session.
Deployment Improvements
In the future, I hope to:
- Somehow sign the binary so it does not get a warning message
- Make it executable before download
- Add directions to download via some other tool, or ship as a native ruby gem extension.
New to Rust?
Me too! This is my first Rust project, so I'd love to have feedback, advice, and contributions! If you're new to Rust, don't be intimidated! https://www.rust-lang.org has tons of great learning resources.
Not yet supported:
- custom associations
- custom inflections
- custom load paths
- zeitwerk default namespaces