diff --git a/lib/licensed/source/bundler.rb b/lib/licensed/source/bundler.rb index 44352aa1..8c64f277 100644 --- a/lib/licensed/source/bundler.rb +++ b/lib/licensed/source/bundler.rb @@ -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 diff --git a/test/fixtures/bundler/Gemfile b/test/fixtures/bundler/Gemfile index 1b6a5617..e73e9380 100644 --- a/test/fixtures/bundler/Gemfile +++ b/test/fixtures/bundler/Gemfile @@ -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" diff --git a/test/fixtures/bundler/pathed-gem-fixture/fixture.rb b/test/fixtures/bundler/pathed-gem-fixture/fixture.rb new file mode 100644 index 00000000..4d866c06 --- /dev/null +++ b/test/fixtures/bundler/pathed-gem-fixture/fixture.rb @@ -0,0 +1,5 @@ +class PathedGemFixture + def hello + p "world" + end +end diff --git a/test/fixtures/bundler/pathed-gem-fixture/pathed-gem-fixture.gemspec b/test/fixtures/bundler/pathed-gem-fixture/pathed-gem-fixture.gemspec new file mode 100644 index 00000000..d23dd1d0 --- /dev/null +++ b/test/fixtures/bundler/pathed-gem-fixture/pathed-gem-fixture.gemspec @@ -0,0 +1,12 @@ +Gem::Specification.new do |spec| + spec.name = "pathed-gem-fixture" + spec.version = "0.0.1" + spec.authors = ["GitHub"] + spec.email = ["opensource+licensed@github.com"] + + 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 diff --git a/test/source/bundler_test.rb b/test/source/bundler_test.rb index b25acc96..d84e5128 100644 --- a/test/source/bundler_test.rb +++ b/test/source/bundler_test.rb @@ -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