Class: BigKeeper::InfoPlistOperator
- Inherits:
-
Object
- Object
- BigKeeper::InfoPlistOperator
- Defined in:
- lib/big_keeper/util/info_plist_operator.rb
Overview
Operator for Info.plist
Instance Method Summary collapse
- #change_version_build(path, version) ⇒ Object
-
#find_infoPlist_filePath(path) ⇒ String
Find Info.plist file path.
Instance Method Details
#change_version_build(path, version) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/big_keeper/util/info_plist_operator.rb', line 9 def change_version_build(path, version) if find_infoPlist_filePath(path) == '' raise %(Not find be Info.plist at #{path}) end info_plist_path = find_infoPlist_filePath(path) result = Plist.parse_xml(info_plist_path) result['CFBundleVersion'] = getBuildVersion(version, result['CFBundleShortVersionString'], result['CFBundleVersion']).to_s result['CFBundleShortVersionString'] = version.to_s Plist::Emit.save_plist(result, info_plist_path) puts %Q('Version has changed to #{version}') end |
#find_infoPlist_filePath(path) ⇒ String
Find Info.plist file path
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/big_keeper/util/info_plist_operator.rb', line 23 def find_infoPlist_filePath(path) paths = Pathname.new(path).children.select { |pn| pn.extname == '.xcodeproj' } xcodePath = paths[0].to_s.split('/')[-1] projectName = xcodePath.split('.')[0] projectPath = '' Pathname.new("#{path}/#{projectName}").children.select { |pn| if pn.to_s == "#{path}/#{projectName}/Info.plist" projectPath = "#{path}/#{projectName}/Info.plist" end } projectPath end |