plview 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 981ba8c007476823108d5ba135113b173b25b277
4
+ data.tar.gz: bcfa7e4d29a4d65163c7bc3b7c570278f9a5aae9
5
+ SHA512:
6
+ metadata.gz: 520ac14dbdb96d4431b8808d9665ddf173c3a7349b180189b49f59eb10582800ca10101fa51bc056dd1f2bab61c0fa145b4a0cc463d2fb79af388e9de68eab45
7
+ data.tar.gz: a44cec29f87f76a853d5f864a0a7563b1c5e0ab5a581a8b1da62b6533cda10f6400673d9a5da49df3652954b25a6a1c08f1f4d42cff319ce88ebf06b8edf97f6
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in plview.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Yusuke Mito
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,50 @@
1
+ # Plview
2
+
3
+ plist viewer for iOS Simulator. You can get contents of UserDefaults by json format.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ $ gem install plview
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Print contents of UserDefaults
14
+
15
+ You need to specify iOS version and your app name.
16
+
17
+ ```sh
18
+ $ plview -v 7.0 -a APP_NAME
19
+ {"key":"value", ...}
20
+ ```
21
+
22
+ ### Options
23
+
24
+ ```sh
25
+ $ plview -h
26
+ Usage: plist.rb [options]
27
+ -v, --version iOS Version
28
+ -a, --application App name
29
+ -p, --plist Plist name
30
+ --versions Print all available iOS versions
31
+ --apps Print all installed applications
32
+ --plists Print all plists for specified app
33
+ --path Print full path for (version|app|plist)
34
+ -h, --help Display this help message.
35
+ ```
36
+
37
+ When you use plview in other scripts, `--path` option would be useful. It returns directory path for specified version or app or plist.
38
+
39
+ ```sh
40
+ $ plist -v 7.0 -a APP_NAME -path
41
+ /Users/you/Library/Application Support/iPhone Simulator/7.0/Applications/ABCDEFGH-IJKL-MNOP-QRST-UVWXYZ123456
42
+ ```
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it
47
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
48
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
49
+ 4. Push to the branch (`git push origin my-new-feature`)
50
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
4
+ require 'plview'
5
+ require 'slop'
6
+
7
+ include Plview
8
+
9
+ opts = Slop.parse(help: true) do
10
+ banner 'Usage: plview [options]'
11
+ on 'v=', 'version', 'iOS Version'
12
+ on 'a=', 'application', 'App name'
13
+ on 'p=', 'plist', 'Plist name'
14
+ on 'versions', 'Print all available iOS versions'
15
+ on 'apps', 'Print all installed applications'
16
+ on 'plists', 'Print all plists for specified app'
17
+ on 'path', 'Print full path for (version|app|plist)'
18
+ end
19
+
20
+ if opts.versions?
21
+ if opts.path?
22
+ puts versions.values.sort
23
+ else
24
+ puts versions.keys.sort
25
+ end
26
+ exit
27
+ end
28
+
29
+ if versions.has_key?(opts[:v])
30
+ version = opts[:v]
31
+ else
32
+ puts "Error: invalid version (#{opts[:v]}). Use -v with following version"
33
+ puts "Available versions:"
34
+ puts versions.keys.sort
35
+ exit
36
+ end
37
+
38
+ apps = apps(version)
39
+
40
+ if opts.apps?
41
+ if opts.path?
42
+ puts apps.values.sort
43
+ else
44
+ puts apps.keys.sort
45
+ end
46
+ exit
47
+ end
48
+
49
+ if apps.has_key?(opts[:a])
50
+ app = opts[:a]
51
+ else
52
+ puts "Error: invalid app name (#{opts[:a]}). Use -a with following version"
53
+ puts "Available apps:"
54
+ puts apps.keys.sort
55
+ exit
56
+ end
57
+
58
+ plists = plists(apps[app])
59
+
60
+ if opts.plists?
61
+ if opts.path?
62
+ puts plists.values.map {|pl| pl.filename }.sort
63
+ else
64
+ puts plists.keys.sort
65
+ end
66
+ exit
67
+ end
68
+
69
+ if opts.path?
70
+ puts apps[app]
71
+ exit
72
+ end
73
+
74
+ if plists.has_key?(opts[:p])
75
+ plist = plists[opts[:p]]
76
+ else
77
+ plist = plists.values.first
78
+ end
79
+
80
+ puts plist.value.to_hash.to_json
@@ -0,0 +1,44 @@
1
+ require 'plview/version'
2
+ require 'CFPropertyList'
3
+ require 'json'
4
+
5
+ module CFPropertyList
6
+ class CFDictionary
7
+ def to_hash
8
+ hash = {}
9
+ self.value.each do |key, value|
10
+ if value.respond_to?(:to_hash)
11
+ hash[key] = value.to_hash
12
+ else
13
+ hash[key] = value.value
14
+ end
15
+ end
16
+ hash
17
+ end
18
+ end
19
+ end
20
+
21
+ module Plview
22
+ BASE = "#{ENV['HOME']}/Library/Application\ Support/iPhone\ Simulator/"
23
+
24
+ def versions
25
+ @versions ||= Dir.glob(BASE + '*').reject {|path| path =~ /User$/ }.inject({}) {|hash, path|
26
+ hash[path.sub(BASE, '')] = path
27
+ hash
28
+ }
29
+ end
30
+
31
+ def apps(version)
32
+ @apps ||= Dir.glob("#{BASE}#{version}/Applications/**/*.app").inject({}) do |hash, path|
33
+ hash[File.basename(path).sub(/.app/, '')] = File.dirname(path)
34
+ hash
35
+ end
36
+ end
37
+
38
+ def plists(path)
39
+ @plists ||= Dir.glob("#{path}/Library/Preferences/*.plist").reject {|path| path =~ /PeoplePicker/ }.inject({}) do |hash, path|
40
+ hash[File.basename(path)] = CFPropertyList::List.new(file: path)
41
+ hash
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,3 @@
1
+ module Plview
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'plview/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "plview"
8
+ spec.version = Plview::VERSION
9
+ spec.authors = ["Yusuke Mito"]
10
+ spec.email = ["y310.1984@gmail.com"]
11
+ spec.summary = %q{plist viewer for iOS Simulator}
12
+ spec.description = %q{plist viewer for iOS Simulator}
13
+ spec.homepage = "https://github.com/y310/plview"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "CFPropertyList", "~> 2.2"
22
+ spec.add_dependency "slop", "~> 3.4"
23
+ spec.add_development_dependency "bundler", "~> 1.4"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: plview
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yusuke Mito
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: CFPropertyList
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '2.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: slop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '3.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '3.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.4'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: plist viewer for iOS Simulator
70
+ email:
71
+ - y310.1984@gmail.com
72
+ executables:
73
+ - plview
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/plview
83
+ - lib/plview.rb
84
+ - lib/plview/version.rb
85
+ - plview.gemspec
86
+ homepage: https://github.com/y310/plview
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.0.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: plist viewer for iOS Simulator
110
+ test_files: []