pbxplorer 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pbxplorer.rb +28 -24
- data/pbxplorer.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3e3f862284ccc9bc4118e8bf941411ba83f4506
|
4
|
+
data.tar.gz: e640e0417e43e687c7299fc85a340467df2a0e26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77e9b960821c420de9ea6f3c1e076f4fad0d957783fab6ee2af082554fccbcdefd57080b4a27e6c491a1f66ca13f7d0533e487f47d0b1c28b128d8e297029961
|
7
|
+
data.tar.gz: e0040f5d1793f7c2a7c1cd6a02d195ce6ae52d5b56d106e404eba13592cc444d35643f9f875dadc3033a9b2fb1b10434c2ed3dc7c51995cb8e0ee23e15937ab2
|
data/lib/pbxplorer.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
class String
|
4
|
-
alias
|
4
|
+
alias to_pbx_plist to_json
|
5
|
+
end
|
6
|
+
|
7
|
+
class Fixnum
|
8
|
+
alias to_pbx_plist to_json
|
5
9
|
end
|
6
10
|
|
7
11
|
class Array
|
8
|
-
def
|
9
|
-
items = self.map { |item| "#{item.
|
12
|
+
def to_pbx_plist
|
13
|
+
items = self.map { |item| "#{item.to_pbx_plist}" }
|
10
14
|
"( #{items.join ","} )"
|
11
15
|
end
|
12
16
|
end
|
13
17
|
|
14
18
|
class Hash
|
15
|
-
def
|
16
|
-
items = self.map { |key, val| "#{key.
|
19
|
+
def to_pbx_plist
|
20
|
+
items = self.map { |key, val| "#{key.to_pbx_plist} = #{val.to_pbx_plist};\n" }
|
17
21
|
"{ #{items.join} }"
|
18
22
|
end
|
19
23
|
end
|
@@ -21,7 +25,7 @@ end
|
|
21
25
|
class PBXObject < Hash
|
22
26
|
attr_accessor :project_file
|
23
27
|
attr_reader :uuid
|
24
|
-
|
28
|
+
|
25
29
|
def self.filter objs, attrs
|
26
30
|
objs.select do |obj|
|
27
31
|
attrs.select { |key, val| obj[key] == val }.length == attrs.length
|
@@ -33,13 +37,13 @@ class PBXObject < Hash
|
|
33
37
|
objs = self.filter(objs, attrs) if attrs
|
34
38
|
objs
|
35
39
|
end
|
36
|
-
|
40
|
+
|
37
41
|
def initialize hash={}, uuid=""
|
38
42
|
24.times { uuid += "0123456789ABCDEF"[rand(16),1] } if uuid.empty?
|
39
|
-
|
43
|
+
|
40
44
|
@project = nil
|
41
45
|
@uuid = uuid
|
42
|
-
|
46
|
+
|
43
47
|
self.merge! hash
|
44
48
|
self["isa"] ||= self.class.to_s
|
45
49
|
end
|
@@ -102,15 +106,15 @@ class PBXGroup < PBXObject
|
|
102
106
|
|
103
107
|
children.flatten
|
104
108
|
end
|
105
|
-
|
109
|
+
|
106
110
|
def file_refs recursive=false
|
107
111
|
PBXFileReference.objects_of_class self.children(recursive)
|
108
112
|
end
|
109
|
-
|
113
|
+
|
110
114
|
def subgroups recursive=false
|
111
115
|
PBXGroup.objects_of_class self.children(recursive)
|
112
116
|
end
|
113
|
-
|
117
|
+
|
114
118
|
def variant_groups recursive=false
|
115
119
|
PBXVariantGroup.objects_of_class self.children(recursive)
|
116
120
|
end
|
@@ -162,7 +166,7 @@ class PBXProject < PBXObject
|
|
162
166
|
def targets
|
163
167
|
self.project_file.objects_with_uuids self["targets"]
|
164
168
|
end
|
165
|
-
|
169
|
+
|
166
170
|
def build_configuration_list
|
167
171
|
self.project_file.object_with_uuid self["buildConfigurationList"]
|
168
172
|
end
|
@@ -190,7 +194,7 @@ class XCProjectFile
|
|
190
194
|
@path += "/project.pbxproj" if File.directory? @path
|
191
195
|
|
192
196
|
@json = JSON.parse(`plutil -convert json -o - "#{@path}"`)
|
193
|
-
|
197
|
+
|
194
198
|
objs = @json["objects"]
|
195
199
|
@json["objects"] = {}
|
196
200
|
|
@@ -200,16 +204,16 @@ class XCProjectFile
|
|
200
204
|
klass = Object.const_get hash["isa"]
|
201
205
|
rescue
|
202
206
|
end
|
203
|
-
|
207
|
+
|
204
208
|
self.add_object klass.new(hash, uuid)
|
205
209
|
end
|
206
210
|
end
|
207
211
|
|
208
212
|
def save path=nil
|
209
213
|
path ||= @path
|
210
|
-
File.open(path, "w") { |f| f.write @json.
|
214
|
+
File.open(path, "w") { |f| f.write @json.to_pbx_plist }
|
211
215
|
end
|
212
|
-
|
216
|
+
|
213
217
|
def project
|
214
218
|
self.object_with_uuid @json["rootObject"]
|
215
219
|
end
|
@@ -231,31 +235,31 @@ class XCProjectFile
|
|
231
235
|
objs = PBXObject.filter(objs, attrs) if attrs
|
232
236
|
objs
|
233
237
|
end
|
234
|
-
|
238
|
+
|
235
239
|
def object_with_uuid uuid
|
236
240
|
@json["objects"][uuid]
|
237
241
|
end
|
238
|
-
|
242
|
+
|
239
243
|
def new_object klass, attrs={}
|
240
244
|
obj = klass.new attrs
|
241
245
|
self.add_object obj
|
242
246
|
obj
|
243
247
|
end
|
244
|
-
|
248
|
+
|
245
249
|
def add_object obj
|
246
250
|
obj.project_file = self
|
247
251
|
@json["objects"][obj.uuid] = obj
|
248
252
|
end
|
249
|
-
|
253
|
+
|
250
254
|
def remove_object obj
|
251
255
|
obj.project_file = nil
|
252
256
|
@json["objects"].delete obj.uuid
|
253
257
|
end
|
254
|
-
|
258
|
+
|
255
259
|
def remove_file_ref file_ref
|
256
260
|
build_files = self.objects_of_class PBXBuildFile, { "fileRef" => file_ref.uuid }
|
257
261
|
build_file_uuids = build_files.map { |obj| obj.uuid }
|
258
|
-
|
262
|
+
|
259
263
|
build_files.each { |build_file| self.remove_object build_file }
|
260
264
|
self.objects_of_class(PBXBuildPhase).each { |phase| phase["files"] -= build_file_uuids }
|
261
265
|
self.objects_of_class(PBXGroup).each { |group| group["children"].delete file_ref }
|
@@ -266,7 +270,7 @@ class XCProjectFile
|
|
266
270
|
puts "project = project_file.project"
|
267
271
|
PBXProject
|
268
272
|
end
|
269
|
-
|
273
|
+
|
270
274
|
def inspect
|
271
275
|
"{\n rootObject = #{@json['rootObject'].inspect}\n objects = < #{@json['objects'].length} objects >\n}"
|
272
276
|
end
|
data/pbxplorer.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "pbxplorer"
|
3
|
-
s.version = "1.
|
4
|
-
s.date = "
|
3
|
+
s.version = "1.2.0"
|
4
|
+
s.date = "2017-07-11"
|
5
5
|
s.summary = "Xcode project file editor"
|
6
6
|
s.description = "pbxplorer is a set of Ruby classes for parsing, editing, and saving Xcode project (.pbxproj) files. It can also be used to explore the contents of a project using the interactive Ruby shell."
|
7
7
|
s.authors = ["Mark Smith"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pbxplorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: pbxplorer is a set of Ruby classes for parsing, editing, and saving Xcode
|
14
14
|
project (.pbxproj) files. It can also be used to explore the contents of a project
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
45
|
rubyforge_project:
|
46
|
-
rubygems_version: 2.0.14
|
46
|
+
rubygems_version: 2.0.14.1
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Xcode project file editor
|