Class: Yolo::Tools::Ios::Xcode
- Inherits:
-
Object
- Object
- Yolo::Tools::Ios::Xcode
- Defined in:
- lib/yolo/tools/ios/xcode.rb
Overview
Provides an interface to Xcode
Instance Attribute Summary collapse
-
#info_plist_path ⇒ Object
The path to an applications info plist.
-
#prefs_plist_path ⇒ Object
The path to The Xcode preferences file.
Instance Method Summary collapse
-
#build_number ⇒ String
Queries the instances info_plist hash to return the CFBundleVersion.
-
#build_path ⇒ String
Querys Xcode’s preferences to find it’s build folder location.
-
#info_plist ⇒ Hash
Creates a Hash representation of an applications info.plist.
-
#initialize(info_plist_path = "") ⇒ Xcode
constructor
Creates a new instance of Xcode with the default preferences p list location loaded.
-
#prefs ⇒ Hash
Returns a hash representation of Xcode’s preferences.
-
#version_number ⇒ String
Queries the instances info_plist hash to return the CFBundleShortVersionString.
Constructor Details
#initialize(info_plist_path = "") ⇒ Xcode
Creates a new instance of Xcode with the default preferences p list location loaded
22 23 24 25 |
# File 'lib/yolo/tools/ios/xcode.rb', line 22 def initialize(info_plist_path = "") self.prefs_plist_path = "#{File.('~')}/Library/Preferences/com.apple.dt.Xcode.plist" self.info_plist_path = info_plist_path end |
Instance Attribute Details
#info_plist_path ⇒ Object
The path to an applications info plist
15 16 17 |
# File 'lib/yolo/tools/ios/xcode.rb', line 15 def info_plist_path @info_plist_path end |
#prefs_plist_path ⇒ Object
The path to The Xcode preferences file
13 14 15 |
# File 'lib/yolo/tools/ios/xcode.rb', line 13 def prefs_plist_path @prefs_plist_path end |
Instance Method Details
#build_number ⇒ String
Queries the instances info_plist hash to return the CFBundleVersion
64 65 66 |
# File 'lib/yolo/tools/ios/xcode.rb', line 64 def build_number info_plist["CFBundleVersion"] end |
#build_path ⇒ String
Querys Xcode’s preferences to find it’s build folder location
40 41 42 43 44 |
# File 'lib/yolo/tools/ios/xcode.rb', line 40 def build_path path = prefs["IDECustomDerivedDataLocation"] path = "#{File.('~')}/Library/Developer/Xcode/DerivedData" unless path path end |
#info_plist ⇒ Hash
Creates a Hash representation of an applications info.plist
50 51 52 53 54 55 56 57 58 |
# File 'lib/yolo/tools/ios/xcode.rb', line 50 def info_plist if info_plist_path plist = CFPropertyList::List.new(:file => info_plist_path) CFPropertyList.native_types(plist.value) else error = Yolo::Formatters::ErrorFormatter.new error.info_plist_not_found end end |
#prefs ⇒ Hash
Returns a hash representation of Xcode’s preferences
31 32 33 34 |
# File 'lib/yolo/tools/ios/xcode.rb', line 31 def prefs plist = CFPropertyList::List.new(:file => prefs_plist_path) CFPropertyList.native_types(plist.value) end |
#version_number ⇒ String
Queries the instances info_plist hash to return the CFBundleShortVersionString
72 73 74 |
# File 'lib/yolo/tools/ios/xcode.rb', line 72 def version_number info_plist["CFBundleShortVersionString"] end |