Skip to content

Commit

Permalink
Merge pull request #67 from vestedpr-dev/support-gemfile-path-option
Browse files Browse the repository at this point in the history
Support Gemfile 'path' option for gem source.
  • Loading branch information
jonabc authored Aug 1, 2018
2 parents 12dc5d1 + 181b5cc commit 196be30
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/licensed/source/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def gem_spec(dependency)

# if the specification is coming from a gemspec source,
# we can get a non-lazy specification straight from the source
if spec.source.is_a?(::Bundler::Source::Gemspec)
if spec.source.is_a?(::Bundler::Source::Gemspec) || spec.source.is_a?(::Bundler::Source::Path)
return spec.source.specs.first
end

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/bundler/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ group :test do
gem "minitest", "5.11.3"
end

gem "pathed-gem-fixture", path: "pathed-gem-fixture"

# verify https://github.com/github/licensed/issues/71
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
gem "mini_racer"
5 changes: 5 additions & 0 deletions test/fixtures/bundler/pathed-gem-fixture/fixture.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class PathedGemFixture
def hello
p "world"
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Gem::Specification.new do |spec|
spec.name = "pathed-gem-fixture"
spec.version = "0.0.1"
spec.authors = ["GitHub"]
spec.email = ["[email protected]"]

spec.summary = %q{a gem to test finding specs installed via :path property}
spec.homepage = "https://github.com/github/licensed"
spec.license = "MIT"

spec.files = ["fixture.rb"]
end
8 changes: 8 additions & 0 deletions test/source/bundler_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@
end
end

it "finds dependencies from path sources" do
Dir.chdir(fixtures) do
dep = source.dependencies.find { |d| d["name"] == "pathed-gem-fixture" }
assert dep
assert_equal "0.0.1", dep["version"]
end
end

describe "when bundler is a listed dependency" do
it "includes bundler as a dependency" do
Dir.chdir(fixtures) do
Expand Down

0 comments on commit 196be30

Please sign in to comment.