Sha256: db3e126b3e842e70356dce6fbf22aa928b8c2179d54a45c0e40bb1020614a35e

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

require 'date'

module Bundler
  module Restrict
    module Checks
      class DateCheck
        def initialize(gem_version)
          @gem_version = gem_version
        end

        def z_date
          Date.parse ENV.fetch('BUNDLE_RESTRICT_Z_DATE', '2022-02-01')
        end

        def valid?
          @gem_version.release_date < z_date
        end

        def error
          return if valid?

          "Please downgrade '#{@gem_version.name}' version '#{@gem_version.number}: release date '#{@gem_version.release_date}' >= #{z_date}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bundler-restrict-0.1.2 lib/bundler/restrict/checks/date_check.rb
bundler-restrict-0.1.1 lib/bundler/restrict/checks/date_check.rb
bundler-restrict-0.1.0 lib/bundler/restrict/checks/date_check.rb