Sha256: 3862998b6f4f8dc2fa5c885c16721d5dc565c62ca1454f0da130bf93638350ea

Contents?: true

Size: 1007 Bytes

Versions: 14

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

require 'avm/eac_ruby_base1/sources/base'
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.path)
        end

        def rubocop_command_by_gemfile_path(path)
          ::Avm::EacRubyBase1::Sources::Base.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 = ::Avm::EacRubyBase1::Sources::Base.new(path)
          return r if r.gemfile_path.exist?

          find_gem(path.dirname) unless path.root?
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
avm-eac_ruby_base1-0.35.1 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.96.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.35.0 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.95.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.34.1 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.91.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.34.0 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.91.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.33.1 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.83.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.82.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.81.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb
avm-eac_ruby_base1-0.33.0 lib/avm/eac_ruby_base1/rubocop/gemfile.rb
eac_tools-0.80.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb