Sha256: 2116017ceb5b22d8865271359a711a255052f9df3179f8e95a77cd1fc8e8fb37

Contents?: true

Size: 995 Bytes

Versions: 13

Compression:

Stored size: 995 Bytes

Contents

# frozen_string_literal: true

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

module Avm
  module EacRubyBase1
    class Rubocop
      module Gemfile
        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
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
avm-tools-0.120.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.7.0 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-tools-0.119.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-tools-0.118.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.6.1 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-tools-0.117.3 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-tools-0.117.2 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-tools-0.117.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.6.0 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.5.0 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-tools-0.117.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.4.0 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-tools-0.116.2 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb