Sha256: 299316a5c011d5c5839838b857851b738b2b1bcfb14beb15d64e57f563041fae

Contents?: true

Size: 1.25 KB

Versions: 17

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/on_clean_ruby_environment'

module Avm
  module Ruby
    class Rubocop
      require_sub __FILE__
      enable_speaker
      enable_simple_cache
      common_constructor :base_path, :rubocop_args
      set_callback :initialize, :after do
        @base_path = ::Pathname.new(base_path.to_s) unless base_path.is_a?(::Pathname)
      end

      def run
        start_banner
        run_rubocop
      end

      private

      def cmd(*args)
        ::EacRubyUtils::Envs.local.command(*args)
      end

      def rubocop_command_uncached
        %w[env configured gemfile].each do |s|
          cmd = send("#{s}_rubocop_command")
          return cmd if cmd.present?
        end
        cmd('rubocop')
      end

      def rubocop_command_with_args
        rubocop_command.append(rubocop_args)
      end

      def rubocop_version_uncached
        ::EacRubyUtils.on_clean_ruby_environment do
          rubocop_command.append(['--version']).execute!.strip
        end
      end

      def run_rubocop
        ::EacRubyUtils.on_clean_ruby_environment { rubocop_command_with_args.system }
      end

      def start_banner
        infov 'Rubocop version', rubocop_version
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
avm-tools-0.110.0 lib/avm/ruby/rubocop.rb
avm-tools-0.109.1 lib/avm/ruby/rubocop.rb
avm-tools-0.109.0 lib/avm/ruby/rubocop.rb
avm-tools-0.108.0 lib/avm/ruby/rubocop.rb
avm-tools-0.107.0 lib/avm/ruby/rubocop.rb
avm-tools-0.106.0 lib/avm/ruby/rubocop.rb
avm-tools-0.105.0 lib/avm/ruby/rubocop.rb
avm-tools-0.104.0 lib/avm/ruby/rubocop.rb
avm-tools-0.103.1 lib/avm/ruby/rubocop.rb
avm-tools-0.103.0 lib/avm/ruby/rubocop.rb
avm-tools-0.102.2 lib/avm/ruby/rubocop.rb
avm-tools-0.102.1 lib/avm/ruby/rubocop.rb
avm-tools-0.102.0 lib/avm/ruby/rubocop.rb
avm-tools-0.101.0 lib/avm/ruby/rubocop.rb
avm-tools-0.100.0 lib/avm/ruby/rubocop.rb
avm-tools-0.99.1 lib/avm/ruby/rubocop.rb
avm-tools-0.99.0 lib/avm/ruby/rubocop.rb