Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump packwerk and use new load paths API #36

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ source 'https://rubygems.org'
gemspec

gem 'packwerk', github: 'Shopify/packwerk', branch: 'main'
gem 'railties'
22 changes: 20 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/Shopify/packwerk.git
revision: 7428f23e243a4a172ddb4e28021a732e2c9abc1a
revision: e998ef65194de398f0baaf03a0ba33390b30351e
branch: main
specs:
packwerk (2.2.1)
Expand All @@ -17,7 +17,7 @@ GIT
PATH
remote: .
specs:
danger-packwerk (0.12.0)
danger-packwerk (0.13.0)
code_ownership
danger-plugin-api (~> 1.0)
packwerk
Expand All @@ -27,6 +27,13 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionpack (7.0.4)
actionview (= 7.0.4)
activesupport (= 7.0.4)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.4)
activesupport (= 7.0.4)
builder (~> 3.1)
Expand Down Expand Up @@ -145,11 +152,21 @@ GEM
method_source (~> 1.0)
public_suffix (5.0.1)
racc (1.6.1)
rack (2.2.4)
rack-test (2.0.2)
rack (>= 1.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.4)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.4)
actionpack (= 7.0.4)
activesupport (= 7.0.4)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rbi (0.0.16)
Expand Down Expand Up @@ -246,6 +263,7 @@ DEPENDENCIES
danger-packwerk!
packwerk!
pry
railties
rake
rspec (~> 3.0)
rubocop
Expand Down
2 changes: 1 addition & 1 deletion lib/danger-packwerk/private.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Private
def self.constant_resolver
@constant_resolver = T.let(@constant_resolver, T.nilable(ConstantResolver))
@constant_resolver ||= begin
load_paths = Packwerk::ApplicationLoadPaths.extract_relevant_paths(Dir.pwd, 'test')
load_paths = Packwerk::RailsLoadPaths.for(Dir.pwd, environment: 'test')
ConstantResolver.new(
root_path: Dir.pwd,
load_paths: T.unsafe(load_paths).keys
Expand Down
2 changes: 1 addition & 1 deletion lib/danger-packwerk/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# frozen_string_literal: true

module DangerPackwerk
VERSION = '0.12.0'
VERSION = '0.13.0'
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions sorbet/tapioca/require.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
require 'packwerk'
require 'danger'
# This triggers the autoload in packwerk so types for this constant are defined
Packwerk::RailsLoadPaths
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module DangerPackwerk
'packs/some_pack/some_class_with_new_name.rb',
'packs/some_pack/some_class_with_old_name.rb'
].each { |path| write_file(path) }
allow(Packwerk::ApplicationLoadPaths).to receive(:extract_relevant_paths).and_return(load_paths)
allow(Packwerk::RailsLoadPaths).to receive(:for).and_return(load_paths)
end

context 'when no package_todo.yml files have been added or modified' do
Expand Down
2 changes: 1 addition & 1 deletion spec/danger_packwerk/danger_packwerk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module DangerPackwerk
'packs/some_pack/some_class_with_new_name.rb',
'packs/some_pack/some_class_with_old_name.rb'
].each { |path| write_file(path) }
allow(Packwerk::ApplicationLoadPaths).to receive(:extract_relevant_paths).and_return(load_paths)
allow(Packwerk::RailsLoadPaths).to receive(:for).and_return(load_paths)
write_package_yml('packs/some_pack')
end

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def testing_dangerfile

config.before do |_example|
ParsePackwerk.bust_cache!
allow(Packwerk::ApplicationLoadPaths).to receive(:extract_relevant_paths).and_return({})
allow(Packwerk::RailsLoadPaths).to receive(:extract_relevant_paths).and_return({})
end

config.around do |example|
Expand Down