Sha256: c5ba9561ea934ea461f9f0d885113b011e3f85f4ca9639528b8ef1b38e424d26

Contents?: true

Size: 914 Bytes

Versions: 15

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

require 'avm/patches/eac_ruby_gems_utils/gem'
require 'eac_ruby_utils/core_ext'

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').chdir_root
      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

15 entries across 15 versions & 1 rubygems

Version Path
avm-tools-0.116.1 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.116.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.115.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.114.2 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.114.1 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.114.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.113.6 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.113.5 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.113.4 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.113.3 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.113.2 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.113.1 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.113.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.112.0 lib/avm/ruby/rubocop/_gemfile.rb
avm-tools-0.111.0 lib/avm/ruby/rubocop/_gemfile.rb