Shopify / packwerk

Good things come in small packages.
MIT License
1.65k stars 113 forks source link

Packwerk Build Status

"I know who you are and because of that I know what you do." This knowledge is a dependency that raises the cost of change.

-- Sandi Metz, Practical Object-Oriented Design in Ruby

Packwerk is a Ruby gem used to enforce boundaries and modularize Rails applications.

Packwerk can be used to:

Prerequisites

Packwerk needs Zeitwerk enabled, which comes with Rails 6.

Packwerk supports MRI versions 2.7 and above.

Demo

Watch a 1-minute video demo on how Packwerk works.

Installation

  1. Add this line to your application's Gemfile:
gem 'packwerk'
  1. Install the gem

Execute:

$ bundle install

Or install it yourself as:

$ gem install packwerk
  1. Run bundle binstub packwerk to generate the binstub
  2. Run bin/packwerk init to generate the configuration files

Usage

Read USAGE.md for usage once Packwerk is installed on your project.

Pronunciation

"Packwerk" is pronounced [ˈpakvɛʁk].

Ecosystem

Various third parties have built tooling on top of packwerk. Here's a selection of some that might prove useful:

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

Limitations

With Ruby being a very dynamic language, static analysis tools such as Packwerk are bound to have limitations. To reduce the impact of those limitations, Packwerk is designed to avoid false positives (reporting references as violations that are actually fine) at any cost, and we pay the cost by accepting a small number of false negatives (failing to report actual violations).

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/packwerk.

Read and follow the guidelines in CONTRIBUTING.md.

License

The gem is available as open source under the terms of the MIT License.