Sha256: 28ac32be551cf9f878ebdf2c61c8cfbaa172b580a74fcca330ca2cacf53fff48

Contents?: true

Size: 942 Bytes

Versions: 18

Compression:

Stored size: 942 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.root)
      end

      def rubocop_command_by_gemfile_path(path)
        ::EacRubyGemsUtils::Gem.new(path).bundle('exec', 'rubocop')
      end

      def rubocop_gemfile?
        return false if mygem.blank?

        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

18 entries across 18 versions & 1 rubygems

Version Path
avm-tools-0.62.3 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.62.2 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.62.1 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.62.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.61.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.60.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.59.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.58.1 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.58.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.57.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.56.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.55.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.54.2 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.54.1 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.54.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.53.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.52.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.51.0 lib/avm/ruby/rubocop/_gemfile.rb