Sha256: 5a2a942697411020ab8b45a29e8258515d56f450813f9f25a412dee2e3f68993

Contents?: true

Size: 1.78 KB

Versions: 4

Compression:

Stored size: 1.78 KB

Contents

require 'sim_launcher'

module Calabash
  module Cucumber

    # this module has been replaced by Simulator Launcher
    #
    # @deprecated Use the SimulatorLauncher class instead
    # @since 0.9.169
    module SimulatorHelper

      # quits the simulator
      #
      # this has been deprecated, but it appears in legacy launch hooks
      #
      # use this pattern instead:
      #
      #   at_exit do
      #     launcher = Calabash::Cucumber::Launcher.new
      #     if launcher.simulator_target?
      #       launcher.simulator_launcher.stop unless launcher.calabash_no_stop?
      #     end
      #   end
      #
      # @deprecated use the SimulatorLauncher.new().stop instead
      def self.stop
        unless ENV['CALABASH_NO_DEPRECATION'] == '1'
          if RUBY_VERSION < '2.0'
            stack = Kernel.caller()[1..6].join("\n")
          else
            stack = Kernel.caller(0, 6)[1..-1].join("\n")
          end

          msgs = ['The Calabash::Cucumber::SimulatorHelper module has been replaced.',
                  'Please replace:',
                  '',
                  '    Calabash::Cucumber::SimulatorHelper.stop',
                  '',
                  'with this:',
                  '',
                  '    launcher = Calabash::Cucumber::Launcher.new',
                  '    launcher.simulator_launcher.stop',
                  '',
                  'The stack trace below will show you the line number you need to change.']

          msg = "deprecated '0.9.169' - #{msgs.join("\n")}\n#{stack}"

          begin
            STDERR.puts "\033[34m\nWARN: #{msg}\033[0m"
          rescue
            STDERR.puts "\nWARN: #{msg}"
          end
        end
        simulator = SimLauncher::Simulator.new()
        simulator.quit_simulator
        simulator
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
calabash-cucumber-0.10.0.pre1 lib/calabash-cucumber/launch/simulator_helper.rb
calabash-cucumber-0.9.169 lib/calabash-cucumber/launch/simulator_helper.rb
calabash-cucumber-0.9.169.pre6 lib/calabash-cucumber/launch/simulator_helper.rb
calabash-cucumber-0.9.169.pre5 lib/calabash-cucumber/launch/simulator_helper.rb