Sha256: 89cfc3278076fbb239b9325416de2e133587745fe754b806d245a9378b620dfb

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

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

module Neetob
  class CLI
    module Github
      class YarnAudit < MakePr::Base
        DESCRIPTION = "Fix security vulnerabilities reported by yarn 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)
              yarn_install!(repo)
              report = run_yarn_audit(repo)
              ui.success("Successfully executed yarn audit for #{repo}", print_to_audit_log: false)
            rescue StandardError => e
              ExceptionHandler.new(e).process
            end
          end
          `rm -rf /tmp/neetob`
          if Thread.current[:audit_mode]
            report
          end
        end

        private

          def run_yarn_audit(repo)
            `#{cd_to_repo(repo)} && yarn audit`
          end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
neetob-0.5.23 lib/neetob/cli/github/yarn_audit.rb
neetob-0.5.22 lib/neetob/cli/github/yarn_audit.rb
neetob-0.5.21 lib/neetob/cli/github/yarn_audit.rb
neetob-0.5.20 lib/neetob/cli/github/yarn_audit.rb
neetob-0.5.19 lib/neetob/cli/github/yarn_audit.rb
neetob-0.5.18 lib/neetob/cli/github/yarn_audit.rb
neetob-0.5.17 lib/neetob/cli/github/yarn_audit.rb