Skip to content

Commit

Permalink
feat(bunder): extract ruby compatibiity version
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Jan 21, 2019
1 parent 2d325f8 commit e02ffbd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions lib/manager/bundler/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ function extractPackageFile(content) {
if (sourceMatch) {
res.registryUrls.push(sourceMatch[1]);
}
const rubyMatch = line.match(/^ruby "([^"]+)"/);
if (rubyMatch) {
res.compatibility = { ruby: rubyMatch[1] };
}
const gemMatch = line.match(/^gem "([^"]+)"(,\s+"([^"]+)"){0,2}/);
if (gemMatch) {
const dep = {
Expand Down
1 change: 1 addition & 0 deletions test/_fixtures/bundler/Gemfile.sourceGroup
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source "https://rubygems.org"
ruby "~> 1.5.3"

source "https://gems.example.com" do
gem "some_internal_gem"
Expand Down
15 changes: 9 additions & 6 deletions test/manager/bundler/__snapshots__/extract.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -499,18 +499,21 @@ Object {

exports[`lib/manager/bundler/extract extractPackageFile() parses sourceGroups 1`] = `
Object {
"compatibility": Object {
"ruby": "~> 1.5.3",
},
"deps": Array [
Object {
"depName": "some_internal_gem",
"lineNumber": 3,
"lineNumber": 4,
"registryUrls": Array [
"https://gems.example.com",
],
"skipReason": "no-version",
},
Object {
"depName": "another_internal_gem",
"lineNumber": 4,
"lineNumber": 5,
"registryUrls": Array [
"https://gems.example.com",
],
Expand All @@ -519,12 +522,12 @@ Object {
Object {
"currentValue": "latest",
"depName": "ruby-debug",
"lineNumber": 8,
"lineNumber": 9,
"skipReason": "invalid-value",
},
Object {
"depName": "sqlite3",
"lineNumber": 9,
"lineNumber": 10,
"skipReason": "no-version",
},
Object {
Expand All @@ -533,7 +536,7 @@ Object {
"development",
"optional => true",
],
"lineNumber": 13,
"lineNumber": 14,
"skipReason": "no-version",
},
Object {
Expand All @@ -542,7 +545,7 @@ Object {
"development",
"optional => true",
],
"lineNumber": 14,
"lineNumber": 15,
"skipReason": "no-version",
},
],
Expand Down

0 comments on commit e02ffbd

Please sign in to comment.