Sha256: 8b11f01bd15a2dc9ae548367cf11c3b65280e2d06b21eb019acfecba12b4a52d

Contents?: true

Size: 1.31 KB

Versions: 12

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require_relative "./make_pr/base"
require "pry"

module Neetob
  class CLI
    module Github
      class BundleAudit < MakePr::Base
        DESCRIPTION = "Fix security vulnerabilities reported by bundle audit"
        attr_accessor :repos, :sandbox

        def initialize(repos, sandbox = false)
          super()
          @repos = repos
          @sandbox = sandbox
        end

        def run
          matching_repos = find_all_matching_apps_or_repos(repos, :github, sandbox)
          report = nil
          matching_repos.each do |repo|
            begin
              ui.info("\nWorking on repo #{repo}", print_to_audit_log: false)
              clone_repo_in_tmp_dir(repo)
              bundle_install!(repo)
              report = run_bundle_audit(repo)
              ui.success("Successfully executed bundle audit for #{repo}", print_to_audit_log: false)
            rescue StandardError => e
              ExceptionHandler.new(e).process
            end
          end
          `rm -rf /tmp/neetob` unless Thread.current[:audit_mode]
          if Thread.current[:audit_mode]
            report
          end
        end

        private

          def run_bundle_audit(repo)
            `#{cd_to_repo(repo)} && rbenv local 3.3.5 && bundle-audit check`
          end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
neetob-0.5.35 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.34 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.33 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.32 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.31 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.30 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.29 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.28 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.27 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.26 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.25 lib/neetob/cli/github/bundle_audit.rb
neetob-0.5.24 lib/neetob/cli/github/bundle_audit.rb