Skip to content

Commit

Permalink
Update GemfileParser #3072
Browse files Browse the repository at this point in the history
    * Add new step in GemfileParser.__init__() to determine the Ruby package that this gemfile.lock is for
    * Add new test

Signed-off-by: Jono Yang <jyang@nexb.com>
  • Loading branch information
JonoYang committed Sep 3, 2022
1 parent 4c7bb33 commit 023c452
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 3,248 deletions.
11 changes: 4 additions & 7 deletions src/packagedcode/gemfile_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,10 @@ def refine(self):

def set_primary_gem(self):
for gem in self.all_gems.values():
if gem.type == PATH:
self.primary_gem = Gem(
gem.name,
gem.version,
gem.platform,
)
break
if not gem.type == PATH:
continue
self.primary_gem = gem
break

def get_or_create(self, name, version=None, platform=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/packagedcode/rubygems.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def parse(cls, location):
is_runtime=True,
is_optional=False,
is_resolved=True,
) for dep in all_gems[1:]
) for dep in all_gems if dep != primary_gem
]
urls = get_urls(primary_gem.name, primary_gem.version)

Expand Down
Loading

0 comments on commit 023c452

Please sign in to comment.