Sha256: b137b544426f3b39430d46df2fc3aa6969ee09b7e577b33f4db084b1b05cfb08

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module EacRubyGemsUtils
  module Tests
    class Multiple
      class DecoratedGem < ::SimpleDelegator
        enable_console_speaker

        def prepare
          return unless gemfile_path.exist?

          log('running "bundle install"...')
          return if bundle('install').execute.fetch(:exit_code).zero?

          if can_remove_gemfile_lock?
            log('"bundle install" failed, removing Gemfile.lock and trying again...')
            gemfile_lock_path.unlink if gemfile_lock_path.exist?
            bundle('install').execute!
          else
            raise '"bundle install" failed and the Gemfile.lock is part of gem' \
              '(Should be changed by developer)'
          end
        end

        def tests
          [::EacRubyGemsUtils::Tests::Minitest.new(__getobj__),
           ::EacRubyGemsUtils::Tests::Rspec.new(__getobj__)]
        end

        private

        def log(message)
          infov self, message
        end

        def can_remove_gemfile_lock?
          !files.include?(gemfile_lock_path.relative_path_from(root))
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
avm-tools-0.70.2 vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.70.1 vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.70.0 vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.69.3 vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
eac_ruby_gems_utils-0.7.2 lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.69.2 vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.69.1 vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.69.0 vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
eac_ruby_gems_utils-0.7.1 lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb