Manage packs
Introduction
Packs are a specification for an extensible packaging system to help modularize Ruby applications.
- Documentation (github.com)
Create pack
$ bin/packs create packs/pack_name
Example
$ bin/packs create packs/profiles
Create new pack named profiles.
See: CLI documentation
Make a file or directory public
$ bin/packs make_public path/to/file.rb
$ bin/packs make_public path/to/directory
Example
$ bin/packs make_public \
packs/profiles/app/services/create_profile_service.rb
Make a file or directory public API by moving it under app/public/, so classes outside the pack can call CreateProfileService.
See: CLI documentation
Move files between packs
$ bin/packs move packs/destination_pack path/to/file.rb
$ bin/packs move packs/destination_pack path/to/directory
Move a file or directory from one pack to another, from the monolith or another pack.
See: CLI documentation
Move a pack to a folder
$ bin/packs move_to_folder packs/foo path/to/directory
Move packs/foo to path/to/directory, which must not contain a package.yml.
See: CLI documentation
Make a child pack
$ bin/packs move_to_parent packs/child_pack packs/parent_pack
Set packs/child_pack as a child of packs/parent_pack.
See: CLI documentation
Add dependency
$ bin/packs add_dependency packs/from_pack packs/to_pack
Add packs/to_pack to packs/from_pack/package.yml dependencies, sorted and deduplicated.
See: CLI documentation
Rename a pack
Get pack info
$ bin/packs get_info [ packs/my_pack packs/my_other_pack ]
Show size and violations for packs.
See: CLI documentation
CLI reference
$ bin/packs help [COMMAND]
$ bin/packs tree
Describe a command, or print a tree of all commands.
See: CLI documentation
Packs validity
Validate all packs
Check a pack
Update package.yml
Lints
Lint package_todo.yml
$ bin/packs lint_package_todo_yml_files
Check package_todo.yml files for formatting issues.
See: CLI documentation
Lint package.yml
$ bin/packs lint_package_yml_files \
[ packs/my_pack packs/my_other_pack ]
Lint package.yml files.
See: CLI documentation
List top violations
$ bin/packs list_top_violations type [ packs/your_pack ]
List top violations of a type (dependency, privacy, layer) for a pack, or all packs.
See: CLI documentation
Configuration
Pack paths
packs.yml
pack_paths:
- "{packs,utilities,deprecated}/*"
- "{packs,utilities,deprecated}/*/*"
- "gems/*"
Configure where packs live.
See: Configuration
README template
packs.yml
readme_template_path: my_folder/README_STUFF.md
Customize the generated README template via README_TEMPLATE.md.
See: Configuration
Also see
- Documentation (
packsgithub repository) - packs-specification
- packs-rails
- rubocop-packs
- packwerk
- packwerk-extensions
- code_ownership
- pack_stats
0 Comments for this cheatsheet. Write yours!