Sha256: c7785fa923d7fbd0d2f03ad0534811f133e3ceb5d80cfb021ae87711b75f113e

Contents?: true

Size: 1.78 KB

Versions: 29

Compression:

Stored size: 1.78 KB

Contents

require 'run_loop'

module Calabash
  module Cucumber
    # @!visibility private
    # A module for reading and writing property list values.
    module PlistBuddy

      # Reads key from file and returns the result.
      # @param [String] key the key to inspect (may not be nil or empty)
      # @param [String] file the plist to read
      # @param [Hash] opts options for controlling execution
      # @option opts [Boolean] :verbose (false) controls log level
      # @return [String] the value of the key
      # @raise [ArgumentError] if nil or empty key
      def plist_read(key, file, opts={})
        RunLoop::PlistBuddy.new.plist_read(key, file, opts)
      end

      # Checks if the key exists in plist.
      # @param [String] key the key to inspect (may not be nil or empty)
      # @param [String] file the plist to read
      # @param [Hash] opts options for controlling execution
      # @option opts [Boolean] :verbose (false) controls log level
      # @return [Boolean] true if the key exists in plist file
      def plist_key_exists?(key, file, opts={})
        plist_read(key, file, opts) != nil
      end

      # Replaces or creates the value of key in the file.
      #
      # @param [String] key the key to set (may not be nil or empty)
      # @param [String] type the plist type (used only when adding a value)
      # @param [String] value the new value
      # @param [String] file the plist to read
      # @param [Hash] opts options for controlling execution
      # @option opts [Boolean] :verbose (false) controls log level
      # @return [Boolean] true if the operation was successful
      # @raise [ArgumentError] if nil or empty key
      def plist_set(key, type, value, file, opts={})
        RunLoop::PlistBuddy.new.plist_set(key, type, value, file, opts)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
calabash-cucumber-0.18.2 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.18.1 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.18.0 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.17.1 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.17.0 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.16.4 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.16.3 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.16.2 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.16.1 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.15.0 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.14.3 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.14.2 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.14.2.pre1 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.14.1 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.14.0 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.13.0 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.12.3 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.12.2 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.12.1 lib/calabash-cucumber/utils/plist_buddy.rb
calabash-cucumber-0.12.0 lib/calabash-cucumber/utils/plist_buddy.rb