|
| 1 | +--- |
| 2 | +title: Packs (ruby) |
| 3 | +category: Ruby libraries |
| 4 | +updated: 2024-07-05 |
| 5 | +intro: Packs are a specification for an extensible packaging system to help modularize Ruby applications. |
| 6 | +--- |
| 7 | + |
| 8 | +## Manage packs |
| 9 | + |
| 10 | +### Create pack |
| 11 | + |
| 12 | +```bash |
| 13 | +$ bin/packs create packs/pack_name |
| 14 | +``` |
| 15 | + |
| 16 | +#### Example |
| 17 | + |
| 18 | +```bash |
| 19 | +$ bin/packs create packs/profiles |
| 20 | +``` |
| 21 | + |
| 22 | +Create new pack named `profiles`. |
| 23 | + |
| 24 | +### Make a file or directory public |
| 25 | + |
| 26 | +```bash |
| 27 | +$ bin/packs make_public path/to/file.rb |
| 28 | +$ bin/packs make_public path/to/directory |
| 29 | +``` |
| 30 | + |
| 31 | +Make file or directory public API, meaning that classes outside the package can call this logic. |
| 32 | + |
| 33 | +#### Example |
| 34 | + |
| 35 | +```bash |
| 36 | +$ bin/packs make_public packs/profiles/app/services/create_profile_service.rb |
| 37 | +``` |
| 38 | + |
| 39 | +Allow external code to call the class `CreateProfileService`. |
| 40 | + |
| 41 | +This command will mainly move that file in `packs/profiles/app/public/create_profile_service.rb` |
| 42 | + |
| 43 | +### Move a pack |
| 44 | + |
| 45 | +```bash |
| 46 | +$ bin/packs move packs/destination_pack path/to/file.rb |
| 47 | +$ bin/packs move packs/destination_pack path/to/directory |
| 48 | +``` |
| 49 | + |
| 50 | +Move file or directory from one pack to another pack. |
| 51 | + |
| 52 | +```bash |
| 53 | +$ bin/packs move_to_folder packs/foo path/to/directory |
| 54 | +``` |
| 55 | + |
| 56 | +Move `packs/foo` to the `path/to/directory` folder, where `path/to/directory` does not contain a `package.yml` file. |
| 57 | + |
| 58 | +```bash |
| 59 | +$ bin/packs move_to_parent packs/child_pack packs/parent_pack |
| 60 | +``` |
| 61 | + |
| 62 | +Set `packs/child_pack` as a child of `packs/parent_pack`. |
| 63 | + |
| 64 | +### Add dependency to a pack |
| 65 | + |
| 66 | +```bash |
| 67 | +$ bin/packs add_dependency packs/from_pack packs/to_pack |
| 68 | +``` |
| 69 | + |
| 70 | +## Packs validity |
| 71 | + |
| 72 | +### All packs are valid? |
| 73 | + |
| 74 | +```bash |
| 75 | +$ bin/packs validate |
| 76 | +``` |
| 77 | + |
| 78 | +Runs `bin/packwerk validate` under the hood (detects cycles). |
| 79 | + |
| 80 | +### A specific pack is valid? |
| 81 | + |
| 82 | +```bash |
| 83 | +$ bin/packs check packs/pack_name |
| 84 | +``` |
| 85 | + |
| 86 | +Runs `bin/packwerk check` under the hood. |
| 87 | + |
| 88 | +### Update `package.yml` |
| 89 | + |
| 90 | +```bash |
| 91 | +$ bin/packs update |
| 92 | +``` |
| 93 | + |
| 94 | +Runs `bin/packwerk update-todo` under the hood. |
| 95 | + |
| 96 | +## Lints |
| 97 | + |
| 98 | +```bash |
| 99 | +$ bin/packs lint_package_todo_yml_files |
| 100 | +``` |
| 101 | + |
| 102 | +Lint `package_todo.yml` files to check for formatting issues. |
| 103 | + |
| 104 | +```bash |
| 105 | +$ bin/packs lint_package_yml_files [ packs/my_pack packs/my_other_pack ] |
| 106 | +``` |
| 107 | + |
| 108 | +Lint `package.yml` files. |
| 109 | + |
| 110 | +```bash |
| 111 | +$ bin/packs list_top_violations type [ packs/your_pack ] |
| 112 | +``` |
| 113 | + |
| 114 | +List the top violations of a specific type for `packs/your_pack`. |
| 115 | + |
| 116 | +## Also see |
| 117 | + |
| 118 | +- [Documentation](https://github.com/rubyatscale/packs) _(`packs` github repository)_ |
0 commit comments