Packs are a specification for an extensible packaging system to help modularize Ruby applications.

Manage packs

Create pack

$ bin/packs create packs/pack_name

Example

$ bin/packs create packs/profiles

Create new pack named profiles.

Make a file or directory public

$ bin/packs make_public path/to/file.rb
$ bin/packs make_public path/to/directory

Make file or directory public API, meaning that classes outside the package can call this logic.

Example

$ bin/packs make_public packs/profiles/app/services/create_profile_service.rb

Allow external code to call the class CreateProfileService.

This command will mainly move that file in packs/profiles/app/public/create_profile_service.rb

Move a pack

$ bin/packs move packs/destination_pack path/to/file.rb
$ bin/packs move packs/destination_pack path/to/directory

Move file or directory from one pack to another pack.

$ bin/packs move_to_folder packs/foo path/to/directory

Move packs/foo to the path/to/directory folder, where path/to/directory does not contain a package.yml file.

$ bin/packs move_to_parent packs/child_pack packs/parent_pack

Set packs/child_pack as a child of packs/parent_pack.

Add dependency to a pack

$ bin/packs add_dependency packs/from_pack packs/to_pack

Packs validity

All packs are valid?

$ bin/packs validate

Runs bin/packwerk validate under the hood (detects cycles).

A specific pack is valid?

$ bin/packs check packs/pack_name

Runs bin/packwerk check under the hood.

Update package.yml

$ bin/packs update

Runs bin/packwerk update-todo under the hood.

Lints

$ bin/packs lint_package_todo_yml_files

Lint package_todo.yml files to check for formatting issues.

$ bin/packs lint_package_yml_files [ packs/my_pack packs/my_other_pack ]

Lint package.yml files.

$ bin/packs list_top_violations type [ packs/your_pack ]

List the top violations of a specific type for packs/your_pack.

Also see

0 Comments for this cheatsheet. Write yours!