Class: Potemkin::IosVersion
- Inherits:
-
Object
- Object
- Potemkin::IosVersion
- Extended by:
- Forwardable
- Defined in:
- lib/potemkin/version/ios_version.rb
Instance Method Summary collapse
- #fetch_version ⇒ Object
- #git_sha ⇒ Object
-
#initialize(plist_path) ⇒ IosVersion
constructor
A new instance of IosVersion.
- #to_s ⇒ Object
- #version ⇒ Object
- #write! ⇒ Object
Constructor Details
#initialize(plist_path) ⇒ IosVersion
Returns a new instance of IosVersion.
5 6 7 8 9 |
# File 'lib/potemkin/version/ios_version.rb', line 5 def initialize(plist_path) @plist_path = plist_path semver = fetch_version @version = Version.new(semver) end |
Instance Method Details
#fetch_version ⇒ Object
11 12 13 |
# File 'lib/potemkin/version/ios_version.rb', line 11 def fetch_version `/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" #{@plist_path}` end |
#git_sha ⇒ Object
19 20 21 |
# File 'lib/potemkin/version/ios_version.rb', line 19 def git_sha `/usr/bin/git log -1 --format="%H"`.strip()[0..10] end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/potemkin/version/ios_version.rb', line 28 def to_s "%s at %s" % [@version, @plist_path] end |
#version ⇒ Object
15 16 17 |
# File 'lib/potemkin/version/ios_version.rb', line 15 def version @version end |
#write! ⇒ Object
23 24 25 26 |
# File 'lib/potemkin/version/ios_version.rb', line 23 def write! `/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString #{@version}" #{@plist_path}` `/usr/libexec/PlistBuddy -c "Set CFBundleVersion #{git_sha}" #{@plist_path}` end |