Created
August 24, 2013 07:48
-
-
Save kechol/6326720 to your computer and use it in GitHub Desktop.
parse URL Scheme from plists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| require "rubygems" | |
| require "plist" | |
| PLIST_DIR = "./file/" | |
| result = {} | |
| Dir.foreach(PLIST_DIR) do |file| | |
| path = PLIST_DIR + file | |
| next unless File::file?(path) | |
| puts path | |
| xml = Plist::parse_xml(path) | |
| apps = xml['applicationDictionaries'] | |
| apps.each do |app| | |
| appname = app['CFBundleName'] | |
| puts appname | |
| if(app['CFBundleURLTypes'] && app['CFBundleURLTypes'].count > 0) | |
| result[appname] = app['CFBundleURLTypes'][0]['CFBundleURLSchemes'] | |
| else | |
| result[appname] = [] | |
| end | |
| end | |
| end | |
| puts result.to_s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment