kintsugi 0.7.4 → 0.7.6

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.
@@ -21,7 +21,6 @@ describe Kintsugi, :apply_change_to_project do
21
21
 
22
22
  before do
23
23
  Kintsugi::Settings.interactive_resolution = false
24
- base_project.save
25
24
  end
26
25
 
27
26
  after do
@@ -32,14 +31,14 @@ describe Kintsugi, :apply_change_to_project do
32
31
 
33
32
  it "not raises when change is nil or doesn't have root object" do
34
33
  expect {
35
- theirs_project = create_copy_of_project(base_project.path, "theirs")
34
+ theirs_project = create_copy_of_project(base_project, "theirs")
36
35
  described_class.apply_change_to_project(base_project, nil, theirs_project)
37
36
  described_class.apply_change_to_project(base_project, {}, theirs_project)
38
37
  }.not_to raise_error
39
38
  end
40
39
 
41
40
  it "adds new target" do
42
- theirs_project = create_copy_of_project(base_project.path, "theirs")
41
+ theirs_project = create_copy_of_project(base_project, "theirs")
43
42
  theirs_project.new_target("com.apple.product-type.library.static", "foo", :ios)
44
43
 
45
44
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -50,7 +49,7 @@ describe Kintsugi, :apply_change_to_project do
50
49
  end
51
50
 
52
51
  it "adds new aggregate target" do
53
- theirs_project = create_copy_of_project(base_project.path, "theirs")
52
+ theirs_project = create_copy_of_project(base_project, "theirs")
54
53
  theirs_project.new_aggregate_target("foo")
55
54
 
56
55
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -61,7 +60,7 @@ describe Kintsugi, :apply_change_to_project do
61
60
  end
62
61
 
63
62
  it "adds package reference" do
64
- theirs_project = create_copy_of_project(base_project.path, "theirs")
63
+ theirs_project = create_copy_of_project(base_project, "theirs")
65
64
 
66
65
  theirs_project.root_object.package_references <<
67
66
  create_remote_swift_package_reference(theirs_project)
@@ -74,7 +73,7 @@ describe Kintsugi, :apply_change_to_project do
74
73
  end
75
74
 
76
75
  it "adds new subproject" do
77
- theirs_project = create_copy_of_project(base_project.path, "theirs")
76
+ theirs_project = create_copy_of_project(base_project, "theirs")
78
77
  add_new_subproject_to_project(theirs_project, "foo", "foo")
79
78
 
80
79
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -93,9 +92,8 @@ describe Kintsugi, :apply_change_to_project do
93
92
  create_reference_proxy_from_product_reference(base_project,
94
93
  base_project.root_object.project_references[0][:project_ref],
95
94
  subproject.products_group.files[-1])
96
- base_project.save
97
95
 
98
- theirs_project = create_copy_of_project(base_project.path, "theirs")
96
+ theirs_project = create_copy_of_project(base_project, "theirs")
99
97
  theirs_project.root_object.project_references[0][:product_group].children[-1].remove_from_project
100
98
 
101
99
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -107,7 +105,7 @@ describe Kintsugi, :apply_change_to_project do
107
105
 
108
106
  # Checks that the order the changes are applied in is correct.
109
107
  it "adds new subproject and reference to its framework" do
110
- theirs_project = create_copy_of_project(base_project.path, "theirs")
108
+ theirs_project = create_copy_of_project(base_project, "theirs")
111
109
  add_new_subproject_to_project(theirs_project, "foo", "foo")
112
110
 
113
111
  target = theirs_project.new_target("com.apple.product-type.library.static", "foo", :ios)
@@ -123,12 +121,11 @@ describe Kintsugi, :apply_change_to_project do
123
121
  end
124
122
 
125
123
  it "raises if adding subproject whose file reference isn't found" do
126
- ours_project = create_copy_of_project(base_project.path, "ours")
124
+ ours_project = create_copy_of_project(base_project, "ours")
127
125
 
128
126
  add_new_subproject_to_project(base_project, "foo", "foo")
129
- base_project.save
130
127
 
131
- theirs_project = create_copy_of_project(base_project.path, "theirs")
128
+ theirs_project = create_copy_of_project(base_project, "theirs")
132
129
 
133
130
  base_project.root_object.project_references.pop
134
131
 
@@ -141,12 +138,11 @@ describe Kintsugi, :apply_change_to_project do
141
138
 
142
139
  it "ignores removal of a product reference that was already removed" do
143
140
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
144
- base_project.save
145
141
 
146
- ours_project = create_copy_of_project(base_project.path, "ours")
142
+ ours_project = create_copy_of_project(base_project, "ours")
147
143
  ours_project.targets[0].product_reference.remove_from_project
148
144
 
149
- theirs_project = create_copy_of_project(base_project.path, "theirs")
145
+ theirs_project = create_copy_of_project(base_project, "theirs")
150
146
  theirs_project.targets[0].product_reference.remove_from_project
151
147
 
152
148
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -161,14 +157,12 @@ describe Kintsugi, :apply_change_to_project do
161
157
 
162
158
  before do
163
159
  base_project.main_group.new_reference(filepath)
164
- base_project.save
165
160
  end
166
161
 
167
162
  it "moves file to another group" do
168
163
  base_project.main_group.find_subpath("new_group", true)
169
- base_project.save
170
164
 
171
- theirs_project = create_copy_of_project(base_project.path, "theirs")
165
+ theirs_project = create_copy_of_project(base_project, "theirs")
172
166
  new_group = theirs_project.main_group.find_subpath("new_group")
173
167
  file_reference = theirs_project.main_group.find_file_by_path(filepath)
174
168
  file_reference.move(new_group)
@@ -182,9 +176,8 @@ describe Kintsugi, :apply_change_to_project do
182
176
 
183
177
  it "raises if trying to move file to another group that no longer exists" do
184
178
  base_project.main_group.find_subpath("new_group", true)
185
- base_project.save
186
179
 
187
- theirs_project = create_copy_of_project(base_project.path, "theirs")
180
+ theirs_project = create_copy_of_project(base_project, "theirs")
188
181
  new_group = theirs_project.main_group.find_subpath("new_group")
189
182
  file_reference = theirs_project.main_group.find_file_by_path(filepath)
190
183
  file_reference.move(new_group)
@@ -200,9 +193,8 @@ describe Kintsugi, :apply_change_to_project do
200
193
 
201
194
  it "raises if trying to add file to a group that no longer exists" do
202
195
  base_project.main_group.find_subpath("new_group", true)
203
- base_project.save
204
196
 
205
- theirs_project = create_copy_of_project(base_project.path, "theirs")
197
+ theirs_project = create_copy_of_project(base_project, "theirs")
206
198
  theirs_project.main_group.find_subpath("new_group").new_reference("foo")
207
199
 
208
200
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -216,17 +208,15 @@ describe Kintsugi, :apply_change_to_project do
216
208
 
217
209
  it "does nothing if trying to remove a file from a group that no longer exists" do
218
210
  base_project.main_group.find_subpath("new_group", true).new_reference("foo")
219
- base_project.save
220
211
 
221
- theirs_project = create_copy_of_project(base_project.path, "theirs")
212
+ theirs_project = create_copy_of_project(base_project, "theirs")
222
213
  theirs_project.main_group.find_subpath("new_group/foo").remove_from_project
223
214
 
224
215
  changes_to_apply = get_diff(theirs_project, base_project)
225
216
 
226
217
  base_project.main_group.find_subpath("new_group").remove_from_project
227
218
 
228
- base_project.save
229
- expected_project = create_copy_of_project(base_project.path, "expected")
219
+ expected_project = create_copy_of_project(base_project, "expected")
230
220
 
231
221
  described_class.apply_change_to_project(base_project, changes_to_apply, theirs_project)
232
222
 
@@ -236,9 +226,8 @@ describe Kintsugi, :apply_change_to_project do
236
226
  it "raises when a file is split into two" do
237
227
  base_project.main_group.find_subpath("new_group", true)
238
228
  base_project.main_group.find_subpath("new_group2", true)
239
- base_project.save
240
229
 
241
- theirs_project = create_copy_of_project(base_project.path, "theirs")
230
+ theirs_project = create_copy_of_project(base_project, "theirs")
242
231
  new_group = theirs_project.main_group.find_subpath("new_group")
243
232
  file_reference = theirs_project.main_group.find_file_by_path(filepath)
244
233
  file_reference.move(new_group)
@@ -252,7 +241,7 @@ describe Kintsugi, :apply_change_to_project do
252
241
  end
253
242
 
254
243
  it "adds file to new group" do
255
- theirs_project = create_copy_of_project(base_project.path, "theirs")
244
+ theirs_project = create_copy_of_project(base_project, "theirs")
256
245
 
257
246
  theirs_project.main_group.find_subpath("new_group", true).new_reference(filepath)
258
247
 
@@ -265,9 +254,8 @@ describe Kintsugi, :apply_change_to_project do
265
254
 
266
255
  it "removes group" do
267
256
  base_project.main_group.find_subpath("new_group", true)
268
- base_project.save
269
257
 
270
- theirs_project = create_copy_of_project(base_project.path, "theirs")
258
+ theirs_project = create_copy_of_project(base_project, "theirs")
271
259
  theirs_project["new_group"].remove_from_project
272
260
 
273
261
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -280,9 +268,8 @@ describe Kintsugi, :apply_change_to_project do
280
268
  it "moves a group with files in it" do
281
269
  new_group = base_project.main_group.find_subpath("new_group", true)
282
270
  new_group.new_reference("new_file")
283
- base_project.save
284
271
 
285
- theirs_project = create_copy_of_project(base_project.path, "theirs")
272
+ theirs_project = create_copy_of_project(base_project, "theirs")
286
273
  new_group2 = theirs_project.main_group.find_subpath("new_group2", true)
287
274
  theirs_project["new_group"].move(new_group2)
288
275
 
@@ -295,9 +282,8 @@ describe Kintsugi, :apply_change_to_project do
295
282
 
296
283
  it "raises when trying to add a group to a group that no longer exists" do
297
284
  base_project.main_group.find_subpath("new_group", true)
298
- base_project.save
299
285
 
300
- theirs_project = create_copy_of_project(base_project.path, "theirs")
286
+ theirs_project = create_copy_of_project(base_project, "theirs")
301
287
  theirs_project["new_group"].find_subpath("sub_group", true)
302
288
 
303
289
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -312,9 +298,8 @@ describe Kintsugi, :apply_change_to_project do
312
298
  it "raises when trying to move a group to a group that no longer exists" do
313
299
  base_project.main_group.find_subpath("new_group", true)
314
300
  base_project.main_group.find_subpath("other_group", true)
315
- base_project.save
316
301
 
317
- theirs_project = create_copy_of_project(base_project.path, "theirs")
302
+ theirs_project = create_copy_of_project(base_project, "theirs")
318
303
  theirs_project["other_group"].move(theirs_project["new_group"])
319
304
 
320
305
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -329,9 +314,8 @@ describe Kintsugi, :apply_change_to_project do
329
314
  it "moves a group with a group in it" do
330
315
  new_group = base_project.main_group.find_subpath("new_group", true)
331
316
  new_group.find_subpath("sub_group", true)
332
- base_project.save
333
317
 
334
- theirs_project = create_copy_of_project(base_project.path, "theirs")
318
+ theirs_project = create_copy_of_project(base_project, "theirs")
335
319
  new_group2 = theirs_project.main_group.find_subpath("new_group2", true)
336
320
  theirs_project["new_group"].move(new_group2)
337
321
 
@@ -346,9 +330,8 @@ describe Kintsugi, :apply_change_to_project do
346
330
  new_group = base_project.main_group.find_subpath("new_group", true)
347
331
  sub_group = new_group.find_subpath("sub_group", true)
348
332
  sub_group.new_reference("new_file")
349
- base_project.save
350
333
 
351
- theirs_project = create_copy_of_project(base_project.path, "theirs")
334
+ theirs_project = create_copy_of_project(base_project, "theirs")
352
335
  new_group2 = theirs_project.main_group.find_subpath("new_group2", true)
353
336
  theirs_project["new_group"].move(new_group2)
354
337
 
@@ -360,7 +343,7 @@ describe Kintsugi, :apply_change_to_project do
360
343
  end
361
344
 
362
345
  it "adds file with include in index and last known file type as nil" do
363
- theirs_project = create_copy_of_project(base_project.path, "theirs")
346
+ theirs_project = create_copy_of_project(base_project, "theirs")
364
347
  file_reference = theirs_project.main_group.new_reference("#{filepath}.h")
365
348
  file_reference.include_in_index = nil
366
349
  file_reference.last_known_file_type = nil
@@ -373,7 +356,7 @@ describe Kintsugi, :apply_change_to_project do
373
356
  end
374
357
 
375
358
  it "renames file" do
376
- theirs_project = create_copy_of_project(base_project.path, "theirs")
359
+ theirs_project = create_copy_of_project(base_project, "theirs")
377
360
  file_reference = theirs_project.main_group.find_file_by_path(filepath)
378
361
  file_reference.path = "newFoo"
379
362
 
@@ -385,7 +368,7 @@ describe Kintsugi, :apply_change_to_project do
385
368
  end
386
369
 
387
370
  it "removes file" do
388
- theirs_project = create_copy_of_project(base_project.path, "theirs")
371
+ theirs_project = create_copy_of_project(base_project, "theirs")
389
372
  theirs_project.main_group.find_file_by_path(filepath).remove_from_project
390
373
 
391
374
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -399,9 +382,8 @@ describe Kintsugi, :apply_change_to_project do
399
382
  target = base_project.new_target("com.apple.product-type.library.static", "bar", :ios)
400
383
  file_reference = base_project.main_group.find_file_by_path(filepath)
401
384
  target.frameworks_build_phase.add_file_reference(file_reference)
402
- base_project.save
403
385
 
404
- theirs_project = create_copy_of_project(base_project.path, "theirs")
386
+ theirs_project = create_copy_of_project(base_project, "theirs")
405
387
  file_reference = theirs_project.main_group.find_file_by_path(filepath)
406
388
  file_reference.include_in_index = "4"
407
389
 
@@ -414,9 +396,8 @@ describe Kintsugi, :apply_change_to_project do
414
396
 
415
397
  it "ignores removal of a non-existent group" do
416
398
  base_project.main_group.find_subpath("new_group", true)
417
- base_project.save
418
399
 
419
- theirs_project = create_copy_of_project(base_project.path, "theirs")
400
+ theirs_project = create_copy_of_project(base_project, "theirs")
420
401
  theirs_project.main_group.children.delete_at(-1)
421
402
 
422
403
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -433,9 +414,8 @@ describe Kintsugi, :apply_change_to_project do
433
414
  target.source_build_phase.add_file_reference(
434
415
  base_project.main_group.find_file_by_path(filepath)
435
416
  )
436
- base_project.save
437
417
 
438
- theirs_project = create_copy_of_project(base_project.path, "theirs")
418
+ theirs_project = create_copy_of_project(base_project, "theirs")
439
419
  file_reference = theirs_project.main_group.find_file_by_path(filepath)
440
420
  file_reference.build_files.each do |build_file|
441
421
  build_file.referrers.each do |referrer|
@@ -452,7 +432,7 @@ describe Kintsugi, :apply_change_to_project do
452
432
  end
453
433
 
454
434
  it "adds file inside a group that has a path on filesystem" do
455
- theirs_project = create_copy_of_project(base_project.path, "theirs")
435
+ theirs_project = create_copy_of_project(base_project, "theirs")
456
436
 
457
437
  new_group = theirs_project.main_group.find_subpath("new_group", true)
458
438
  new_group.path = "some_path"
@@ -467,7 +447,7 @@ describe Kintsugi, :apply_change_to_project do
467
447
  end
468
448
 
469
449
  it "handles subfile changes" do
470
- theirs_project = create_copy_of_project(base_project.path, "theirs")
450
+ theirs_project = create_copy_of_project(base_project, "theirs")
471
451
 
472
452
  theirs_project.main_group.find_file_by_path(filepath).explicit_file_type = "bar"
473
453
  theirs_project.main_group.find_file_by_path(filepath).include_in_index = "0"
@@ -482,9 +462,8 @@ describe Kintsugi, :apply_change_to_project do
482
462
 
483
463
  it "handles moved file to an existing group with a different path on filesystem" do
484
464
  base_project.main_group.find_subpath("new_group", true).path = "some_path"
485
- base_project.save
486
465
 
487
- theirs_project = create_copy_of_project(base_project.path, "theirs")
466
+ theirs_project = create_copy_of_project(base_project, "theirs")
488
467
  new_group = theirs_project.main_group.find_subpath("new_group")
489
468
  theirs_project.main_group.find_file_by_path(filepath).move(new_group)
490
469
 
@@ -497,12 +476,11 @@ describe Kintsugi, :apply_change_to_project do
497
476
 
498
477
  describe "dealing with unexpected change" do
499
478
  it "raises if applying change to a file whose containing group doesn't exist" do
500
- ours_project = create_copy_of_project(base_project.path, "ours")
479
+ ours_project = create_copy_of_project(base_project, "ours")
501
480
  new_group = ours_project.main_group.find_subpath("new_group", true)
502
481
  ours_project.main_group.find_file_by_path(filepath).move(new_group)
503
- ours_project.save
504
482
 
505
- theirs_project = create_copy_of_project(base_project.path, "theirs")
483
+ theirs_project = create_copy_of_project(base_project, "theirs")
506
484
  theirs_project.main_group.find_file_by_path(filepath).explicit_file_type = "bar"
507
485
 
508
486
  ours_project.main_group.find_subpath("new_group").remove_from_project
@@ -515,11 +493,10 @@ describe Kintsugi, :apply_change_to_project do
515
493
  end
516
494
 
517
495
  it "raises if applying change to a file that doesn't exist" do
518
- ours_project = create_copy_of_project(base_project.path, "ours")
496
+ ours_project = create_copy_of_project(base_project, "ours")
519
497
  ours_project.main_group.find_file_by_path(filepath).remove_from_project
520
- ours_project.save
521
498
 
522
- theirs_project = create_copy_of_project(base_project.path, "theirs")
499
+ theirs_project = create_copy_of_project(base_project, "theirs")
523
500
  theirs_project.main_group.find_file_by_path(filepath).explicit_file_type = "bar"
524
501
 
525
502
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -530,16 +507,15 @@ describe Kintsugi, :apply_change_to_project do
530
507
  end
531
508
 
532
509
  it "ignores removal of a file whose group doesn't exist" do
533
- ours_project = create_copy_of_project(base_project.path, "ours")
510
+ ours_project = create_copy_of_project(base_project, "ours")
534
511
  ours_project.main_group.remove_from_project
535
- ours_project.save
536
512
 
537
- theirs_project = create_copy_of_project(base_project.path, "theirs")
513
+ theirs_project = create_copy_of_project(base_project, "theirs")
538
514
  theirs_project.main_group.find_file_by_path(filepath).remove_from_project
539
515
 
540
516
  changes_to_apply = get_diff(theirs_project, base_project)
541
517
 
542
- ours_project_before_applying_changes = create_copy_of_project(ours_project.path, "ours")
518
+ ours_project_before_applying_changes = create_copy_of_project(ours_project, "ours")
543
519
 
544
520
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
545
521
 
@@ -547,10 +523,10 @@ describe Kintsugi, :apply_change_to_project do
547
523
  end
548
524
 
549
525
  it "ignores removal of non-existent file" do
550
- ours_project = create_copy_of_project(base_project.path, "ours")
526
+ ours_project = create_copy_of_project(base_project, "ours")
551
527
  ours_project.main_group.find_file_by_path(filepath).remove_from_project
552
528
 
553
- theirs_project = create_copy_of_project(base_project.path, "theirs")
529
+ theirs_project = create_copy_of_project(base_project, "theirs")
554
530
  theirs_project.main_group.find_file_by_path(filepath).remove_from_project
555
531
 
556
532
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -565,16 +541,11 @@ describe Kintsugi, :apply_change_to_project do
565
541
  describe "target related changes" do
566
542
  let!(:target) { base_project.new_target("com.apple.product-type.library.static", "foo", :ios) }
567
543
 
568
- before do
569
- base_project.save
570
- end
571
-
572
544
  it "moves file that is referenced by a target from main group to a new group" do
573
545
  file_reference = base_project.main_group.new_reference("bar")
574
546
  base_project.targets[0].source_build_phase.add_file_reference(file_reference)
575
- base_project.save
576
547
 
577
- theirs_project = create_copy_of_project(base_project.path, "theirs")
548
+ theirs_project = create_copy_of_project(base_project, "theirs")
578
549
  new_group = theirs_project.main_group.find_subpath("new_group", true)
579
550
  file_reference = theirs_project.main_group.find_file_by_path("bar")
580
551
  file_reference.move(new_group)
@@ -591,9 +562,8 @@ describe Kintsugi, :apply_change_to_project do
591
562
 
592
563
  base_project.new_target("com.apple.product-type.library.static", "bar", :ios)
593
564
  base_project.main_group.find_subpath("new_group", true).new_reference("file1.swift")
594
- base_project.save
595
565
 
596
- theirs_project = create_copy_of_project(base_project.path, "theirs")
566
+ theirs_project = create_copy_of_project(base_project, "theirs")
597
567
  second_target = theirs_project.targets[1]
598
568
  second_file_reference = theirs_project.main_group.find_subpath("new_group/file1.swift")
599
569
  second_target.source_build_phase.add_file_reference(second_file_reference)
@@ -608,9 +578,8 @@ describe Kintsugi, :apply_change_to_project do
608
578
  it "moves file that is referenced by a target from a group to the main group" do
609
579
  file_reference = base_project.main_group.find_subpath("new_group", true).new_reference("bar")
610
580
  base_project.targets[0].source_build_phase.add_file_reference(file_reference)
611
- base_project.save
612
581
 
613
- theirs_project = create_copy_of_project(base_project.path, "theirs")
582
+ theirs_project = create_copy_of_project(base_project, "theirs")
614
583
  file_reference = theirs_project["new_group/bar"]
615
584
  file_reference.move(theirs_project.main_group)
616
585
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -623,9 +592,8 @@ describe Kintsugi, :apply_change_to_project do
623
592
  it "moves file that is referenced by a target and has a different file encoding" do
624
593
  file_reference = base_project.main_group.find_subpath("new_group", true).new_reference("bar")
625
594
  target.frameworks_build_phase.add_file_reference(file_reference)
626
- base_project.save
627
595
 
628
- theirs_project = create_copy_of_project(base_project.path, "theirs")
596
+ theirs_project = create_copy_of_project(base_project, "theirs")
629
597
  file_reference = theirs_project["new_group/bar"]
630
598
  file_reference.move(theirs_project.main_group)
631
599
  file_reference.fileEncoding = "4"
@@ -648,9 +616,8 @@ describe Kintsugi, :apply_change_to_project do
648
616
  # Removes the container item proxy to make sure the display name of the reference proxy is the
649
617
  # same as the file reference.
650
618
  base_project.root_object.project_references[-1][:product_group].children[0].remote_ref.remove_from_project
651
- base_project.save
652
619
 
653
- theirs_project = create_copy_of_project(base_project.path, "theirs")
620
+ theirs_project = create_copy_of_project(base_project, "theirs")
654
621
 
655
622
  build_phase = theirs_project.targets[0].frameworks_build_phase
656
623
  build_phase.files.find { |build_file| build_file.display_name == "baz" }.remove_from_project
@@ -666,7 +633,7 @@ describe Kintsugi, :apply_change_to_project do
666
633
  end
667
634
 
668
635
  it "adds package product dependency to target" do
669
- theirs_project = create_copy_of_project(base_project.path, "theirs")
636
+ theirs_project = create_copy_of_project(base_project, "theirs")
670
637
  theirs_project.targets[0].package_product_dependencies <<
671
638
  create_swift_package_product_dependency(theirs_project)
672
639
 
@@ -688,9 +655,8 @@ describe Kintsugi, :apply_change_to_project do
688
655
  subproject_reference_proxy.remote_ref.remove_from_project
689
656
  base_project.targets[0].frameworks_build_phase.add_file_reference(subproject_reference_proxy)
690
657
 
691
- base_project.save
692
658
 
693
- theirs_project = create_copy_of_project(base_project.path, "theirs")
659
+ theirs_project = create_copy_of_project(base_project, "theirs")
694
660
 
695
661
  file_reference = theirs_project.main_group.new_reference("bar")
696
662
  file_reference.name = framework_filename
@@ -719,9 +685,8 @@ describe Kintsugi, :apply_change_to_project do
719
685
  container_proxy = build_file.file_ref.remote_ref
720
686
  build_file.file_ref.remote_ref = nil
721
687
 
722
- base_project.save
723
688
 
724
- theirs_project = create_copy_of_project(base_project.path, "theirs")
689
+ theirs_project = create_copy_of_project(base_project, "theirs")
725
690
 
726
691
  theirs_project.targets[0].frameworks_build_phase.files[-1].file_ref.remote_ref =
727
692
  container_proxy
@@ -736,9 +701,8 @@ describe Kintsugi, :apply_change_to_project do
736
701
  it "adds subproject target and adds reference to it" do
737
702
  framework_filename = "baz"
738
703
  subproject = add_new_subproject_to_project(base_project, "subproj", framework_filename)
739
- base_project.save
740
704
 
741
- theirs_project = create_copy_of_project(base_project.path, "theirs")
705
+ theirs_project = create_copy_of_project(base_project, "theirs")
742
706
 
743
707
  subproject.new_target("com.apple.product-type.library.static", "bari", :ios)
744
708
 
@@ -761,9 +725,8 @@ describe Kintsugi, :apply_change_to_project do
761
725
 
762
726
  it "adds new build file" do
763
727
  base_project.main_group.new_reference("bar")
764
- base_project.save
765
728
 
766
- theirs_project = create_copy_of_project(base_project.path, "theirs")
729
+ theirs_project = create_copy_of_project(base_project, "theirs")
767
730
 
768
731
  file_reference = theirs_project.main_group.files.find { |file| file.display_name == "bar" }
769
732
  theirs_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
@@ -778,14 +741,13 @@ describe Kintsugi, :apply_change_to_project do
778
741
  it "adds build when there is a build file without file ref" do
779
742
  target = base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
780
743
  target.frameworks_build_phase.add_file_reference(nil)
781
- base_project.save
782
744
 
783
- theirs_project = create_copy_of_project(base_project.path, "theirs")
745
+ theirs_project = create_copy_of_project(base_project, "theirs")
784
746
  file_reference = theirs_project.main_group.new_reference("bar")
785
747
  theirs_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
786
748
 
787
749
  changes_to_apply = get_diff(theirs_project, base_project)
788
- other_project = create_copy_of_project(base_project.path, "theirs")
750
+ other_project = create_copy_of_project(base_project, "theirs")
789
751
  described_class.apply_change_to_project(other_project, changes_to_apply, theirs_project)
790
752
 
791
753
  expect(other_project).to be_equivalent_to_project(theirs_project)
@@ -793,9 +755,8 @@ describe Kintsugi, :apply_change_to_project do
793
755
 
794
756
  it "adds product ref to build file" do
795
757
  base_project.main_group.new_reference("bar")
796
- base_project.save
797
758
 
798
- theirs_project = create_copy_of_project(base_project.path, "theirs")
759
+ theirs_project = create_copy_of_project(base_project, "theirs")
799
760
 
800
761
  file_reference = theirs_project.main_group.files.find { |file| file.display_name == "bar" }
801
762
  build_file =
@@ -813,9 +774,8 @@ describe Kintsugi, :apply_change_to_project do
813
774
  it "adds build file to a file reference that already exists" do
814
775
  base_project.main_group.new_reference("bar")
815
776
  base_project.main_group.new_reference("bar")
816
- base_project.save
817
777
 
818
- theirs_project = create_copy_of_project(base_project.path, "theirs")
778
+ theirs_project = create_copy_of_project(base_project, "theirs")
819
779
 
820
780
  theirs_file_reference = theirs_project.main_group.files.find do |file|
821
781
  !file.referrers.find { |referrer| referrer.is_a?(Xcodeproj::Project::PBXBuildFile) } &&
@@ -834,9 +794,8 @@ describe Kintsugi, :apply_change_to_project do
834
794
  file_reference = base_project.main_group.new_reference("bar")
835
795
  build_file = base_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
836
796
  build_file.file_ref = nil
837
- base_project.save
838
797
 
839
- theirs_project = create_copy_of_project(base_project.path, "theirs")
798
+ theirs_project = create_copy_of_project(base_project, "theirs")
840
799
 
841
800
  file_reference = theirs_project.main_group.files.find { |file| file.display_name == "bar" }
842
801
  theirs_project.targets[0].frameworks_build_phase.files[-1].file_ref = file_reference
@@ -850,9 +809,8 @@ describe Kintsugi, :apply_change_to_project do
850
809
 
851
810
  it "ignores build file without file reference" do
852
811
  base_project.main_group.new_reference("bar")
853
- base_project.save
854
812
 
855
- theirs_project = create_copy_of_project(base_project.path, "theirs")
813
+ theirs_project = create_copy_of_project(base_project, "theirs")
856
814
  file_reference = theirs_project.main_group.files.find { |file| file.display_name == "bar" }
857
815
  build_file =
858
816
  theirs_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
@@ -860,14 +818,14 @@ describe Kintsugi, :apply_change_to_project do
860
818
 
861
819
  changes_to_apply = get_diff(theirs_project, base_project)
862
820
 
863
- other_project = create_copy_of_project(base_project.path, "other")
821
+ other_project = create_copy_of_project(base_project, "other")
864
822
  described_class.apply_change_to_project(other_project, changes_to_apply, theirs_project)
865
823
 
866
824
  expect(other_project).to be_equivalent_to_project(base_project)
867
825
  end
868
826
 
869
827
  it "adds new build rule" do
870
- theirs_project = create_copy_of_project(base_project.path, "theirs")
828
+ theirs_project = create_copy_of_project(base_project, "theirs")
871
829
 
872
830
  build_rule = theirs_project.new(Xcodeproj::Project::PBXBuildRule)
873
831
  build_rule.compiler_spec = "com.apple.compilers.proxy.script"
@@ -893,7 +851,7 @@ describe Kintsugi, :apply_change_to_project do
893
851
 
894
852
  describe "build settings" do
895
853
  it "adds new string build setting" do
896
- theirs_project = create_copy_of_project(base_project.path, "theirs")
854
+ theirs_project = create_copy_of_project(base_project, "theirs")
897
855
 
898
856
  theirs_project.targets[0].build_configurations.each do |configuration|
899
857
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "$(SRCROOT)/../Bar"
@@ -910,7 +868,7 @@ describe Kintsugi, :apply_change_to_project do
910
868
  base_project.targets[0].build_configurations.each do |configuration|
911
869
  configuration.build_settings = {}
912
870
  end
913
- theirs_project = create_copy_of_project(base_project.path, "theirs")
871
+ theirs_project = create_copy_of_project(base_project, "theirs")
914
872
 
915
873
  theirs_project.targets[0].build_configurations.each do |configuration|
916
874
  configuration.build_settings["HEADER_SEARCH_PATHS"] = [
@@ -927,7 +885,7 @@ describe Kintsugi, :apply_change_to_project do
927
885
  end
928
886
 
929
887
  it "adds new hash build setting" do
930
- theirs_project = create_copy_of_project(base_project.path, "theirs")
888
+ theirs_project = create_copy_of_project(base_project, "theirs")
931
889
 
932
890
  theirs_project.targets[0].build_configurations.each do |configuration|
933
891
  configuration.build_settings["HEADER_SEARCH_PATHS"] = [
@@ -950,7 +908,7 @@ describe Kintsugi, :apply_change_to_project do
950
908
  ]
951
909
  end
952
910
 
953
- theirs_project = create_copy_of_project(base_project.path, "theirs")
911
+ theirs_project = create_copy_of_project(base_project, "theirs")
954
912
 
955
913
  theirs_project.targets[0].build_configurations.each do |configuration|
956
914
  configuration.build_settings["HEADER_SEARCH_PATHS"] = [
@@ -967,21 +925,21 @@ describe Kintsugi, :apply_change_to_project do
967
925
  end
968
926
 
969
927
  it "adds array value to an existing string if no removed value" do
970
- theirs_project = create_copy_of_project(base_project.path, "theirs")
928
+ theirs_project = create_copy_of_project(base_project, "theirs")
971
929
 
972
930
  theirs_project.targets[0].build_configurations.each do |configuration|
973
931
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo]
974
932
  end
975
933
  changes_to_apply = get_diff(theirs_project, base_project)
976
934
 
977
- ours_project = create_copy_of_project(base_project.path, "ours")
935
+ ours_project = create_copy_of_project(base_project, "ours")
978
936
  ours_project.targets[0].build_configurations.each do |configuration|
979
937
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
980
938
  end
981
939
 
982
940
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
983
941
 
984
- expected_project = create_copy_of_project(base_project.path, "expected")
942
+ expected_project = create_copy_of_project(base_project, "expected")
985
943
  expected_project.targets[0].build_configurations.each do |configuration|
986
944
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo baz]
987
945
  end
@@ -989,21 +947,21 @@ describe Kintsugi, :apply_change_to_project do
989
947
  end
990
948
 
991
949
  it "adds string value to existing array value if no removed value" do
992
- theirs_project = create_copy_of_project(base_project.path, "theirs")
950
+ theirs_project = create_copy_of_project(base_project, "theirs")
993
951
 
994
952
  theirs_project.targets[0].build_configurations.each do |configuration|
995
953
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
996
954
  end
997
955
  changes_to_apply = get_diff(theirs_project, base_project)
998
956
 
999
- ours_project = create_copy_of_project(base_project.path, "ours")
957
+ ours_project = create_copy_of_project(base_project, "ours")
1000
958
  ours_project.targets[0].build_configurations.each do |configuration|
1001
959
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo]
1002
960
  end
1003
961
 
1004
962
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
1005
963
 
1006
- expected_project = create_copy_of_project(base_project.path, "expected")
964
+ expected_project = create_copy_of_project(base_project, "expected")
1007
965
  expected_project.targets[0].build_configurations.each do |configuration|
1008
966
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo baz]
1009
967
  end
@@ -1017,9 +975,8 @@ describe Kintsugi, :apply_change_to_project do
1017
975
  "$(SRCROOT)/../Bar"
1018
976
  ]
1019
977
  end
1020
- base_project.save
1021
978
 
1022
- theirs_project = create_copy_of_project(base_project.path, "theirs")
979
+ theirs_project = create_copy_of_project(base_project, "theirs")
1023
980
  theirs_project.targets[0].build_configurations.each do |configuration|
1024
981
  configuration.build_settings["HEADER_SEARCH_PATHS"] = nil
1025
982
  end
@@ -1035,9 +992,8 @@ describe Kintsugi, :apply_change_to_project do
1035
992
  base_project.targets[0].build_configurations.each do |configuration|
1036
993
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1037
994
  end
1038
- base_project.save
1039
995
 
1040
- theirs_project = create_copy_of_project(base_project.path, "theirs")
996
+ theirs_project = create_copy_of_project(base_project, "theirs")
1041
997
  theirs_project.targets[0].build_configurations.each do |configuration|
1042
998
  configuration.build_settings =
1043
999
  configuration.build_settings.reject { |key, _| key == "HEADER_SEARCH_PATHS" }
@@ -1054,9 +1010,8 @@ describe Kintsugi, :apply_change_to_project do
1054
1010
  base_project.targets[0].build_configurations.each do |configuration|
1055
1011
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1056
1012
  end
1057
- base_project.save
1058
1013
 
1059
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1014
+ theirs_project = create_copy_of_project(base_project, "theirs")
1060
1015
  theirs_project.targets[0].build_configurations.each do |configuration|
1061
1016
  configuration.build_settings = nil
1062
1017
  end
@@ -1073,14 +1028,13 @@ describe Kintsugi, :apply_change_to_project do
1073
1028
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1074
1029
  configuration.build_settings["foo"] = "baz"
1075
1030
  end
1076
- base_project.save
1077
1031
 
1078
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1032
+ theirs_project = create_copy_of_project(base_project, "theirs")
1079
1033
  theirs_project.targets[0].build_configurations.each do |configuration|
1080
1034
  configuration.build_settings = nil
1081
1035
  end
1082
1036
 
1083
- ours_project = create_copy_of_project(base_project.path, "theirs")
1037
+ ours_project = create_copy_of_project(base_project, "theirs")
1084
1038
  ours_project.targets[0].build_configurations.each do |configuration|
1085
1039
  configuration.build_settings["foo"] = nil
1086
1040
  end
@@ -1093,14 +1047,13 @@ describe Kintsugi, :apply_change_to_project do
1093
1047
  end
1094
1048
 
1095
1049
  it "removes value if existing is string and removed is array that contains it" do
1096
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1050
+ theirs_project = create_copy_of_project(base_project, "theirs")
1097
1051
 
1098
1052
  base_project.targets[0].build_configurations.each do |configuration|
1099
1053
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1100
1054
  end
1101
- base_project.save
1102
1055
 
1103
- before_theirs_project = create_copy_of_project(base_project.path, "before_theirs")
1056
+ before_theirs_project = create_copy_of_project(base_project, "before_theirs")
1104
1057
  before_theirs_project.targets[0].build_configurations.each do |configuration|
1105
1058
  configuration.build_settings["HEADER_SEARCH_PATHS"] = ["bar"]
1106
1059
  end
@@ -1113,14 +1066,13 @@ describe Kintsugi, :apply_change_to_project do
1113
1066
  end
1114
1067
 
1115
1068
  it "removes value if removed value is string and existing is array that contains it" do
1116
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1069
+ theirs_project = create_copy_of_project(base_project, "theirs")
1117
1070
 
1118
1071
  base_project.targets[0].build_configurations.each do |configuration|
1119
1072
  configuration.build_settings["HEADER_SEARCH_PATHS"] = ["bar"]
1120
1073
  end
1121
- base_project.save
1122
1074
 
1123
- before_theirs_project = create_copy_of_project(base_project.path, "before_theirs")
1075
+ before_theirs_project = create_copy_of_project(base_project, "before_theirs")
1124
1076
  before_theirs_project.targets[0].build_configurations.each do |configuration|
1125
1077
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1126
1078
  end
@@ -1134,14 +1086,13 @@ describe Kintsugi, :apply_change_to_project do
1134
1086
 
1135
1087
  it "removes value if existing is string and removed is array that contains it among other " \
1136
1088
  "values" do
1137
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1089
+ theirs_project = create_copy_of_project(base_project, "theirs")
1138
1090
 
1139
1091
  base_project.targets[0].build_configurations.each do |configuration|
1140
1092
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1141
1093
  end
1142
- base_project.save
1143
1094
 
1144
- before_theirs_project = create_copy_of_project(base_project.path, "before_theirs")
1095
+ before_theirs_project = create_copy_of_project(base_project, "before_theirs")
1145
1096
  before_theirs_project.targets[0].build_configurations.each do |configuration|
1146
1097
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar baz]
1147
1098
  end
@@ -1149,9 +1100,8 @@ describe Kintsugi, :apply_change_to_project do
1149
1100
  changes_to_apply = get_diff(theirs_project, before_theirs_project)
1150
1101
 
1151
1102
  described_class.apply_change_to_project(base_project, changes_to_apply, theirs_project)
1152
- base_project.save
1153
1103
 
1154
- expected_project = create_copy_of_project(base_project.path, "expected")
1104
+ expected_project = create_copy_of_project(base_project, "expected")
1155
1105
  expected_project.targets[0].build_configurations.each do |configuration|
1156
1106
  configuration.build_settings["HEADER_SEARCH_PATHS"] = nil
1157
1107
  end
@@ -1160,14 +1110,13 @@ describe Kintsugi, :apply_change_to_project do
1160
1110
 
1161
1111
  it "changes to a single string value if removed is string and existing is array that " \
1162
1112
  "contains it among another value" do
1163
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1113
+ theirs_project = create_copy_of_project(base_project, "theirs")
1164
1114
 
1165
1115
  base_project.targets[0].build_configurations.each do |configuration|
1166
1116
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar baz]
1167
1117
  end
1168
- base_project.save
1169
1118
 
1170
- before_theirs_project = create_copy_of_project(base_project.path, "before_theirs")
1119
+ before_theirs_project = create_copy_of_project(base_project, "before_theirs")
1171
1120
  before_theirs_project.targets[0].build_configurations.each do |configuration|
1172
1121
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1173
1122
  end
@@ -1175,9 +1124,8 @@ describe Kintsugi, :apply_change_to_project do
1175
1124
  changes_to_apply = get_diff(theirs_project, before_theirs_project)
1176
1125
 
1177
1126
  described_class.apply_change_to_project(base_project, changes_to_apply, theirs_project)
1178
- base_project.save
1179
1127
 
1180
- expected_project = create_copy_of_project(base_project.path, "expected")
1128
+ expected_project = create_copy_of_project(base_project, "expected")
1181
1129
  expected_project.targets[0].build_configurations.each do |configuration|
1182
1130
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
1183
1131
  end
@@ -1188,9 +1136,8 @@ describe Kintsugi, :apply_change_to_project do
1188
1136
  base_project.targets[0].build_configurations.each do |configuration|
1189
1137
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo]
1190
1138
  end
1191
- base_project.save
1192
1139
 
1193
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1140
+ theirs_project = create_copy_of_project(base_project, "theirs")
1194
1141
  theirs_project.targets[0].build_configurations.each do |configuration|
1195
1142
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
1196
1143
  end
@@ -1206,9 +1153,8 @@ describe Kintsugi, :apply_change_to_project do
1206
1153
  base_project.targets[0].build_configurations.each do |configuration|
1207
1154
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1208
1155
  end
1209
- base_project.save
1210
1156
 
1211
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1157
+ theirs_project = create_copy_of_project(base_project, "theirs")
1212
1158
  theirs_project.targets[0].build_configurations.each do |configuration|
1213
1159
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[baz foo]
1214
1160
  end
@@ -1222,19 +1168,18 @@ describe Kintsugi, :apply_change_to_project do
1222
1168
 
1223
1169
  it "changes to array if added value is string and existing is another string and removal is" \
1224
1170
  "nil for an array build setting" do
1225
- before_theirs_project = create_copy_of_project(base_project.path, "theirs")
1171
+ before_theirs_project = create_copy_of_project(base_project, "theirs")
1226
1172
 
1227
1173
  base_project.targets[0].build_configurations.each do |configuration|
1228
1174
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1229
1175
  end
1230
- base_project.save
1231
1176
 
1232
- theirs_project = create_copy_of_project(base_project.path, "before_theirs")
1177
+ theirs_project = create_copy_of_project(base_project, "before_theirs")
1233
1178
  theirs_project.targets[0].build_configurations.each do |configuration|
1234
1179
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
1235
1180
  end
1236
1181
 
1237
- expected_project = create_copy_of_project(base_project.path, "expected")
1182
+ expected_project = create_copy_of_project(base_project, "expected")
1238
1183
  expected_project.targets[0].build_configurations.each do |configuration|
1239
1184
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar baz]
1240
1185
  end
@@ -1248,14 +1193,13 @@ describe Kintsugi, :apply_change_to_project do
1248
1193
 
1249
1194
  it "raises if added value is string and existing is another string and removal is nil for a " \
1250
1195
  "string build setting" do
1251
- before_theirs_project = create_copy_of_project(base_project.path, "theirs")
1196
+ before_theirs_project = create_copy_of_project(base_project, "theirs")
1252
1197
 
1253
1198
  base_project.targets[0].build_configurations.each do |configuration|
1254
1199
  configuration.build_settings["PRODUCT_NAME"] = "bar"
1255
1200
  end
1256
- base_project.save
1257
1201
 
1258
- theirs_project = create_copy_of_project(base_project.path, "before_theirs")
1202
+ theirs_project = create_copy_of_project(base_project, "before_theirs")
1259
1203
  theirs_project.targets[0].build_configurations.each do |configuration|
1260
1204
  configuration.build_settings["PRODUCT_NAME"] = "baz"
1261
1205
  end
@@ -1272,14 +1216,12 @@ describe Kintsugi, :apply_change_to_project do
1272
1216
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1273
1217
  end
1274
1218
 
1275
- base_project.save
1276
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1219
+ theirs_project = create_copy_of_project(base_project, "theirs")
1277
1220
  theirs_project.targets[0].build_configurations.each do |configuration|
1278
1221
  configuration.build_settings = nil
1279
1222
  end
1280
1223
 
1281
- base_project.save
1282
- before_theirs_project = create_copy_of_project(base_project.path, "theirs")
1224
+ before_theirs_project = create_copy_of_project(base_project, "theirs")
1283
1225
  before_theirs_project.targets[0].build_configurations.each do |configuration|
1284
1226
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
1285
1227
  end
@@ -1293,7 +1235,7 @@ describe Kintsugi, :apply_change_to_project do
1293
1235
  end
1294
1236
 
1295
1237
  it "adds build phases" do
1296
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1238
+ theirs_project = create_copy_of_project(base_project, "theirs")
1297
1239
 
1298
1240
  theirs_project.targets[0].new_shell_script_build_phase("bar")
1299
1241
  theirs_project.targets[0].source_build_phase
@@ -1310,7 +1252,7 @@ describe Kintsugi, :apply_change_to_project do
1310
1252
  end
1311
1253
 
1312
1254
  it "adds build phase with a simple attribute value that has non nil default" do
1313
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1255
+ theirs_project = create_copy_of_project(base_project, "theirs")
1314
1256
  theirs_project.targets[0].new_shell_script_build_phase("bar")
1315
1257
  theirs_project.targets[0].build_phases.last.shell_script = "Other value"
1316
1258
 
@@ -1323,9 +1265,8 @@ describe Kintsugi, :apply_change_to_project do
1323
1265
 
1324
1266
  it "removes build phase" do
1325
1267
  base_project.targets[0].new_shell_script_build_phase("bar")
1326
- base_project.save
1327
1268
 
1328
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1269
+ theirs_project = create_copy_of_project(base_project, "theirs")
1329
1270
  theirs_project.targets[0].shell_script_build_phases[0].remove_from_project
1330
1271
 
1331
1272
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1340,9 +1281,8 @@ describe Kintsugi, :apply_change_to_project do
1340
1281
  file = variant_group.new_reference("Base")
1341
1282
  file.last_known_file_type = "text.plist.strings"
1342
1283
  target.resources_build_phase.add_file_reference(variant_group)
1343
- base_project.save
1344
1284
 
1345
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1285
+ theirs_project = create_copy_of_project(base_project, "theirs")
1346
1286
  theirs_variant_group = theirs_project.main_group.find_subpath("foo.strings")
1347
1287
  theirs_variant_group.new_reference("en")
1348
1288
 
@@ -1355,9 +1295,8 @@ describe Kintsugi, :apply_change_to_project do
1355
1295
 
1356
1296
  it "adds target dependency" do
1357
1297
  base_project.new_target("com.apple.product-type.library.static", "bar", :ios)
1358
- base_project.save
1359
1298
 
1360
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1299
+ theirs_project = create_copy_of_project(base_project, "theirs")
1361
1300
  theirs_project.targets[1].add_dependency(theirs_project.targets[0])
1362
1301
 
1363
1302
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1371,9 +1310,8 @@ describe Kintsugi, :apply_change_to_project do
1371
1310
  base_project.targets[0].build_configurations.each do |configuration|
1372
1311
  configuration.build_settings["GCC_PREFIX_HEADER"] = "foo"
1373
1312
  end
1374
- base_project.save
1375
1313
 
1376
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1314
+ theirs_project = create_copy_of_project(base_project, "theirs")
1377
1315
  theirs_project.targets[0].build_configurations.each do |configuration|
1378
1316
  configuration.build_settings["GCC_PREFIX_HEADER"] = "bar"
1379
1317
  end
@@ -1386,7 +1324,7 @@ describe Kintsugi, :apply_change_to_project do
1386
1324
  end
1387
1325
 
1388
1326
  it "adds build settings to new target" do
1389
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1327
+ theirs_project = create_copy_of_project(base_project, "theirs")
1390
1328
  theirs_project.new_target("com.apple.product-type.library.static", "bar", :ios)
1391
1329
  theirs_project.targets[1].build_configurations.each do |configuration|
1392
1330
  configuration.build_settings["GCC_PREFIX_HEADER"] = "baz"
@@ -1399,10 +1337,10 @@ describe Kintsugi, :apply_change_to_project do
1399
1337
  expect(base_project).to be_equivalent_to_project(theirs_project)
1400
1338
  end
1401
1339
 
1402
- it "adds base configuration reference to new target" do
1340
+ it "adds base configuration reference" do
1403
1341
  base_project.main_group.new_reference("baz")
1404
1342
 
1405
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1343
+ theirs_project = create_copy_of_project(base_project, "theirs")
1406
1344
  configuration_reference = theirs_project.main_group.find_subpath("baz")
1407
1345
  theirs_project.targets[0].build_configurations.each do |configuration|
1408
1346
  configuration.base_configuration_reference = configuration_reference
@@ -1414,10 +1352,31 @@ describe Kintsugi, :apply_change_to_project do
1414
1352
 
1415
1353
  expect(base_project).to be_equivalent_to_project(theirs_project)
1416
1354
  end
1355
+
1356
+ it "adds base configuration reference to new configuration in a new list" do
1357
+ base_project.main_group.new_reference("baz")
1358
+ base_project.targets[0].build_configuration_list = nil
1359
+
1360
+ theirs_project = create_copy_of_project(base_project, "theirs")
1361
+ configuration_reference = theirs_project.main_group.find_subpath("baz")
1362
+
1363
+ configuration_list = theirs_project.new(Xcodeproj::Project::XCConfigurationList)
1364
+ theirs_project.targets[0].build_configuration_list = configuration_list
1365
+
1366
+ build_configuration = theirs_project.new(Xcodeproj::Project::XCBuildConfiguration)
1367
+ build_configuration.base_configuration_reference = configuration_reference
1368
+ configuration_list.build_configurations << build_configuration
1369
+
1370
+ changes_to_apply = get_diff(theirs_project, base_project)
1371
+
1372
+ described_class.apply_change_to_project(base_project, changes_to_apply, theirs_project)
1373
+
1374
+ expect(base_project).to be_equivalent_to_project(theirs_project)
1375
+ end
1417
1376
  end
1418
1377
 
1419
1378
  it "adds known regions" do
1420
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1379
+ theirs_project = create_copy_of_project(base_project, "theirs")
1421
1380
  theirs_project.root_object.known_regions += ["fr"]
1422
1381
 
1423
1382
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1428,7 +1387,7 @@ describe Kintsugi, :apply_change_to_project do
1428
1387
  end
1429
1388
 
1430
1389
  it "removes known regions" do
1431
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1390
+ theirs_project = create_copy_of_project(base_project, "theirs")
1432
1391
  theirs_project.root_object.known_regions = nil
1433
1392
 
1434
1393
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1439,7 +1398,7 @@ describe Kintsugi, :apply_change_to_project do
1439
1398
  end
1440
1399
 
1441
1400
  it "adds attribute target changes even if target attributes don't exist" do
1442
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1401
+ theirs_project = create_copy_of_project(base_project, "theirs")
1443
1402
 
1444
1403
  theirs_project.root_object.attributes["TargetAttributes"] =
1445
1404
  {"foo" => {"LastSwiftMigration" => "1140"}}
@@ -1453,9 +1412,8 @@ describe Kintsugi, :apply_change_to_project do
1453
1412
 
1454
1413
  it "adds attribute target changes of new target" do
1455
1414
  base_project.root_object.attributes["TargetAttributes"] = {}
1456
- base_project.save
1457
1415
 
1458
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1416
+ theirs_project = create_copy_of_project(base_project, "theirs")
1459
1417
  theirs_project.root_object.attributes["TargetAttributes"] =
1460
1418
  {"foo" => {"LastSwiftMigration" => "1140"}}
1461
1419
 
@@ -1468,9 +1426,8 @@ describe Kintsugi, :apply_change_to_project do
1468
1426
 
1469
1427
  it "adds attribute target changes of existing target" do
1470
1428
  base_project.root_object.attributes["TargetAttributes"] = {"foo" => {}}
1471
- base_project.save
1472
1429
 
1473
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1430
+ theirs_project = create_copy_of_project(base_project, "theirs")
1474
1431
  theirs_project.root_object.attributes["TargetAttributes"] =
1475
1432
  {"foo" => {"LastSwiftMigration" => "1140"}}
1476
1433
 
@@ -1484,9 +1441,8 @@ describe Kintsugi, :apply_change_to_project do
1484
1441
  it "removes attribute target changes" do
1485
1442
  base_project.root_object.attributes["TargetAttributes"] =
1486
1443
  {"foo" => {"LastSwiftMigration" => "1140"}}
1487
- base_project.save
1488
1444
 
1489
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1445
+ theirs_project = create_copy_of_project(base_project, "theirs")
1490
1446
  theirs_project.root_object.attributes["TargetAttributes"]["foo"] = {}
1491
1447
 
1492
1448
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1499,12 +1455,11 @@ describe Kintsugi, :apply_change_to_project do
1499
1455
  it "removes attribute target changes from a project it was removed from already" do
1500
1456
  base_project.root_object.attributes["TargetAttributes"] =
1501
1457
  {"foo" => {"LastSwiftMigration" => "1140"}}
1502
- base_project.save
1503
1458
 
1504
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1459
+ theirs_project = create_copy_of_project(base_project, "theirs")
1505
1460
  theirs_project.root_object.attributes["TargetAttributes"]["foo"] = {}
1506
1461
 
1507
- ours_project = create_copy_of_project(base_project.path, "ours")
1462
+ ours_project = create_copy_of_project(base_project, "ours")
1508
1463
  ours_project.root_object.attributes["TargetAttributes"]["foo"] = {}
1509
1464
 
1510
1465
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1516,12 +1471,11 @@ describe Kintsugi, :apply_change_to_project do
1516
1471
 
1517
1472
  it "doesn't throw if existing attribute target change is same as added change" do
1518
1473
  base_project.root_object.attributes["TargetAttributes"] = {"foo" => "1140"}
1519
- base_project.save
1520
1474
 
1521
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1475
+ theirs_project = create_copy_of_project(base_project, "theirs")
1522
1476
  theirs_project.root_object.attributes["TargetAttributes"]["foo"] = "1111"
1523
1477
 
1524
- ours_project = create_copy_of_project(base_project.path, "ours")
1478
+ ours_project = create_copy_of_project(base_project, "ours")
1525
1479
  ours_project.root_object.attributes["TargetAttributes"]["foo"] = "1111"
1526
1480
 
1527
1481
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1537,13 +1491,11 @@ describe Kintsugi, :apply_change_to_project do
1537
1491
  subproject = new_subproject("subproj", framework_filename)
1538
1492
 
1539
1493
  add_existing_subproject_to_project(base_project, subproject, framework_filename)
1540
- base_project.save
1541
1494
 
1542
1495
  theirs_project_path = make_temp_directory("theirs", ".xcodeproj")
1543
1496
  theirs_project = Xcodeproj::Project.new(theirs_project_path)
1544
1497
  add_existing_subproject_to_project(theirs_project, subproject, framework_filename)
1545
- theirs_project.save
1546
- ours_project = create_copy_of_project(theirs_project_path, "other_theirs")
1498
+ ours_project = create_copy_of_project(theirs_project, "other_theirs")
1547
1499
 
1548
1500
  subproject.new_target("com.apple.product-type.library.static", "bari", :ios)
1549
1501
  ours_project.root_object.project_references[0][:product_group] <<
@@ -1563,8 +1515,7 @@ describe Kintsugi, :apply_change_to_project do
1563
1515
  base_project = Xcodeproj::Project.new(base_project_path)
1564
1516
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
1565
1517
 
1566
- base_project.save
1567
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1518
+ theirs_project = create_copy_of_project(base_project, "theirs")
1568
1519
 
1569
1520
  variant_group = theirs_project.main_group.new_variant_group("foo.strings")
1570
1521
  variant_group.new_reference("Base").last_known_file_type = "text.plist.strings"
@@ -1579,9 +1530,8 @@ describe Kintsugi, :apply_change_to_project do
1579
1530
 
1580
1531
  it "adds build configuration list" do
1581
1532
  base_project.root_object.build_configuration_list = nil
1582
- base_project.save
1583
1533
 
1584
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1534
+ theirs_project = create_copy_of_project(base_project, "theirs")
1585
1535
  theirs_project.root_object.build_configuration_list =
1586
1536
  theirs_project.new(Xcodeproj::Project::XCConfigurationList)
1587
1537
 
@@ -1592,7 +1542,7 @@ describe Kintsugi, :apply_change_to_project do
1592
1542
  end
1593
1543
 
1594
1544
  it "removes build configuration list" do
1595
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1545
+ theirs_project = create_copy_of_project(base_project, "theirs")
1596
1546
  theirs_project.build_configuration_list.remove_from_project
1597
1547
 
1598
1548
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1606,8 +1556,7 @@ describe Kintsugi, :apply_change_to_project do
1606
1556
  base_project = Xcodeproj::Project.new(base_project_path)
1607
1557
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
1608
1558
 
1609
- base_project.save
1610
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1559
+ theirs_project = create_copy_of_project(base_project, "theirs")
1611
1560
 
1612
1561
  theirs_project.root_object.product_ref_group.new_group("foo")
1613
1562
 
@@ -1623,8 +1572,7 @@ describe Kintsugi, :apply_change_to_project do
1623
1572
  base_project = Xcodeproj::Project.new(base_project_path)
1624
1573
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
1625
1574
 
1626
- base_project.save
1627
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1575
+ theirs_project = create_copy_of_project(base_project, "theirs")
1628
1576
 
1629
1577
  variant_group = theirs_project.root_object.product_ref_group.new_variant_group("foo.strings")
1630
1578
  variant_group.new_reference("Base").last_known_file_type = "text.plist.strings"
@@ -1639,13 +1587,12 @@ describe Kintsugi, :apply_change_to_project do
1639
1587
  describe "avoiding duplicate references to the same component" do
1640
1588
  it "avoids adding file reference that already exists" do
1641
1589
  base_project.main_group.new_reference("bar")
1642
- base_project.save
1643
1590
 
1644
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1591
+ theirs_project = create_copy_of_project(base_project, "theirs")
1645
1592
  theirs_project.main_group.new_reference("bar")
1646
1593
 
1647
1594
  changes_to_apply = get_diff(theirs_project, base_project)
1648
- other_project = create_copy_of_project(base_project.path, "theirs")
1595
+ other_project = create_copy_of_project(base_project, "theirs")
1649
1596
  described_class.apply_change_to_project(other_project, changes_to_apply, theirs_project)
1650
1597
 
1651
1598
  expect(other_project).to be_equivalent_to_project(base_project)
@@ -1653,13 +1600,12 @@ describe Kintsugi, :apply_change_to_project do
1653
1600
 
1654
1601
  it "avoids adding group that already exists" do
1655
1602
  base_project.main_group.new_group("bar")
1656
- base_project.save
1657
1603
 
1658
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1604
+ theirs_project = create_copy_of_project(base_project, "theirs")
1659
1605
  theirs_project.main_group.new_group("bar")
1660
1606
 
1661
1607
  changes_to_apply = get_diff(theirs_project, base_project)
1662
- other_project = create_copy_of_project(base_project.path, "theirs")
1608
+ other_project = create_copy_of_project(base_project, "theirs")
1663
1609
  described_class.apply_change_to_project(other_project, changes_to_apply, theirs_project)
1664
1610
 
1665
1611
  expect(other_project).to be_equivalent_to_project(base_project)
@@ -1667,24 +1613,23 @@ describe Kintsugi, :apply_change_to_project do
1667
1613
 
1668
1614
  it "avoids adding variant group that already exists" do
1669
1615
  base_project.main_group.new_variant_group("bar")
1670
- base_project.save
1671
1616
 
1672
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1617
+ theirs_project = create_copy_of_project(base_project, "theirs")
1673
1618
  theirs_project.main_group.new_variant_group("bar")
1674
1619
 
1675
1620
  changes_to_apply = get_diff(theirs_project, base_project)
1676
- other_project = create_copy_of_project(base_project.path, "theirs")
1621
+ other_project = create_copy_of_project(base_project, "theirs")
1677
1622
  described_class.apply_change_to_project(other_project, changes_to_apply, theirs_project)
1678
1623
 
1679
1624
  expect(other_project).to be_equivalent_to_project(base_project)
1680
1625
  end
1681
1626
 
1682
1627
  it "avoids adding subproject that already exists" do
1683
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1628
+ theirs_project = create_copy_of_project(base_project, "theirs")
1684
1629
 
1685
1630
  subproject = add_new_subproject_to_project(theirs_project, "foo", "foo")
1686
1631
 
1687
- ours_project = create_copy_of_project(base_project.path, "ours")
1632
+ ours_project = create_copy_of_project(base_project, "ours")
1688
1633
  add_existing_subproject_to_project(ours_project, subproject, "foo")
1689
1634
 
1690
1635
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1698,14 +1643,13 @@ describe Kintsugi, :apply_change_to_project do
1698
1643
  file_reference = base_project.main_group.new_reference("bar")
1699
1644
  target = base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
1700
1645
  target.frameworks_build_phase.add_file_reference(file_reference)
1701
- base_project.save
1702
1646
 
1703
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1647
+ theirs_project = create_copy_of_project(base_project, "theirs")
1704
1648
  file_reference = theirs_project.main_group.new_reference("bar")
1705
1649
  theirs_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
1706
1650
 
1707
1651
  changes_to_apply = get_diff(theirs_project, base_project)
1708
- other_project = create_copy_of_project(base_project.path, "theirs")
1652
+ other_project = create_copy_of_project(base_project, "theirs")
1709
1653
  described_class.apply_change_to_project(other_project, changes_to_apply, theirs_project)
1710
1654
 
1711
1655
  expect(other_project).to be_equivalent_to_project(base_project)
@@ -1714,9 +1658,8 @@ describe Kintsugi, :apply_change_to_project do
1714
1658
  it "avoids adding reference proxy that already exists" do
1715
1659
  framework_filename = "baz"
1716
1660
  subproject = add_new_subproject_to_project(base_project, "subproj", framework_filename)
1717
- base_project.save
1718
1661
 
1719
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1662
+ theirs_project = create_copy_of_project(base_project, "theirs")
1720
1663
 
1721
1664
  theirs_project.root_object.project_references[0][:product_group] <<
1722
1665
  create_reference_proxy_from_product_reference(theirs_project,
@@ -1726,7 +1669,7 @@ describe Kintsugi, :apply_change_to_project do
1726
1669
 
1727
1670
  changes_to_apply = get_diff(theirs_project, base_project)
1728
1671
 
1729
- other_project = create_copy_of_project(base_project.path, "theirs")
1672
+ other_project = create_copy_of_project(base_project, "theirs")
1730
1673
  described_class.apply_change_to_project(other_project, changes_to_apply, theirs_project)
1731
1674
 
1732
1675
  expect(other_project).to be_equivalent_to_project(base_project)
@@ -1734,21 +1677,19 @@ describe Kintsugi, :apply_change_to_project do
1734
1677
 
1735
1678
  it "keeps array if adding string value that already exists in array" do
1736
1679
  base_project.new_target("com.apple.product-type.library.static", "bar", :ios)
1737
- base_project.save
1738
1680
 
1739
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1681
+ theirs_project = create_copy_of_project(base_project, "theirs")
1740
1682
  theirs_project.targets[0].build_configurations.each do |configuration|
1741
1683
  configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
1742
1684
  end
1743
1685
  changes_to_apply = get_diff(theirs_project, base_project)
1744
1686
 
1745
- ours_project = create_copy_of_project(base_project.path, "ours")
1687
+ ours_project = create_copy_of_project(base_project, "ours")
1746
1688
  ours_project.targets[0].build_configurations.each do |configuration|
1747
1689
  configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo]
1748
1690
  end
1749
- ours_project.save
1750
1691
 
1751
- expected_project = create_copy_of_project(ours_project.path, "expected")
1692
+ expected_project = create_copy_of_project(ours_project, "expected")
1752
1693
 
1753
1694
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
1754
1695
 
@@ -1766,11 +1707,11 @@ describe Kintsugi, :apply_change_to_project do
1766
1707
  end
1767
1708
 
1768
1709
  it "adds subproject that already exists" do
1769
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1710
+ theirs_project = create_copy_of_project(base_project, "theirs")
1770
1711
 
1771
1712
  subproject = add_new_subproject_to_project(theirs_project, "foo", "foo")
1772
1713
 
1773
- ours_project = create_copy_of_project(base_project.path, "ours")
1714
+ ours_project = create_copy_of_project(base_project, "ours")
1774
1715
  add_existing_subproject_to_project(ours_project, subproject, "foo")
1775
1716
 
1776
1717
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1802,14 +1743,13 @@ describe Kintsugi, :apply_change_to_project do
1802
1743
  test_prompt.choose_option(0)
1803
1744
 
1804
1745
  base_project.main_group.find_subpath("new_group", true)
1805
- base_project.save
1806
1746
 
1807
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1747
+ theirs_project = create_copy_of_project(base_project, "theirs")
1808
1748
  theirs_project["new_group"].find_subpath("sub_group", true)
1809
1749
 
1810
1750
  changes_to_apply = get_diff(theirs_project, base_project)
1811
1751
 
1812
- ours_project = create_copy_of_project(base_project.path, "ours")
1752
+ ours_project = create_copy_of_project(base_project, "ours")
1813
1753
  ours_project.main_group.find_subpath("new_group").remove_from_project
1814
1754
 
1815
1755
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
@@ -1820,17 +1760,15 @@ describe Kintsugi, :apply_change_to_project do
1820
1760
  test_prompt.choose_option(1)
1821
1761
 
1822
1762
  base_project.main_group.find_subpath("new_group", true)
1823
- base_project.save
1824
1763
 
1825
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1764
+ theirs_project = create_copy_of_project(base_project, "theirs")
1826
1765
  theirs_project["new_group"].find_subpath("sub_group", true)
1827
1766
 
1828
1767
  changes_to_apply = get_diff(theirs_project, base_project)
1829
1768
 
1830
- ours_project = create_copy_of_project(base_project.path, "ours")
1769
+ ours_project = create_copy_of_project(base_project, "ours")
1831
1770
  ours_project.main_group.find_subpath("new_group").remove_from_project
1832
- ours_project.save
1833
- expected_project = create_copy_of_project(ours_project.path, "expected")
1771
+ expected_project = create_copy_of_project(ours_project, "expected")
1834
1772
 
1835
1773
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
1836
1774
  expect(ours_project).to be_equivalent_to_project(expected_project)
@@ -1842,14 +1780,13 @@ describe Kintsugi, :apply_change_to_project do
1842
1780
  test_prompt.choose_option(0)
1843
1781
 
1844
1782
  base_project.main_group.find_subpath("new_group", true)
1845
- base_project.save
1846
1783
 
1847
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1784
+ theirs_project = create_copy_of_project(base_project, "theirs")
1848
1785
  theirs_project["new_group"].new_reference("foo/bar")
1849
1786
 
1850
1787
  changes_to_apply = get_diff(theirs_project, base_project)
1851
1788
 
1852
- ours_project = create_copy_of_project(base_project.path, "ours")
1789
+ ours_project = create_copy_of_project(base_project, "ours")
1853
1790
  ours_project.main_group.find_subpath("new_group").remove_from_project
1854
1791
 
1855
1792
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
@@ -1860,17 +1797,15 @@ describe Kintsugi, :apply_change_to_project do
1860
1797
  test_prompt.choose_option(1)
1861
1798
 
1862
1799
  base_project.main_group.find_subpath("new_group", true)
1863
- base_project.save
1864
1800
 
1865
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1801
+ theirs_project = create_copy_of_project(base_project, "theirs")
1866
1802
  theirs_project["new_group"].new_reference("foo/bar")
1867
1803
 
1868
1804
  changes_to_apply = get_diff(theirs_project, base_project)
1869
1805
 
1870
- ours_project = create_copy_of_project(base_project.path, "ours")
1806
+ ours_project = create_copy_of_project(base_project, "ours")
1871
1807
  ours_project.main_group.find_subpath("new_group").remove_from_project
1872
- ours_project.save
1873
- expected_project = create_copy_of_project(ours_project.path, "expected")
1808
+ expected_project = create_copy_of_project(ours_project, "expected")
1874
1809
 
1875
1810
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
1876
1811
  expect(ours_project).to be_equivalent_to_project(expected_project)
@@ -1882,12 +1817,11 @@ describe Kintsugi, :apply_change_to_project do
1882
1817
  test_prompt.choose_option(0)
1883
1818
 
1884
1819
  base_project.main_group.find_subpath("some_group", true)
1885
- base_project.save
1886
1820
 
1887
- ours_project = create_copy_of_project(base_project.path, "ours")
1821
+ ours_project = create_copy_of_project(base_project, "ours")
1888
1822
  ours_project.main_group.find_subpath("some_group").remove_from_project
1889
1823
 
1890
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1824
+ theirs_project = create_copy_of_project(base_project, "theirs")
1891
1825
  theirs_project.main_group.find_subpath("some_group").source_tree = "SDKROOT"
1892
1826
 
1893
1827
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1901,18 +1835,16 @@ describe Kintsugi, :apply_change_to_project do
1901
1835
  test_prompt.choose_option(1)
1902
1836
 
1903
1837
  base_project.main_group.find_subpath("some_group", true)
1904
- base_project.save
1905
1838
 
1906
- ours_project = create_copy_of_project(base_project.path, "ours")
1839
+ ours_project = create_copy_of_project(base_project, "ours")
1907
1840
  ours_project.main_group.find_subpath("some_group").remove_from_project
1908
1841
 
1909
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1842
+ theirs_project = create_copy_of_project(base_project, "theirs")
1910
1843
  theirs_project.main_group.find_subpath("some_group").source_tree = "SDKROOT"
1911
1844
 
1912
1845
  changes_to_apply = get_diff(theirs_project, base_project)
1913
1846
 
1914
- ours_project.save
1915
- expected_project = create_copy_of_project(ours_project.path, "expected")
1847
+ expected_project = create_copy_of_project(ours_project, "expected")
1916
1848
 
1917
1849
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
1918
1850
 
@@ -1925,12 +1857,11 @@ describe Kintsugi, :apply_change_to_project do
1925
1857
  test_prompt.choose_option(0)
1926
1858
 
1927
1859
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
1928
- base_project.save
1929
1860
 
1930
- ours_project = create_copy_of_project(base_project.path, "ours")
1861
+ ours_project = create_copy_of_project(base_project, "ours")
1931
1862
  ours_project.targets[0].product_reference.remove_from_project
1932
1863
 
1933
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1864
+ theirs_project = create_copy_of_project(base_project, "theirs")
1934
1865
  theirs_project.targets[0].product_reference.source_tree = "SDKROOT"
1935
1866
 
1936
1867
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1944,18 +1875,16 @@ describe Kintsugi, :apply_change_to_project do
1944
1875
  test_prompt.choose_option(1)
1945
1876
 
1946
1877
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
1947
- base_project.save
1948
1878
 
1949
- ours_project = create_copy_of_project(base_project.path, "ours")
1879
+ ours_project = create_copy_of_project(base_project, "ours")
1950
1880
  ours_project.targets[0].product_reference.remove_from_project
1951
1881
 
1952
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1882
+ theirs_project = create_copy_of_project(base_project, "theirs")
1953
1883
  theirs_project.targets[0].product_reference.source_tree = "SDKROOT"
1954
1884
 
1955
1885
  changes_to_apply = get_diff(theirs_project, base_project)
1956
1886
 
1957
- ours_project.save
1958
- expected_project = create_copy_of_project(ours_project.path, "expected")
1887
+ expected_project = create_copy_of_project(ours_project, "expected")
1959
1888
 
1960
1889
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
1961
1890
 
@@ -1972,16 +1901,15 @@ describe Kintsugi, :apply_change_to_project do
1972
1901
  file_reference = base_project.main_group.new_reference(file_reference_name)
1973
1902
  target = base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
1974
1903
  target.source_build_phase.add_file_reference(file_reference)
1975
- base_project.save
1976
1904
 
1977
- ours_project = create_copy_of_project(base_project.path, "ours")
1905
+ ours_project = create_copy_of_project(base_project, "ours")
1978
1906
  build_file = ours_project.targets[0].source_build_phase.files[-1]
1979
1907
  # Removing the build file first is done because prior to xcodeproj 1.22, the build file was
1980
1908
  # not removed when its file reference was removed.
1981
1909
  build_file.remove_from_project
1982
1910
  ours_project.main_group.find_subpath(file_reference_name).remove_from_project
1983
1911
 
1984
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1912
+ theirs_project = create_copy_of_project(base_project, "theirs")
1985
1913
  theirs_project.main_group.find_subpath(file_reference_name).source_tree = "SDKROOT"
1986
1914
 
1987
1915
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -1999,18 +1927,16 @@ describe Kintsugi, :apply_change_to_project do
1999
1927
  file_reference = base_project.main_group.new_reference(file_reference_name)
2000
1928
  target = base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
2001
1929
  target.source_build_phase.add_file_reference(file_reference)
2002
- base_project.save
2003
1930
 
2004
- ours_project = create_copy_of_project(base_project.path, "ours")
1931
+ ours_project = create_copy_of_project(base_project, "ours")
2005
1932
  ours_project.main_group.find_subpath(file_reference_name).remove_from_project
2006
1933
 
2007
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1934
+ theirs_project = create_copy_of_project(base_project, "theirs")
2008
1935
  theirs_project.main_group.find_subpath(file_reference_name).source_tree = "SDKROOT"
2009
1936
 
2010
1937
  changes_to_apply = get_diff(theirs_project, base_project)
2011
1938
 
2012
- ours_project.save
2013
- expected_project = create_copy_of_project(ours_project.path, "expected")
1939
+ expected_project = create_copy_of_project(ours_project, "expected")
2014
1940
 
2015
1941
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
2016
1942
 
@@ -2027,14 +1953,13 @@ describe Kintsugi, :apply_change_to_project do
2027
1953
  base_project.targets[0].build_configurations.each do |configuration|
2028
1954
  configuration.build_settings = nil
2029
1955
  end
2030
- base_project.save
2031
1956
 
2032
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1957
+ theirs_project = create_copy_of_project(base_project, "theirs")
2033
1958
  theirs_project.targets[0].build_configurations.each do |configuration|
2034
1959
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "bar"}
2035
1960
  end
2036
1961
 
2037
- ours_project = create_copy_of_project(base_project.path, "ours")
1962
+ ours_project = create_copy_of_project(base_project, "ours")
2038
1963
  ours_project.targets[0].build_configurations.each do |configuration|
2039
1964
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "baz"}
2040
1965
  end
@@ -2053,19 +1978,17 @@ describe Kintsugi, :apply_change_to_project do
2053
1978
  base_project.targets[0].build_configurations.each do |configuration|
2054
1979
  configuration.build_settings = nil
2055
1980
  end
2056
- base_project.save
2057
1981
 
2058
- theirs_project = create_copy_of_project(base_project.path, "theirs")
1982
+ theirs_project = create_copy_of_project(base_project, "theirs")
2059
1983
  theirs_project.targets[0].build_configurations.each do |configuration|
2060
1984
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "bar"}
2061
1985
  end
2062
1986
 
2063
- ours_project = create_copy_of_project(base_project.path, "ours")
1987
+ ours_project = create_copy_of_project(base_project, "ours")
2064
1988
  ours_project.targets[0].build_configurations.each do |configuration|
2065
1989
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "baz"}
2066
1990
  end
2067
- ours_project.save
2068
- expected_project = create_copy_of_project(ours_project.path, "expected")
1991
+ expected_project = create_copy_of_project(ours_project, "expected")
2069
1992
 
2070
1993
  changes_to_apply = get_diff(theirs_project, base_project)
2071
1994
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
@@ -2083,14 +2006,13 @@ describe Kintsugi, :apply_change_to_project do
2083
2006
  base_project.targets[0].build_configurations.each do |configuration|
2084
2007
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "bar"}
2085
2008
  end
2086
- base_project.save
2087
2009
 
2088
- theirs_project = create_copy_of_project(base_project.path, "theirs")
2010
+ theirs_project = create_copy_of_project(base_project, "theirs")
2089
2011
  theirs_project.targets[0].build_configurations.each do |configuration|
2090
2012
  configuration.build_settings = nil
2091
2013
  end
2092
2014
 
2093
- ours_project = create_copy_of_project(base_project.path, "ours")
2015
+ ours_project = create_copy_of_project(base_project, "ours")
2094
2016
  ours_project.targets[0].build_configurations.each do |configuration|
2095
2017
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "baz"}
2096
2018
  end
@@ -2098,7 +2020,7 @@ describe Kintsugi, :apply_change_to_project do
2098
2020
  changes_to_apply = get_diff(theirs_project, base_project)
2099
2021
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
2100
2022
 
2101
- expected_project = create_copy_of_project(base_project.path, "expected")
2023
+ expected_project = create_copy_of_project(base_project, "expected")
2102
2024
  expected_project.targets[0].build_configurations.each do |configuration|
2103
2025
  configuration.build_settings = {}
2104
2026
  end
@@ -2113,19 +2035,17 @@ describe Kintsugi, :apply_change_to_project do
2113
2035
  base_project.targets[0].build_configurations.each do |configuration|
2114
2036
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "bar"}
2115
2037
  end
2116
- base_project.save
2117
2038
 
2118
- theirs_project = create_copy_of_project(base_project.path, "theirs")
2039
+ theirs_project = create_copy_of_project(base_project, "theirs")
2119
2040
  theirs_project.targets[0].build_configurations.each do |configuration|
2120
2041
  configuration.build_settings = nil
2121
2042
  end
2122
2043
 
2123
- ours_project = create_copy_of_project(base_project.path, "ours")
2044
+ ours_project = create_copy_of_project(base_project, "ours")
2124
2045
  ours_project.targets[0].build_configurations.each do |configuration|
2125
2046
  configuration.build_settings = {"HEADER_SEARCH_PATHS" => "baz"}
2126
2047
  end
2127
- ours_project.save
2128
- expected_project = create_copy_of_project(ours_project.path, "expected")
2048
+ expected_project = create_copy_of_project(ours_project, "expected")
2129
2049
 
2130
2050
  changes_to_apply = get_diff(theirs_project, base_project)
2131
2051
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
@@ -2143,14 +2063,13 @@ describe Kintsugi, :apply_change_to_project do
2143
2063
  base_project.targets[0].build_configurations.each do |configuration|
2144
2064
  configuration.build_settings["PRODUCT_NAME"] = "old"
2145
2065
  end
2146
- base_project.save
2147
2066
 
2148
- theirs_project = create_copy_of_project(base_project.path, "theirs")
2067
+ theirs_project = create_copy_of_project(base_project, "theirs")
2149
2068
  theirs_project.targets[0].build_configurations.each do |configuration|
2150
2069
  configuration.build_settings["PRODUCT_NAME"] = "new"
2151
2070
  end
2152
2071
 
2153
- ours_project = create_copy_of_project(base_project.path, "ours")
2072
+ ours_project = create_copy_of_project(base_project, "ours")
2154
2073
  ours_project.targets[0].build_configurations.each do |configuration|
2155
2074
  configuration.build_settings["PRODUCT_NAME"] = "existing"
2156
2075
  end
@@ -2169,19 +2088,17 @@ describe Kintsugi, :apply_change_to_project do
2169
2088
  base_project.targets[0].build_configurations.each do |configuration|
2170
2089
  configuration.build_settings["PRODUCT_NAME"] = "old"
2171
2090
  end
2172
- base_project.save
2173
2091
 
2174
- theirs_project = create_copy_of_project(base_project.path, "theirs")
2092
+ theirs_project = create_copy_of_project(base_project, "theirs")
2175
2093
  theirs_project.targets[0].build_configurations.each do |configuration|
2176
2094
  configuration.build_settings["PRODUCT_NAME"] = "new"
2177
2095
  end
2178
2096
 
2179
- ours_project = create_copy_of_project(base_project.path, "ours")
2097
+ ours_project = create_copy_of_project(base_project, "ours")
2180
2098
  ours_project.targets[0].build_configurations.each do |configuration|
2181
2099
  configuration.build_settings["PRODUCT_NAME"] = "existing"
2182
2100
  end
2183
- ours_project.save
2184
- expected_project = create_copy_of_project(ours_project.path, "expected")
2101
+ expected_project = create_copy_of_project(ours_project, "expected")
2185
2102
 
2186
2103
  changes_to_apply = get_diff(theirs_project, base_project)
2187
2104
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
@@ -2196,12 +2113,11 @@ describe Kintsugi, :apply_change_to_project do
2196
2113
 
2197
2114
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
2198
2115
  base_project.targets[0].new_shell_script_build_phase("bar")
2199
- base_project.save
2200
2116
 
2201
- theirs_project = create_copy_of_project(base_project.path, "theirs")
2117
+ theirs_project = create_copy_of_project(base_project, "theirs")
2202
2118
  theirs_project.targets[0].shell_script_build_phases[0].remove_from_project
2203
2119
 
2204
- ours_project = create_copy_of_project(base_project.path, "ours")
2120
+ ours_project = create_copy_of_project(base_project, "ours")
2205
2121
  ours_project.targets[0].shell_script_build_phases[0].shell_script = "foo"
2206
2122
 
2207
2123
  changes_to_apply = get_diff(theirs_project, base_project)
@@ -2215,16 +2131,14 @@ describe Kintsugi, :apply_change_to_project do
2215
2131
 
2216
2132
  base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
2217
2133
  base_project.targets[0].new_shell_script_build_phase("bar")
2218
- base_project.save
2219
2134
 
2220
- theirs_project = create_copy_of_project(base_project.path, "theirs")
2135
+ theirs_project = create_copy_of_project(base_project, "theirs")
2221
2136
  theirs_project.targets[0].shell_script_build_phases[0].remove_from_project
2222
2137
 
2223
- ours_project = create_copy_of_project(base_project.path, "ours")
2138
+ ours_project = create_copy_of_project(base_project, "ours")
2224
2139
  ours_project.targets[0].shell_script_build_phases[0].shell_script = "foo"
2225
2140
 
2226
- ours_project.save
2227
- expected_project = create_copy_of_project(ours_project.path, "expected")
2141
+ expected_project = create_copy_of_project(ours_project, "expected")
2228
2142
 
2229
2143
  changes_to_apply = get_diff(theirs_project, base_project)
2230
2144
  described_class.apply_change_to_project(ours_project, changes_to_apply, theirs_project)
@@ -2234,9 +2148,9 @@ describe Kintsugi, :apply_change_to_project do
2234
2148
  end
2235
2149
  end
2236
2150
 
2237
- def create_copy_of_project(project_path, new_project_prefix)
2151
+ def create_copy_of_project(project, new_project_prefix)
2238
2152
  copied_project_path = make_temp_directory(new_project_prefix, ".xcodeproj")
2239
- FileUtils.cp(File.join(project_path, "project.pbxproj"), copied_project_path)
2153
+ project.save(copied_project_path)
2240
2154
  Xcodeproj::Project.open(copied_project_path)
2241
2155
  end
2242
2156