module XCJobs::InfoPlist

Attributes

path[RW]

Public Instance Methods

[](key) click to toggle source
# File lib/xcjobs/info_plist.rb, line 8
def [](key)
  output = %x[/usr/libexec/PlistBuddy -c "Print #{key}" #{path}].strip
  raise "The key `#{key}' does not exist in `#{path}'." if output.include?('Does Not Exist')
  output
end
[]=(key, value) click to toggle source
# File lib/xcjobs/info_plist.rb, line 18
def []=(key, value)
  set(key, value)
end
build_version() click to toggle source
# File lib/xcjobs/info_plist.rb, line 30
def build_version
  self['CFBundleVersion']
end
build_version=(revision) click to toggle source
# File lib/xcjobs/info_plist.rb, line 34
def build_version=(revision)
  self['CFBundleVersion'] = revision
end
bump_marketing_version_segment(segment_index) click to toggle source
# File lib/xcjobs/info_plist.rb, line 38
def bump_marketing_version_segment(segment_index)
  segments = Gem::Version.new(marketing_version).segments
  segments[segment_index] = segments[segment_index].to_i + 1
  (segment_index+1..segments.size - 1).each { |i| segments[i] = 0 }
  version = segments.map(&:to_i).join('.')

  puts "Setting marketing version to: #{version}"
  self.marketing_version = version
end
marketing_and_build_version() click to toggle source
# File lib/xcjobs/info_plist.rb, line 48
def marketing_and_build_version
  "#{marketing_version} (#{build_version})"
end
marketing_version() click to toggle source
# File lib/xcjobs/info_plist.rb, line 22
def marketing_version
  self['CFBundleShortVersionString']
end
marketing_version=(version) click to toggle source
# File lib/xcjobs/info_plist.rb, line 26
def marketing_version=(version)
  self['CFBundleShortVersionString'] = version
end
set(key, value, file = " click to toggle source
# File lib/xcjobs/info_plist.rb, line 14
def set(key, value, file = "#{path}")
  %x[/usr/libexec/PlistBuddy -c 'Set :#{key} "#{value}"' '#{file}'].strip
end