@snyk/gemfile 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ - [ ] Tests written and linted [ℹ︎](https://github.com/snyk/general/wiki/Tests)
2
+ - [ ] Documentation written [ℹ︎](https://github.com/snyk/general/wiki/Documentation)
3
+ - [ ] Commit history is tidy [ℹ︎](https://github.com/snyk/general/wiki/Git)
4
+
5
+ ### What this does
6
+
7
+ _Explain why this PR exists_
8
+
9
+ ### Notes for the reviewer
10
+
11
+ _Instructions on how to run this locally, background context, what to review, questions…_
12
+
13
+ ### More information
14
+
15
+ - [Jira ticket XX-0000]()
16
+ - [Link to documentation](https://github.com/Snyk/registry/wiki/)
17
+
18
+ ### Screenshots
19
+
20
+ _Visuals that may help the reviewer_
package/gemfile.js CHANGED
@@ -8,6 +8,7 @@ const GEMFILE_DEFAULT_LOCATION = path.resolve(process.cwd(), 'Gemfile.lock');
8
8
  const WHITESPACE = /^(\s*)/;
9
9
  const GEMFILE_KEY_VALUE = /^\s*([^:(]*)\s*\:*\s*(.*)/;
10
10
  const ORIGINS = ['GEM', 'GIT', 'PATH'];
11
+ const RUBY = /^ruby\s(.*)/;
11
12
 
12
13
  module.exports = {
13
14
  interpret,
@@ -126,8 +127,15 @@ function interpret(string, extractMeta) {
126
127
  gemfile['BUNDLED WITH'] = Object.keys(gemfile['BUNDLED WITH'])[0];
127
128
  }
128
129
 
130
+ if (gemfile['RUBY VERSION']) {
131
+ const rawVersion= Object.keys(gemfile['RUBY VERSION'])[0];
132
+ const version = RUBY.exec(rawVersion)[1];
133
+ gemfile['RUBY VERSION'] = version;
134
+ }
135
+
129
136
  if (extractMeta) {
130
137
  gemfileMeta.bundledWith = gemfile['BUNDLED WITH'];
138
+ gemfileMeta.rubyVersion = gemfile['RUBY VERSION'];
131
139
  gemfileMeta.platforms = gemfile['PLATFORMS'];
132
140
  gemfileMeta.dependencies = gemfile['DEPENDENCIES'];
133
141
  gemfileMeta.specs = Object.keys(gemfile)
package/package.json CHANGED
@@ -28,5 +28,5 @@
28
28
  "engines": {
29
29
  "node": ">= 4.2.4"
30
30
  },
31
- "version": "1.1.0"
31
+ "version": "1.2.0"
32
32
  }
package/test/Gemfile.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "bundledWith": "1.11.2",
3
+ "rubyVersion": "2.3.1p112",
3
4
  "platforms": {
4
5
  "ruby": {}
5
6
  },
package/test/Gemfile.lock CHANGED
@@ -364,3 +364,6 @@ DEPENDENCIES
364
364
 
365
365
  BUNDLED WITH
366
366
  1.11.2
367
+
368
+ RUBY VERSION
369
+ ruby 2.3.1p112
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "bundledWith": "1.13.6",
3
+ "rubyVersion": "2.3.1p0",
3
4
  "platforms": {
4
5
  "ruby": {}
5
6
  },
@@ -80,3 +80,6 @@ DEPENDENCIES
80
80
 
81
81
  BUNDLED WITH
82
82
  1.13.6
83
+
84
+ RUBY VERSION
85
+ ruby 2.3.1p0 (jruby 9.1.6.0)
@@ -152,6 +152,7 @@ describe('gemfile', function() {
152
152
 
153
153
  it('has actual metadata', function () {
154
154
  let output = gemfile.interpret(file, true);
155
+ assert.deepEqual(output.rubyVersion, '2.3.1p0');
155
156
  assert.property(output.specs.rspec, 'revision');
156
157
  });
157
158