Sha256: 5b9ae2d50758a123a719c9db8ea6e1f19685390986461b0040b9ae4bb03d1b41

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_gems_utils/gem'
require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/on_clean_ruby_environment'

module Avm
  module Ruby
    class Rubocop
      def gemfile_rubocop_command
        return nil unless rubocop_gemfile?

        rubocop_command_by_gemfile_path(mygem.gemfile_path)
      end

      def rubocop_command_by_gemfile_path(path)
        mygem.bundle('exec', 'rubocop').envvar('BUNDLE_GEMFILE', path.to_s)
      end

      def rubocop_gemfile?
        return false unless mygem.present?

        mygem.bundle('install').execute!
        mygem.gemfile_lock_gem_version('rubocop').present?
      end

      private

      def mygem_uncached
        find_gem(::Pathname.new(base_path).expand_path)
      end

      def find_gem(path)
        r = ::EacRubyGemsUtils::Gem.new(path)
        return r if r.gemfile_path.exist?
        return find_gem(path.dirname) unless path.root?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
avm-tools-0.44.0 lib/avm/ruby/rubocop/_gemfile.rb