xcselect 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/xcsim +12 -3
- data/lib/xcselect/version.rb +1 -1
- data/lib/xcselect/xcapp.rb +23 -11
- metadata +1 -1
data/bin/xcsim
CHANGED
@@ -15,10 +15,13 @@ class Main
|
|
15
15
|
optparse = OptionParser.new do |opts|
|
16
16
|
opts.on('-h', '--help', "Display this !!") { puts opts; exit }
|
17
17
|
opts.on('-v', '--version', "Print version info") { puts "xcselect-" + VERSION; exit; }
|
18
|
+
|
18
19
|
opts.on('-p', '--print', "print the path instead of opening it") { @options[:print] = true }
|
20
|
+
opts.on('-c', '--cd', "cd into the directory (spawns new shell, type `exit` to return) ") { @options[:print] = false; @options[:cd] = true }
|
21
|
+
|
22
|
+
opts.on('-a', '--apps' , "Show list of apps") { show_apps(); exit }
|
19
23
|
opts.on('-d', '--latest-documents' , "Reveal last built app's documents folder") { show_latest_docs() ;exit}
|
20
24
|
opts.on('-n', '--latest-newsstand' , "Show list of newsstand issues for last built app") { show_latest_newsstand(); exit }
|
21
|
-
opts.on('-a', '--apps' , "Show list of apps") { show_apps(); exit }
|
22
25
|
end
|
23
26
|
begin
|
24
27
|
optparse.parse!
|
@@ -34,7 +37,12 @@ class Main
|
|
34
37
|
end
|
35
38
|
|
36
39
|
def open_path p
|
37
|
-
if @options[:
|
40
|
+
if @options[:cd]
|
41
|
+
# this will allow you to go into the folder
|
42
|
+
# then type exit to return to your parent shell
|
43
|
+
Dir.chdir p
|
44
|
+
exec ENV['SHELL']
|
45
|
+
elsif @options[:print]
|
38
46
|
puts p
|
39
47
|
else
|
40
48
|
`open -R "#{p}"`
|
@@ -44,6 +52,7 @@ class Main
|
|
44
52
|
def select_menu title, selections
|
45
53
|
i = 0
|
46
54
|
puts title
|
55
|
+
puts ""
|
47
56
|
selections.each do |opt|
|
48
57
|
i += 1
|
49
58
|
puts " [#{i}] #{opt}"
|
@@ -78,7 +87,7 @@ class Main
|
|
78
87
|
open_path ns_issues.last[issue_names.last]
|
79
88
|
return
|
80
89
|
end
|
81
|
-
select_menu("Select issue in #{latest_app
|
90
|
+
select_menu("Select issue in #{latest_app} to open:", issue_names) {|i|
|
82
91
|
open_path ns_issues.values[i]
|
83
92
|
}
|
84
93
|
|
data/lib/xcselect/version.rb
CHANGED
data/lib/xcselect/xcapp.rb
CHANGED
@@ -68,17 +68,29 @@ module Xcselect
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def newsstand_objects
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
}
|
81
|
-
|
71
|
+
issues = {}
|
72
|
+
return issues unless newsstand?
|
73
|
+
# this is an NSKeyedArchiver plist
|
74
|
+
ns_plist = Plist::parse_xml(read_bin_plist_to_xml("#{base_dir}/Library/Application Support/com.apple.newsstand-library.plist"))
|
75
|
+
|
76
|
+
# this is the integer that we will use to filter all archived nkissue objects
|
77
|
+
nk_issue_key = ns_plist['$objects'].index(ns_plist['$objects'].select{|o| o['$classname'] == "NKIssue"}.last)
|
78
|
+
|
79
|
+
# filter just the nkissue hashes
|
80
|
+
obj_key_hashs = ns_plist['$objects'].select{|o| o.class == Hash && o['$class'] && nk_issue_key == o['$class']['CF$UID'] }
|
81
|
+
object_array = ns_plist['$objects']
|
82
|
+
|
83
|
+
# load these paths as our apps have 1 folder inside the newsstand folders
|
84
|
+
paths = newsstand_issue_paths if oomph_app?
|
85
|
+
|
86
|
+
obj_key_hashs.each do |nskey|
|
87
|
+
name = object_array[nskey['name']['CF$UID']]
|
88
|
+
uuid = object_array[nskey['directory']['CF$UID']]
|
89
|
+
next if name.nil?
|
90
|
+
issues[name] = "#{newsstand_path}/#{uuid}"
|
91
|
+
issues[name] = paths.select{|p| p[uuid] }.last if oomph_app? # specially for me :)
|
92
|
+
end
|
93
|
+
return issues
|
82
94
|
end
|
83
95
|
|
84
96
|
def newsstand_path
|