Sha256: 3fa39990018bbdfda99840b7fd87b2c86ca700672d3415d42b5d7d045a8139fe

Contents?: true

Size: 902 Bytes

Versions: 4

Compression:

Stored size: 902 Bytes

Contents

# frozen_string_literal: true
require 'cucumber/platform'
require 'cucumber/gherkin/formatter/ansi_escapes'

module Cucumber
  module Deprecate
    module ForUsers
      AnsiEscapes = Cucumber::Gherkin::Formatter::AnsiEscapes

      def self.call(message, method, remove_after_version)
        STDERR.puts AnsiEscapes.failed + "\nWARNING: ##{method} is deprecated and will be removed after version #{remove_after_version}. #{message}.\n(Called from #{caller[2]})" + AnsiEscapes.reset
      end
    end

    module ForDevelopers
      def self.call(_message, _method, remove_after_version)
        if Cucumber::VERSION > remove_after_version
          raise "This method is due for removal after version #{remove_after_version}"
        end
      end
    end

    STRATEGY = $0.match(/rspec$/) ? ForDevelopers : ForUsers
  end

  def self.deprecate(*args)
    Deprecate::STRATEGY.call(*args)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cucumber-3.1.0 lib/cucumber/deprecate.rb
cucumber-3.0.2 lib/cucumber/deprecate.rb
cucumber-3.0.1 lib/cucumber/deprecate.rb
cucumber-3.0.0 lib/cucumber/deprecate.rb