Skip to content

Commit

Permalink
Rename UsePackwerk to UsePacks (#62)
Browse files Browse the repository at this point in the history
* Rename UsePackwerk to UsePacks

* Version reset

* Change name
  • Loading branch information
Alex Evanczuk authored Dec 9, 2022
1 parent a159f17 commit c929819
Show file tree
Hide file tree
Showing 44 changed files with 310 additions and 310 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
See https://github.com/rubyatscale/use_packwerk/releases
See https://github.com/rubyatscale/use_packs/releases
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in use_packwerk.gemspec
# Specify your gem's dependencies in use_packs.gemspec
gemspec
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
use_packwerk (0.70.0)
use_packs (0.0.1)
code_ownership
colorize
packwerk (>= 2.2.1)
Expand Down Expand Up @@ -36,7 +36,7 @@ GEM
smart_properties
builder (3.2.4)
byebug (11.1.3)
code_ownership (1.29.0)
code_ownership (1.29.1)
code_teams (~> 1.0)
parse_packwerk
sorbet-runtime
Expand All @@ -58,7 +58,7 @@ GEM
method_source (1.0.0)
mini_portile2 (2.8.0)
minitest (5.16.3)
nokogiri (1.13.9)
nokogiri (1.13.10)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
packwerk (2.2.2)
Expand All @@ -84,7 +84,7 @@ GEM
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
racc (1.6.0)
racc (1.6.1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -124,7 +124,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
rubocop-packs (0.0.29)
rubocop-packs (0.0.30)
activesupport
parse_packwerk
rubocop
Expand Down Expand Up @@ -209,7 +209,7 @@ DEPENDENCIES
sorbet
sorbet-static
tapioca
use_packwerk!
use_packs!

BUNDLED WITH
2.2.29
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# UsePackwerk
# UsePacks

UsePackwerk is a gem that helps in creating and maintaining packs. It exists to help perform some basic operations needed for pack setup and configuration. It provides a basic ruby file packager utility for [`packwerk`](https://github.com/Shopify/packwerk/). It assumes you are using [`stimpack`](https://github.com/rubyatscale/stimpack) to organize your packages.
UsePacks is a gem that helps in creating and maintaining packs. It exists to help perform some basic operations needed for pack setup and configuration. It provides a basic ruby file packager utility for [`packwerk`](https://github.com/Shopify/packwerk/). It assumes you are using [`stimpack`](https://github.com/rubyatscale/stimpack) to organize your packages.

## Usage
### General Help
Expand Down Expand Up @@ -45,8 +45,8 @@ This can be used to quickly modify a `package.yml` file and add a dependency. It

### Setting up Spring

[Spring](https://github.com/rails/spring) is a preloader for Rails. Although `use_packwerk` itself does not use `Rails`, this can help speed up running commands like `bin/packs` by caching the bundle.
Firstly, spring needs to know about the `bin/packs` command when spring is loading. To do that, add `require 'use_packwerk/spring_command'` to `config/spring.rb` in your application.
[Spring](https://github.com/rails/spring) is a preloader for Rails. Although `use_packs` itself does not use `Rails`, this can help speed up running commands like `bin/packs` by caching the bundle.
Firstly, spring needs to know about the `bin/packs` command when spring is loading. To do that, add `require 'use_packs/spring_command'` to `config/spring.rb` in your application.
Secondly, to enable Spring, first run `bin/spring binstub packs` which will "springify" the generated binstub.

### Releasing
Expand All @@ -56,16 +56,16 @@ Releases happen automatically through github actions once a version update is co
To keep things organized, here are some recommended homes:

### Issues:
https://github.com/Gusto/use_packwerk/issues
https://github.com/Gusto/use_packs/issues

### Questions:
https://github.com/Gusto/use_packwerk/discussions/categories/q-a
https://github.com/Gusto/use_packs/discussions/categories/q-a

### General discussions:
https://github.com/Gusto/use_packwerk/discussions/categories/general
https://github.com/Gusto/use_packs/discussions/categories/general

### Ideas, new features, requests for change:
https://github.com/Gusto/use_packwerk/discussions/categories/ideas
https://github.com/Gusto/use_packs/discussions/categories/ideas

### Showcasing your work:
https://github.com/Gusto/use_packwerk/discussions/categories/show-and-tell
https://github.com/Gusto/use_packs/discussions/categories/show-and-tell
4 changes: 2 additions & 2 deletions advanced_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Pack Maintenance
### Setting Privacy
```ruby
UsePackwerk.create_pack!(
UsePacks.create_pack!(
# This determines whether your package.yml in your new package will enforce privacy. See packwerk documentation for more details on this attribute.
# This is an optional parameter (default is true). See https://github.com/Gusto/packs/discussions/19
enforce_privacy: false,
Expand All @@ -11,7 +11,7 @@ UsePackwerk.create_pack!(
```

### Per-file Processors
Your application may have specific needs when moving files. `UsePackwerk` gives a way to inject application-specific behavior into the file move process.
Your application may have specific needs when moving files. `UsePacks` gives a way to inject application-specific behavior into the file move process.

You can pass in an array of application specific behavior into the `per_file_processors` parameter of the main method.

Expand Down
6 changes: 3 additions & 3 deletions bin/packs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
# typed: strict

require_relative '../lib/use_packwerk'
require_relative '../lib/use_packs'

if ARGV.empty?
UsePackwerk.start_interactive_mode!
UsePacks.start_interactive_mode!
else
UsePackwerk::CLI.start(ARGV)
UsePacks::CLI.start(ARGV)
end
38 changes: 19 additions & 19 deletions lib/use_packwerk.rb → lib/use_packs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
require 'rubocop-packs'

# Private implementation requires
require 'use_packwerk/private'
require 'use_packwerk/per_file_processor_interface'
require 'use_packwerk/rubocop_post_processor'
require 'use_packwerk/code_ownership_post_processor'
require 'use_packwerk/logging'
require 'use_packwerk/configuration'
require 'use_packwerk/cli'

module UsePackwerk
require 'use_packs/private'
require 'use_packs/per_file_processor_interface'
require 'use_packs/rubocop_post_processor'
require 'use_packs/code_ownership_post_processor'
require 'use_packs/logging'
require 'use_packs/configuration'
require 'use_packs/cli'

module UsePacks
extend T::Sig

PERMITTED_PACK_LOCATIONS = T.let(%w[
Expand Down Expand Up @@ -70,7 +70,7 @@ def self.move_to_pack!(
per_file_processors: []
)
Logging.section('👋 Hi!') do
intro = UsePackwerk.config.user_event_logger.before_move_to_pack(pack_name)
intro = UsePacks.config.user_event_logger.before_move_to_pack(pack_name)
Logging.print_bold_green(intro)
end

Expand All @@ -81,7 +81,7 @@ def self.move_to_pack!(
)

Logging.section('Next steps') do
next_steps = UsePackwerk.config.user_event_logger.after_move_to_pack(pack_name)
next_steps = UsePacks.config.user_event_logger.after_move_to_pack(pack_name)
Logging.print_bold_green(next_steps)
end
end
Expand All @@ -97,7 +97,7 @@ def self.make_public!(
per_file_processors: []
)
Logging.section('Making files public') do
intro = UsePackwerk.config.user_event_logger.before_make_public
intro = UsePacks.config.user_event_logger.before_make_public
Logging.print_bold_green(intro)
end

Expand All @@ -107,7 +107,7 @@ def self.make_public!(
)

Logging.section('Next steps') do
next_steps = UsePackwerk.config.user_event_logger.after_make_public
next_steps = UsePacks.config.user_event_logger.after_make_public
Logging.print_bold_green(next_steps)
end
end
Expand All @@ -123,7 +123,7 @@ def self.add_dependency!(
dependency_name:
)
Logging.section('Adding a dependency') do
intro = UsePackwerk.config.user_event_logger.before_add_dependency(pack_name)
intro = UsePacks.config.user_event_logger.before_add_dependency(pack_name)
Logging.print_bold_green(intro)
end

Expand All @@ -133,7 +133,7 @@ def self.add_dependency!(
)

Logging.section('Next steps') do
next_steps = UsePackwerk.config.user_event_logger.after_add_dependency(pack_name)
next_steps = UsePacks.config.user_event_logger.after_add_dependency(pack_name)
Logging.print_bold_green(next_steps)
end
end
Expand All @@ -151,7 +151,7 @@ def self.move_to_parent!(
per_file_processors: []
)
Logging.section('👋 Hi!') do
intro = UsePackwerk.config.user_event_logger.before_move_to_parent(pack_name)
intro = UsePacks.config.user_event_logger.before_move_to_parent(pack_name)
Logging.print_bold_green(intro)
end

Expand All @@ -162,7 +162,7 @@ def self.move_to_parent!(
)

Logging.section('Next steps') do
next_steps = UsePackwerk.config.user_event_logger.after_move_to_parent(pack_name)
next_steps = UsePacks.config.user_event_logger.after_move_to_parent(pack_name)

Logging.print_bold_green(next_steps)
end
Expand Down Expand Up @@ -249,7 +249,7 @@ def self.get_offenses_for_files_by_package(files)
sig { void }
def self.lint_deprecated_references_yml_files!
contents_before = Private.get_deprecated_references_contents
UsePackwerk.execute(['update-deprecations'])
UsePacks.execute(['update-deprecations'])
contents_after = Private.get_deprecated_references_contents
diff = Private.diff_deprecated_references_yml(contents_before, contents_after)

Expand All @@ -276,7 +276,7 @@ def self.lint_deprecated_references_yml_files!
OUTPUT

puts output
UsePackwerk.config.on_deprecated_references_lint_failure.call(output)
UsePacks.config.on_deprecated_references_lint_failure.call(output)

exit 1
end
Expand Down
26 changes: 13 additions & 13 deletions lib/use_packwerk/cli.rb → lib/use_packs/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

require 'thor'

module UsePackwerk
module UsePacks
class CLI < Thor
extend T::Sig

desc 'create packs/your_pack', 'Create pack with name packs/your_pack'
sig { params(pack_name: String).void }
def create(pack_name)
UsePackwerk.create_pack!(pack_name: pack_name)
UsePacks.create_pack!(pack_name: pack_name)
end

desc 'add_dependency packs/from_pack packs/to_pack', 'Add packs/to_pack to packs/from_pack/package.yml list of dependencies'
Expand All @@ -23,7 +23,7 @@ def create(pack_name)
LONG_DESC
sig { params(from_pack: String, to_pack: String).void }
def add_dependency(from_pack, to_pack)
UsePackwerk.add_dependency!(
UsePacks.add_dependency!(
pack_name: from_pack,
dependency_name: to_pack
)
Expand All @@ -33,7 +33,7 @@ def add_dependency(from_pack, to_pack)
option :limit, type: :numeric, default: 10, aliases: :l, banner: 'Specify the limit of constants to analyze'
sig { params(pack_name: String).void }
def list_top_dependency_violations(pack_name)
UsePackwerk.list_top_dependency_violations(
UsePacks.list_top_dependency_violations(
pack_name: pack_name,
limit: options[:limit]
)
Expand All @@ -43,7 +43,7 @@ def list_top_dependency_violations(pack_name)
option :limit, type: :numeric, default: 10, aliases: :l, banner: 'Specify the limit of constants to analyze'
sig { params(pack_name: String).void }
def list_top_privacy_violations(pack_name)
UsePackwerk.list_top_privacy_violations(
UsePacks.list_top_privacy_violations(
pack_name: pack_name,
limit: options[:limit]
)
Expand All @@ -52,42 +52,42 @@ def list_top_privacy_violations(pack_name)
desc 'make_public path/to/file.rb path/to/directory', 'Pass in a space-separated list of file or directory paths to make public'
sig { params(paths: String).void }
def make_public(*paths)
UsePackwerk.make_public!(
UsePacks.make_public!(
paths_relative_to_root: paths,
per_file_processors: [UsePackwerk::RubocopPostProcessor.new, UsePackwerk::CodeOwnershipPostProcessor.new]
per_file_processors: [UsePacks::RubocopPostProcessor.new, UsePacks::CodeOwnershipPostProcessor.new]
)
end

desc 'move packs/destination_pack path/to/file.rb path/to/directory', 'Pass in a destination pack and a space-separated list of file or directory paths to move to the destination pack'
sig { params(pack_name: String, paths: String).void }
def move(pack_name, *paths)
UsePackwerk.move_to_pack!(
UsePacks.move_to_pack!(
pack_name: pack_name,
paths_relative_to_root: paths,
per_file_processors: [UsePackwerk::RubocopPostProcessor.new, UsePackwerk::CodeOwnershipPostProcessor.new]
per_file_processors: [UsePacks::RubocopPostProcessor.new, UsePacks::CodeOwnershipPostProcessor.new]
)
end

desc 'move_to_parent packs/parent_pack packs/child_pack', 'Pass in a parent pack and another pack to be made as a child to the parent pack!'
sig { params(parent_name: String, pack_name: String).void }
def move_to_parent(parent_name, pack_name)
UsePackwerk.move_to_parent!(
UsePacks.move_to_parent!(
parent_name: parent_name,
pack_name: pack_name,
per_file_processors: [UsePackwerk::RubocopPostProcessor.new, UsePackwerk::CodeOwnershipPostProcessor.new]
per_file_processors: [UsePacks::RubocopPostProcessor.new, UsePacks::CodeOwnershipPostProcessor.new]
)
end

desc 'lint_deprecated_references_yml_files', 'Ensures `deprecated_references.yml` files are up to date'
sig { void }
def lint_deprecated_references_yml_files
UsePackwerk.lint_deprecated_references_yml_files!
UsePacks.lint_deprecated_references_yml_files!
end

desc 'lint_package_yml_files [ packs/my_pack packs/my_other_pack ]', 'Lint `package.yml` files'
sig { params(pack_names: String).void }
def lint_package_yml_files(*pack_names)
UsePackwerk.lint_package_yml_files!(parse_pack_names(pack_names))
UsePacks.lint_package_yml_files!(parse_pack_names(pack_names))
end

desc 'validate', 'Run bin/packwerk validate (detects cycles)'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# typed: strict

module UsePackwerk
module UsePacks
class CodeOwnershipPostProcessor
include PerFileProcessorInterface
extend T::Sig
Expand All @@ -19,7 +19,7 @@ def before_move_file!(file_move_operation)
code_owners_allow_list_file = Pathname.new('config/code_ownership.yml')

if code_owners_allow_list_file.exist?
UsePackwerk.replace_in_file(
UsePacks.replace_in_file(
file: code_owners_allow_list_file.to_s,
find: relative_path_to_origin,
replace_with: relative_path_to_destination
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# typed: strict

require 'use_packwerk/user_event_logger'
require 'use_packwerk/default_user_event_logger'
require 'use_packs/user_event_logger'
require 'use_packs/default_user_event_logger'

module UsePackwerk
module UsePacks
class Configuration
extend T::Sig

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# typed: strict

module UsePackwerk
module UsePacks
class DefaultUserEventLogger
include UserEventLogger
end
Expand Down
2 changes: 1 addition & 1 deletion lib/use_packwerk/logging.rb → lib/use_packs/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'colorized_string'

module UsePackwerk
module UsePacks
module Logging
extend T::Sig

Expand Down
Loading

0 comments on commit c929819

Please sign in to comment.