pbxproject 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -10,7 +10,21 @@ module PBXProject
10
10
  @filename = args[:file]
11
11
 
12
12
  # initialize our class
13
- @sections = {}
13
+ # make sure that our sections are on proper order
14
+ @sections = {
15
+ :PBXBuildFile => nil,
16
+ :PBXFileReference => nil,
17
+ :PBXFrameworksBuildPhase => nil,
18
+ :PBXGroup => nil,
19
+ :PBXNativeTarget => nil,
20
+ :PBXProject => nil,
21
+ :PBXResourcesBuildPhase => nil,
22
+ :PBXShellScriptBuildPhase => nil,
23
+ :PBXSourcesBuildPhase => nil,
24
+ :PBXVariantGroup => nil,
25
+ :XCBuildConfiguration => nil,
26
+ :XCConfigurationList => nil
27
+ }
14
28
 
15
29
  # and set that we're ready for parsing
16
30
  @state = :ready
@@ -36,7 +50,7 @@ module PBXProject
36
50
  # Read our file
37
51
  pbx.each_line do |line|
38
52
  if (line_num == 0 && !line.match(Regexp.new(Regexp.escape('// !$*UTF8*$!'))))
39
- raise "Unkown file format"
53
+ raise "Unknown file format"
40
54
  end
41
55
 
42
56
  # Main level Attributes
@@ -201,11 +215,15 @@ module PBXProject
201
215
  args.delete(:type)
202
216
  @sections.each do |t, arr|
203
217
  next unless t == type_name
204
-
218
+
205
219
  arr.each do |item|
206
220
  args.each do |k,v|
207
- key = item.instance_variable_get("@#{k}")
208
- if (key && (key == v || (key.kind_of?(PBXTypes::BasicValue) && key.value == v)))
221
+ val = item.instance_variable_get("@#{k}")
222
+ val = (val.respond_to?(:value) ? val.value : val)
223
+
224
+ next unless val
225
+
226
+ if (val.match(Regexp.new("\"?#{v}\"?")))
209
227
  return item
210
228
  end
211
229
  end
@@ -239,6 +257,7 @@ module PBXProject
239
257
  pbx += "\tobjects = {\n"
240
258
 
241
259
  @sections.each do |type, val|
260
+ next if val.nil? # skip section if it's empty
242
261
  pbx += "\n/* Begin %s section */\n" % type
243
262
 
244
263
  val.each do |item|
@@ -24,7 +24,7 @@ module PBXProject
24
24
  attr_accessor :guid, :isa, :comment
25
25
 
26
26
  def initialize args = {}
27
- @isa = basic_value(self.class.name)
27
+ @isa = basic_value(self.class.name.split("::").last)
28
28
  @guid = hashify(self)
29
29
 
30
30
  args.each do |k,v|
data/pbxproject.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pbxproject}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mikko Kokkonen"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: pbxproject
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mikko Kokkonen
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- hash: 1472617555242116731
102
+ hash: -3725904592710847939
103
103
  segments:
104
104
  - 0
105
105
  version: "0"