Skip to content

Commit f07b5a7

Browse files
Docs and cleanups (#2)
* link to packwerk * make filenames into preformatted text * Move query methods up front * Consolidate the way to use it, and how it loads local context * Break out commands to 3 sections * sentence structure * Fix github urls * remove rbs if we aren't using it * Fix reference to welcome * another help reference
1 parent 3183ae2 commit f07b5a7

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

README.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# QueryPackwerk
22

3-
QueryPackwerk is a Ruby gem for querying and analyzing Packwerk violations in Ruby applications.
4-
It provides a friendly API for exploring package.yml and package_todo.yml files, making it easier to manage module boundaries and dependencies in your codebase.
3+
QueryPackwerk is a Ruby gem for querying and analyzing [Packwerk](https://github.com/Shopify/packwerk) violations in Ruby applications.
4+
It provides a friendly API for exploring `package.yml` and `package_todo.yml` files, making it easier to manage module boundaries and dependencies in your codebase.
55

66
## Installation
77

8-
This gem provides a cli interface that can be used independently from your application.
8+
This gem provides a CLI interface that can be used independently from your application.
99

1010
```bash
1111
gem install query_packwerk
@@ -21,19 +21,32 @@ bundle add query_packwerk --group=development
2121

2222
### Console Interface
2323

24-
The easiest way to use QueryPackwerk is through its interactive console:
24+
The easiest way to use QueryPackwerk is through its interactive console. This will use the local directory Packwerk context and provide you with all QueryPackwerk methods.
2525

2626
```bash
2727
query_packwerk console
2828
```
2929

30-
When the console loads, it will print a welcome message. You can access it any time with `help`:
30+
The CLI includes a welcome message with a list of commands. You can access it any time with `welcome`:
3131

3232
```
33-
query_packwerk:001:0> help
33+
query_packwerk:001:0> welcome
3434
```
3535

36-
The console will use the local directory Packwerk context and provide you with all QueryPackwerk methods.
36+
Find packages to work with:
37+
38+
```ruby
39+
# Get a package
40+
query_packwerk:001:0> package("pack_name")
41+
42+
# Get all packages
43+
query_packwerk:001:0> Packages.all
44+
45+
# Find a package
46+
query_packwerk:001:0> Packages.where(name: /service/)
47+
```
48+
49+
Explore violations:
3750

3851
```ruby
3952
# Get all violations for a pack
@@ -54,28 +67,21 @@ query_packwerk:001:0> anonymous_violation_counts_for("pack_name")
5467
# Get who consumes this pack
5568
query_packwerk:001:0> consumers("pack_name")
5669

57-
# Get a package
58-
query_packwerk:001:0> package("pack_name")
59-
60-
# Get all packages
61-
query_packwerk:001:0> Packages.all
62-
63-
# Find a package
64-
query_packwerk:001:0> Packages.where(name: /service/)
65-
6670
# Get all violations
6771
query_packwerk:001:0> Violations.all
6872

69-
# Find violations
70-
query_packwerk:001:0> Packages.where(constant_name: /Feature/, producing_pack: /service/)
73+
```
74+
75+
If you change any of the package.yml or package_todo.yml files, you can reload the running console:
7176

77+
```ruby
7278
# Reset the cache
7379
query_packwerk:001:0> reload!
7480
```
7581

7682
### Ruby API
7783

78-
You can also use QueryPackwerk programmatically in your Ruby code:
84+
QueryPackwerk can also be used programmatically from Ruby:
7985

8086
```ruby
8187
require 'query_packwerk'

query_packwerk.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Gem::Specification.new do |spec|
1010

1111
spec.summary = 'Query Packwerk'
1212
spec.description = 'Query Packwerk violations and dependencies.'
13-
spec.homepage = 'https://github.com/gusto/query_packwerk'
13+
spec.homepage = 'https://github.com/rubyatscale/query_packwerk'
1414
spec.license = 'MIT'
1515
spec.required_ruby_version = '>= 3.1.0'
1616

1717
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
1818

1919
spec.metadata['homepage_uri'] = spec.homepage
20-
spec.metadata['source_code_uri'] = 'https://github.com/gusto/query_packwerk'
21-
spec.metadata['changelog_uri'] = 'https://github.com/gusto/query_packwerk/blob/main/CHANGELOG.md'
20+
spec.metadata['source_code_uri'] = 'https://github.com/rubyatscale/query_packwerk'
21+
spec.metadata['changelog_uri'] = 'https://github.com/rubyatscale/query_packwerk/blob/main/CHANGELOG.md'
2222

2323
# Specify which files should be added to the gem when it is released.
2424
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.

sig/query_packwerk.rbs

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)