xcodeproject 0.3.6 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -122,6 +122,11 @@ module XcodeProject
122
122
  path.relative? ? path : path.relative_path_from(total_path)
123
123
  end
124
124
 
125
+ def remove_file_ref (gpath)
126
+ obj = file(gpath)
127
+ obj.remove! unless obj.nil?
128
+ end
129
+
125
130
  def remove_group (gpath)
126
131
  obj = group(gpath)
127
132
  obj.remove! unless obj.nil?
@@ -155,8 +160,9 @@ module XcodeProject
155
160
  PBXGroup.new(root, uuid, data)
156
161
  end
157
162
 
158
- alias :file :file_ref
159
- alias :add_file :add_file_ref
163
+ alias :file :file_ref
164
+ alias :add_file :add_file_ref
165
+ alias :remove_file :remove_file_ref
160
166
 
161
167
  private
162
168
 
@@ -34,7 +34,10 @@ require 'xcodeproject/extend/hash'
34
34
  module XcodeProject
35
35
  class RootNode
36
36
  def initialize (data, wd)
37
- @data, @wd = data, Pathname.new(wd)
37
+ @data = data
38
+
39
+ @wd = Pathname.new(wd)
40
+ @wd = Pathname.new(ENV['PWD']).join(@wd) if @wd.relative?
38
41
 
39
42
  @objects = data['objects']
40
43
  @uuid_generator = UUIDGenerator.new
@@ -1,3 +1,3 @@
1
1
  module XcodeProject
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.8"
3
3
  end
@@ -246,6 +246,20 @@ describe XcodeProject::PBXGroup do
246
246
  end
247
247
  end
248
248
 
249
+ describe "#remove_file_ref" do
250
+ context "if the file reference exists" do
251
+ it "removes the object" do
252
+ obj.remove_file_ref('group1a/file2c.m')
253
+ obj.file_ref('group1a/file2c.m').should be_nil
254
+ end
255
+ end
256
+ context "if the file reference doesn't exist" do
257
+ it "returns nil" do
258
+ obj.remove_file_ref('group1a/file2c_ghost.m').should be_nil
259
+ end
260
+ end
261
+ end
262
+
249
263
  describe "#remove_group" do
250
264
  context "if the group exists" do
251
265
  it "removes the object" do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 8
9
+ version: 0.3.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrey Nesterov
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-06-29 00:00:00 +04:00
17
+ date: 2012-08-22 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency