@@ -5,16 +5,16 @@ It provides a friendly API for exploring package.yml and package_todo.yml files,
55
66## Installation
77
8- Install the gem and add to the application's Gemfile by executing:
8+ This gem provides a cli interface that can be used independently from your application.
99
1010``` bash
11- bundle add query_packwerk
11+ gem install query_packwerk
1212```
1313
14- If bundler is not being used to manage dependencies, install the gem by executing :
14+ You can also make it available in a specific application by adding it to your Gemfile :
1515
1616``` bash
17- gem install query_packwerk
17+ bundle add query_packwerk --group=development
1818```
1919
2020## Usage
@@ -27,37 +27,50 @@ The easiest way to use QueryPackwerk is through its interactive console:
2727query_packwerk console
2828```
2929
30- This will load the Packwerk context from your current directory and provide you with an interactive Ruby console with QueryPackwerk methods available.
30+ When the console loads, it will print a welcome message. You can access it any time with ` help ` :
31+
32+ ```
33+ query_packwerk:001:0> help
34+ ```
3135
32- Available commands in the console:
36+ The console will use the local directory Packwerk context and provide you with all QueryPackwerk methods.
3337
3438``` ruby
3539# Get all violations for a pack
36- violations_for(" pack_name" )
40+ query_packwerk: 001 : 0 > violations_for(" pack_name" )
3741
3842# Get where violations occurred
39- violation_sources_for(" pack_name" )
43+ query_packwerk: 001 : 0 > violation_sources_for(" pack_name" )
4044
4145# Get how often violations occurred
42- violation_counts_for(" pack_name" )
46+ query_packwerk: 001 : 0 > violation_counts_for(" pack_name" )
4347
4448# Get the 'shape' of violations
45- anonymous_violation_sources_for(" pack_name" )
49+ query_packwerk: 001 : 0 > anonymous_violation_sources_for(" pack_name" )
4650
4751# Get how often each shape occurs
48- anonymous_violation_counts_for(" pack_name" )
52+ query_packwerk: 001 : 0 > anonymous_violation_counts_for(" pack_name" )
4953
5054# Get who consumes this pack
51- consumers(" pack_name" )
55+ query_packwerk: 001 :0 > consumers(" pack_name" )
56+
57+ # Get a package
58+ query_packwerk: 001 :0 > package(" pack_name" )
5259
5360# Get all packages
54- Packages .all
61+ query_packwerk: 001 :0 > Packages .all
62+
63+ # Find a package
64+ query_packwerk: 001 :0 > Packages .where(name: /service/ )
5565
5666# Get all violations
57- Violations .all
67+ query_packwerk: 001 :0 > Violations .all
68+
69+ # Find violations
70+ query_packwerk: 001 :0 > Packages .where(constant_name: /Feature/ , producing_pack: /service/ )
5871
5972# Reset the cache
60- reload!
73+ query_packwerk: 001 : 0 > reload!
6174```
6275
6376### Ruby API
0 commit comments