Skip to content

Commit

Permalink
Merge pull request #562 from Shopify/uk-revert-bundler-change
Browse files Browse the repository at this point in the history
  • Loading branch information
paracycle authored Oct 26, 2021
2 parents 2a93af1 + bcaec0b commit 51b8ce5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/tapioca/gemfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ def ignore?(gemfile_dir)

sig { returns(T::Array[Pathname]) }
def files
spec = @spec
if default_gem? && spec.is_a?(::Gem::Specification)
spec.files.map do |file|
if default_gem?
# `Bundler::RemoteSpecification` delegates missing methods to
# `Gem::Specification`, so `files` actually always exists on spec.
T.unsafe(@spec).files.map do |file|
ruby_lib_dir.join(file)
end
else
spec.full_require_paths.flat_map do |path|
@spec.full_require_paths.flat_map do |path|
Pathname.glob((Pathname.new(path) / "**/*.rb").to_s)
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/support/repo/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gem("sidekiq", "6.2.1")
gem("activesupport", "6.1.3.2")
# Needed to test Git gems
gem("ast", git: "https://github.com/whitequark/ast", ref: "e07a4f66e05ac7972643a8841e336d327ea78ae1")
gem("did_you_mean")

# Needed to test missing gems
platform :truffleruby do
Expand Down
12 changes: 12 additions & 0 deletions spec/tapioca/cli/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ def fizz; end
refute_path_exists("#{outdir}/[email protected]")
end

it "must generate RBI for a default gem" do
output = tapioca("gem did_you_mean")

assert_includes(output, <<~OUTPUT)
Processing 'did_you_mean' gem:
Compiling did_you_mean, this may take a few seconds... Done
OUTPUT

did_you_mean_rbi_file = T.must(Dir.glob("#{outdir}/did_you_mean@*.rbi").first)
assert_includes(File.read(did_you_mean_rbi_file), "module DidYouMean")
end

it "must generate gem RBI in correct output directory" do
output = tapioca("gem foo", use_default_outdir: true)

Expand Down

0 comments on commit 51b8ce5

Please sign in to comment.