Sha256: 49a57556d2ea8ea73a4688d470143103396c7733b33f5860188b0102a7315ac4

Contents?: true

Size: 780 Bytes

Versions: 21

Compression:

Stored size: 780 Bytes

Contents

module Calabash
  module Cucumber
    # @!visibility private
    class LogTailer

      # @!visibility private
      def self.tail_in_terminal(path)
        if !File.exist?(path)
          raise RuntimeError, %Q[
Cannot tail a file that does not exist:

#{path}

]
        end

        term_part = %Q[xcrun osascript -e 'tell application "Terminal" to do script]
        tail_part = %Q["tail -n 10000 -F #{path} | grep -v \\"Default: \\\\*\\""']
        cmd = "#{term_part} #{tail_part}"

        if !LogTailer.run_command(cmd)
          raise RuntimeError, %Q[
Could not tail file:

#{path}

with command:

#{cmd}

]
        end

        true
      end

      private

      # @!visibility private
      def self.run_command(cmd)
        system(cmd)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
calabash-cucumber-0.20.0 lib/calabash-cucumber/log_tailer.rb