Class: Vtk::Commands::Scan::Repo
- Inherits:
-
Vtk::Command
- Object
- Vtk::Command
- Vtk::Commands::Scan::Repo
- Defined in:
- lib/vtk/commands/scan/repo.rb
Overview
Scan a repository for compromised packages and backdoor workflows Shells out to shai-hulud-repo-check.sh for the actual scanning
Constant Summary collapse
- OPTION_FLAGS =
{ refresh: '--refresh', json: '--json', quiet: '--quiet', verbose: '--verbose', recursive: '--recursive' }.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #execute(output: $stdout) ⇒ Object
-
#initialize(path, options) ⇒ Repo
constructor
A new instance of Repo.
Methods inherited from Vtk::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(path, options) ⇒ Repo
Returns a new instance of Repo.
22 23 24 25 26 |
# File 'lib/vtk/commands/scan/repo.rb', line 22 def initialize(path, ) @path = path || Dir.pwd @options = super() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
20 21 22 |
# File 'lib/vtk/commands/scan/repo.rb', line 20 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
20 21 22 |
# File 'lib/vtk/commands/scan/repo.rb', line 20 def path @path end |
Instance Method Details
#execute(output: $stdout) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/vtk/commands/scan/repo.rb', line 28 def execute(output: $stdout) @output = output unless File.directory?(@path) output.puts "ERROR: Directory not found: #{@path}" return 1 end script_path, gem_root = find_script return script_not_found(output, gem_root) unless script_path run_script(script_path) end |