Class: Rubion::Scanner
- Inherits:
-
Object
- Object
- Rubion::Scanner
- Defined in:
- lib/rubion/scanner.rb
Defined Under Namespace
Classes: ScanResult
Instance Method Summary collapse
-
#initialize(project_path: Dir.pwd, package_manager: nil, vulnerabilities_only: false) ⇒ Scanner
constructor
A new instance of Scanner.
- #scan ⇒ Object
- #scan_incremental(options = { gems: true, packages: true, sort_by: 'Behind By(Time)', sort_desc: true, exclude_dependencies: false }) ⇒ Object
Constructor Details
#initialize(project_path: Dir.pwd, package_manager: nil, vulnerabilities_only: false) ⇒ Scanner
Returns a new instance of Scanner.
23 24 25 26 27 28 29 30 31 |
# File 'lib/rubion/scanner.rb', line 23 def initialize(project_path: Dir.pwd, package_manager: nil, vulnerabilities_only: false) @project_path = project_path @result = ScanResult.new @package_manager = package_manager @package_manager_detected = false @direct_gems = nil @direct_packages = nil @vulnerabilities_only = vulnerabilities_only end |
Instance Method Details
#scan ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/rubion/scanner.rb', line 33 def scan puts "🔍 Scanning project at: #{@project_path}\n\n" scan_ruby_gems scan_npm_packages @result end |
#scan_incremental(options = { gems: true, packages: true, sort_by: 'Behind By(Time)', sort_desc: true, exclude_dependencies: false }) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rubion/scanner.rb', line 42 def scan_incremental( = { gems: true, packages: true, sort_by: 'Behind By(Time)', sort_desc: true, exclude_dependencies: false }) puts "🔍 Scanning project at: #{@project_path}\n\n" # Scan and display Ruby gems first (if enabled) if [:gems] scan_ruby_gems # Print gem results immediately puts "\n" reporter = Reporter.new(@result, sort_by: [:sort_by], sort_desc: [:sort_desc], exclude_dependencies: [:exclude_dependencies]) reporter.print_gem_vulnerabilities reporter.print_gem_versions unless [:vulnerabilities_only] end # Then scan NPM packages (if enabled) if [:packages] puts "\n" if [:gems] # Add spacing if gems were scanned scan_npm_packages end @result end |