rubion 0.3.12 → 0.3.14

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dc1bfbae3334e5454a9cc24e15284f6ea266e6ae39c0d897e834cdbd4a060b2
4
- data.tar.gz: 99397bc977a084f856a850dbc32401a72d302ce3f55243b4a09f9660224168fd
3
+ metadata.gz: f69e93b8534eeaf2045d43f775aec23a72ccf97335ebca9fd8bcb323375dfdca
4
+ data.tar.gz: 4d96785c60788e1933a566e8483a79c7ae98f93d301f94b97923ec4c80026af1
5
5
  SHA512:
6
- metadata.gz: 78c7ccc9ac63d82a38d704d47f626e3ec1ba08976d10e3efbfe6ef35f5fb15d5424c61219d00034d11cee5e25f77b5a7b971406400e6744e5e005e9e9e9cf87a
7
- data.tar.gz: ebda62b7ec502a9e834a41b45953996363289b5c63f3ce3b6da380beaf96dfd47f5476e56f65babca314c3cd01624a5601cf607c4e1bd4884ef704d1be270e99
6
+ metadata.gz: b64a88b924fe46d2979c06a520aa8458661ad8d06d374c9fe9fa945730b05d1f93e26073a5ef69779ae87e88c840d617ea016be52df356a4ba7753f2c4d1f5a5
7
+ data.tar.gz: cccf29d1fe83443774d4b83421edbb086d1f22e1b557f9b413918c90464da4501a95f4f866374d9861cb78fc1e2b4a869ee92f70ddd4666587a0df352dde7f0f
data/README.md CHANGED
@@ -187,6 +187,9 @@ Package Versions:
187
187
  | typescript | 4.7.0 | 5/24/2022 | 5.1.0 | 5/25/2023 | 1 year | 12 |
188
188
  +------------------+---------+--------------------------+---------+--------------------------+------------------+-------------------+
189
189
  ```
190
+ ![aaaScreenshot 2025-11-15 at 2 54 24 pm](https://github.com/user-attachments/assets/9ce27e07-9c95-44ea-a96c-ec9537234d06)
191
+ <img width="1333" height="741" alt="Screenshot 2025-11-15 at 2 54 34 pm" src="https://github.com/user-attachments/assets/22759b64-776f-4c9d-9bbb-3b70adead02e" />
192
+
190
193
 
191
194
  ### Direct Dependencies Only (with --exclude-dependencies)
192
195
 
@@ -102,30 +102,59 @@ module Rubion
102
102
  stdout, stderr, status = Open3.capture3('bundle-audit check 2>&1', chdir: @project_path)
103
103
 
104
104
  # bundle-audit returns exit code 1 when vulnerabilities are found, 0 when none found
105
- # Always parse if there's output (vulnerabilities found) or if it succeeded (no vulnerabilities)
106
- if stdout.include?('vulnerabilities found') || stdout.include?('Name:') || status.success?
105
+ # Exit code 1 is expected when vulnerabilities exist, so we still parse the output
106
+ # Exit code 0 means no vulnerabilities found
107
+ # Any other exit code or error means the command failed
108
+ if status.exitstatus.nil? || status.exitstatus == 127 || stderr.include?('command not found') || stdout.include?('command not found')
109
+ # Command not found - try to install bundler-audit automatically
110
+ install_bundler_audit_and_retry
111
+ elsif status.exitstatus == 1 || status.success? || (!stdout.empty? && (stdout.include?('vulnerabilities found') || stdout.include?('Name:')))
112
+ # Exit code 1 (vulnerabilities found) or 0 (no vulnerabilities) - parse output
113
+ # Also try to parse if output looks valid even if exit code is unexpected
107
114
  parse_bundler_audit_output(stdout)
108
115
  else
109
- # No vulnerabilities found or bundler-audit not available
110
- @result.gem_vulnerabilities = []
116
+ # Unexpected exit code
117
+ raise "bundle-audit failed with exit code #{status.exitstatus}. Output: #{stdout}#{unless stderr.empty?
118
+ "\nError: #{stderr}"
119
+ end}"
120
+ end
121
+ end
122
+
123
+ def install_bundler_audit_and_retry
124
+ puts "\n ⚠️ bundle-audit is not installed."
125
+ print ' Attempting to install bundler-audit... '
126
+ $stdout.flush
127
+
128
+ _install_stdout, install_stderr, install_status = Open3.capture3('gem install bundler-audit 2>&1')
129
+
130
+ if install_status.success?
131
+ puts "✓ Successfully installed bundler-audit\n"
132
+ puts " Retrying gem vulnerability check...\n\n"
133
+ # Retry the check after installation
134
+ check_gem_vulnerabilities
135
+ else
136
+ puts '✗ Failed to install bundler-audit'
137
+ raise "bundle-audit is not installed and automatic installation failed.\n" \
138
+ "Please install it manually by running: gem install bundler-audit\n" \
139
+ "Installation error: #{install_stderr}"
111
140
  end
112
- rescue StandardError => e
113
- puts " ⚠️ Could not run bundle-audit (#{e.message}). Skipping gem vulnerability check."
114
- @result.gem_vulnerabilities = []
115
141
  end
116
142
 
117
143
  def check_gem_versions
118
144
  stdout, stderr, status = Open3.capture3('bundle outdated --parseable', chdir: @project_path)
119
145
 
120
- if status.success? || !stdout.empty?
146
+ if status.success?
147
+ # Command succeeded - parse output (may be empty if all gems are up to date)
121
148
  parse_bundle_outdated_output(stdout)
149
+ elsif status.exitstatus.nil?
150
+ # Command not found or failed to execute
151
+ raise "bundle outdated command failed or is not available. Error: #{stderr}"
122
152
  else
123
- # No outdated gems found
124
- @result.gem_versions = []
153
+ # Command failed with non-zero exit code
154
+ raise "bundle outdated failed with exit code #{status.exitstatus}. Output: #{stdout}#{unless stderr.empty?
155
+ "\nError: #{stderr}"
156
+ end}"
125
157
  end
126
- rescue StandardError => e
127
- puts " ⚠️ Could not run bundle outdated (#{e.message}). Skipping gem version check."
128
- @result.gem_versions = []
129
158
  end
130
159
 
131
160
  def check_npm_vulnerabilities
@@ -134,15 +163,22 @@ module Rubion
134
163
  command = "#{@package_manager} audit --json 2>&1"
135
164
  stdout, stderr, status = Open3.capture3(command, chdir: @project_path)
136
165
 
166
+ if status.exitstatus.nil?
167
+ # Command not found or failed to execute
168
+ raise "#{@package_manager} audit command failed or is not available. Error: #{stderr}"
169
+ elsif !status.success? && status.exitstatus != 1
170
+ # Exit code 1 is expected when vulnerabilities are found, other non-zero codes are errors
171
+ raise "#{@package_manager} audit failed with exit code #{status.exitstatus}. Output: #{stdout}#{unless stderr.empty?
172
+ "\nError: #{stderr}"
173
+ end}"
174
+ end
175
+
137
176
  begin
138
177
  data = JSON.parse(stdout)
139
178
  parse_npm_audit_output(data)
140
- rescue JSON::ParserError
141
- @result.package_vulnerabilities = []
179
+ rescue JSON::ParserError => e
180
+ raise "Failed to parse #{@package_manager} audit JSON output: #{e.message}. Raw output: #{stdout}"
142
181
  end
143
- rescue StandardError => e
144
- puts " ⚠️ Could not run #{@package_manager} audit (#{e.message}). Skipping package vulnerability check."
145
- @result.package_vulnerabilities = []
146
182
  end
147
183
 
148
184
  def check_npm_versions
@@ -160,16 +196,22 @@ module Rubion
160
196
  command = 'npm outdated --json 2>&1'
161
197
  stdout, stderr, status = Open3.capture3(command, chdir: @project_path)
162
198
 
199
+ if status.exitstatus.nil?
200
+ # Command not found or failed to execute
201
+ raise "npm outdated command failed or is not available. Error: #{stderr}"
202
+ elsif !status.success? && status.exitstatus != 1
203
+ # Exit code 1 is expected when packages are outdated, other non-zero codes are errors
204
+ raise "npm outdated failed with exit code #{status.exitstatus}. Output: #{stdout}#{unless stderr.empty?
205
+ "\nError: #{stderr}"
206
+ end}"
207
+ end
208
+
163
209
  begin
164
210
  data = JSON.parse(stdout) unless stdout.empty?
165
211
  parse_npm_outdated_output(data || {})
166
212
  rescue JSON::ParserError => e
167
- puts " ⚠️ Error parsing npm outdated JSON output: #{e.message}"
168
- @result.package_versions = []
213
+ raise "Failed to parse npm outdated JSON output: #{e.message}. Raw output: #{stdout}"
169
214
  end
170
- rescue StandardError => e
171
- puts " ⚠️ Could not run npm outdated (#{e.message}). Skipping package version check."
172
- @result.package_versions = []
173
215
  end
174
216
 
175
217
  def check_yarn_outdated
@@ -177,15 +219,21 @@ module Rubion
177
219
  command = 'yarn outdated 2>&1'
178
220
  stdout, stderr, status = Open3.capture3(command, chdir: @project_path)
179
221
 
222
+ if status.exitstatus.nil?
223
+ # Command not found or failed to execute
224
+ raise "yarn outdated command failed or is not available. Error: #{stderr}"
225
+ elsif !status.success? && status.exitstatus != 1
226
+ # Exit code 1 is expected when packages are outdated, other non-zero codes are errors
227
+ raise "yarn outdated failed with exit code #{status.exitstatus}. Output: #{stdout}#{unless stderr.empty?
228
+ "\nError: #{stderr}"
229
+ end}"
230
+ end
231
+
180
232
  begin
181
233
  parse_yarn_outdated_output(stdout)
182
234
  rescue StandardError => e
183
- puts " ⚠️ Could not parse yarn outdated output (#{e.message}). Skipping package version check."
184
- @result.package_versions = []
235
+ raise "Failed to parse yarn outdated output: #{e.message}. Raw output: #{stdout}"
185
236
  end
186
- rescue StandardError => e
187
- puts " ⚠️ Could not run yarn outdated (#{e.message}). Skipping package version check."
188
- @result.package_versions = []
189
237
  end
190
238
 
191
239
  # Parsers
@@ -332,9 +380,6 @@ module Rubion
332
380
  end
333
381
 
334
382
  @result.package_vulnerabilities = vulnerabilities
335
- rescue StandardError => e
336
- puts " ⚠️ Error parsing npm audit data: #{e.message}"
337
- @result.package_vulnerabilities = []
338
383
  end
339
384
 
340
385
  def parse_npm_outdated_output(data)
@@ -416,9 +461,6 @@ module Rubion
416
461
  end
417
462
 
418
463
  @result.package_versions = versions
419
- rescue StandardError => e
420
- puts " ⚠️ Error parsing npm outdated data: #{e.message}"
421
- @result.package_versions = []
422
464
  end
423
465
 
424
466
  def parse_yarn_outdated_output(output)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubion
4
- VERSION = "0.3.12"
4
+ VERSION = "0.3.14"
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - bipashant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-15 00:00:00.000000000 Z
11
+ date: 2025-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: terminal-table