Module: XCJobs::InfoPlist
- Extended by:
- InfoPlist
- Defined in:
- lib/xcjobs/info_plist.rb,
lib/xcjobs/info_plist.rb
Defined Under Namespace
Classes: Version
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #build_version ⇒ Object
- #build_version=(revision) ⇒ Object
- #bump_marketing_version_segment(segment_index) ⇒ Object
- #marketing_and_build_version ⇒ Object
- #marketing_version ⇒ Object
- #marketing_version=(version) ⇒ Object
- #set(key, value, file = "#{path}") ⇒ Object
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/xcjobs/info_plist.rb', line 6 def path @path end |
Instance Method Details
#[](key) ⇒ Object
8 9 10 11 12 |
# 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) ⇒ Object
18 19 20 |
# File 'lib/xcjobs/info_plist.rb', line 18 def []=(key, value) set(key, value) end |
#build_version ⇒ Object
30 31 32 |
# File 'lib/xcjobs/info_plist.rb', line 30 def build_version self['CFBundleVersion'] end |
#build_version=(revision) ⇒ Object
34 35 36 |
# File 'lib/xcjobs/info_plist.rb', line 34 def build_version=(revision) self['CFBundleVersion'] = revision end |
#bump_marketing_version_segment(segment_index) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# 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 ⇒ Object
48 49 50 |
# File 'lib/xcjobs/info_plist.rb', line 48 def marketing_and_build_version "#{marketing_version} (#{build_version})" end |
#marketing_version ⇒ Object
22 23 24 |
# File 'lib/xcjobs/info_plist.rb', line 22 def marketing_version self['CFBundleShortVersionString'] end |
#marketing_version=(version) ⇒ Object
26 27 28 |
# File 'lib/xcjobs/info_plist.rb', line 26 def marketing_version=(version) self['CFBundleShortVersionString'] = version end |
#set(key, value, file = "#{path}") ⇒ Object
14 15 16 |
# 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 |