Sha256: 66817438979e03634a36d3aab7f24126fa95491adabe3d438318278a04c72dbb

Contents?: true

Size: 1.23 KB

Versions: 43

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

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

        def prepare
          return unless gemfile_path.exist?

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

          unless can_remove_gemfile_lock?
            raise '"bundle install" failed and the Gemfile.lock is part of gem' \
                '(Should be changed by developer)'
          end

          prepare_with_removable_gemfile_lock
        end

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

        private

        def log(message)
          infov self, message
        end

        def prepare_with_removable_gemfile_lock
          log('"bundle install" failed, removing Gemfile.lock and trying again...')
          gemfile_lock_path.unlink if gemfile_lock_path.exist?
          bundle('install').execute!
        end

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

Version data entries

43 entries across 43 versions & 3 rubygems

Version Path
avm-tools-0.120.0 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.119.0 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.118.0 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.117.3 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.117.2 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.117.1 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.117.0 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.116.2 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
eac_ruby_gems_utils-0.9.10 lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.116.1 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.116.0 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.115.0 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.114.2 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.114.1 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.114.0 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.113.6 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.113.5 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.113.4 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
avm-tools-0.113.3 sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb
eac_ruby_gems_utils-0.9.9 lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb