@@ -5,16 +5,16 @@ It provides a friendly API for exploring package.yml and package_todo.yml files,
5
5
6
6
## Installation
7
7
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.
9
9
10
10
``` bash
11
- bundle add query_packwerk
11
+ gem install query_packwerk
12
12
```
13
13
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 :
15
15
16
16
``` bash
17
- gem install query_packwerk
17
+ bundle add query_packwerk --group=development
18
18
```
19
19
20
20
## Usage
@@ -27,37 +27,50 @@ The easiest way to use QueryPackwerk is through its interactive console:
27
27
query_packwerk console
28
28
```
29
29
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
+ ```
31
35
32
- Available commands in the console:
36
+ The console will use the local directory Packwerk context and provide you with all QueryPackwerk methods.
33
37
34
38
``` ruby
35
39
# Get all violations for a pack
36
- violations_for(" pack_name" )
40
+ query_packwerk: 001 : 0 > violations_for(" pack_name" )
37
41
38
42
# Get where violations occurred
39
- violation_sources_for(" pack_name" )
43
+ query_packwerk: 001 : 0 > violation_sources_for(" pack_name" )
40
44
41
45
# Get how often violations occurred
42
- violation_counts_for(" pack_name" )
46
+ query_packwerk: 001 : 0 > violation_counts_for(" pack_name" )
43
47
44
48
# Get the 'shape' of violations
45
- anonymous_violation_sources_for(" pack_name" )
49
+ query_packwerk: 001 : 0 > anonymous_violation_sources_for(" pack_name" )
46
50
47
51
# Get how often each shape occurs
48
- anonymous_violation_counts_for(" pack_name" )
52
+ query_packwerk: 001 : 0 > anonymous_violation_counts_for(" pack_name" )
49
53
50
54
# 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" )
52
59
53
60
# 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/ )
55
65
56
66
# 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/ )
58
71
59
72
# Reset the cache
60
- reload!
73
+ query_packwerk: 001 : 0 > reload!
61
74
```
62
75
63
76
### Ruby API
0 commit comments