kintsugi 0.5.2 → 0.6.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +8 -0
- data/.github/workflows/tests.yml +1 -0
- data/.rubocop.yml +3 -0
- data/bin/kintsugi +2 -30
- data/kintsugi.gemspec +2 -1
- data/lib/kintsugi/apply_change_to_project.rb +382 -135
- data/lib/kintsugi/cli.rb +8 -0
- data/lib/kintsugi/merge.rb +146 -0
- data/lib/kintsugi/settings.rb +18 -0
- data/lib/kintsugi/version.rb +1 -1
- data/lib/kintsugi/xcodeproj_extensions.rb +84 -0
- data/lib/kintsugi.rb +29 -148
- data/spec/kintsugi_apply_change_to_project_spec.rb +346 -111
- data/spec/kintsugi_integration_spec.rb +148 -0
- metadata +23 -5
@@ -0,0 +1,148 @@
|
|
1
|
+
# Copyright (c) 2021 Lightricks. All rights reserved.
|
2
|
+
# Created by Ben Yohay.
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require "git"
|
6
|
+
require "json"
|
7
|
+
require "rspec"
|
8
|
+
require "tempfile"
|
9
|
+
require "tmpdir"
|
10
|
+
|
11
|
+
require "kintsugi"
|
12
|
+
|
13
|
+
shared_examples "tests" do |git_command, project_name|
|
14
|
+
let(:temporary_directories_paths) { [] }
|
15
|
+
let(:git_directory_path) { make_temp_directory }
|
16
|
+
let(:git) { Git.init(git_directory_path) }
|
17
|
+
|
18
|
+
before do
|
19
|
+
git.config("user.email", "you@example.com")
|
20
|
+
git.config("user.name", "Your Name")
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
temporary_directories_paths.each do |directory_path|
|
25
|
+
FileUtils.remove_entry(directory_path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "running 'git #{git_command}' with project name '#{project_name}'" do
|
30
|
+
it "resolves conflicts with root command" do
|
31
|
+
File.write(File.join(git_directory_path, ".gitattributes"), "*.pbxproj merge=Unset")
|
32
|
+
|
33
|
+
project = create_new_project_at_path(File.join(git_directory_path, project_name))
|
34
|
+
|
35
|
+
git.add(File.join(git_directory_path, ".gitattributes"))
|
36
|
+
git.add(project.path)
|
37
|
+
git.commit("Initial project")
|
38
|
+
|
39
|
+
project.new_target("com.apple.product-type.library.static", "foo", :ios)
|
40
|
+
project.save
|
41
|
+
|
42
|
+
git.add(all: true)
|
43
|
+
git.commit("Add target foo")
|
44
|
+
first_commit_hash = git.revparse("HEAD")
|
45
|
+
|
46
|
+
git.checkout("HEAD^")
|
47
|
+
project = Xcodeproj::Project.open(project.path)
|
48
|
+
project.new_target("com.apple.product-type.library.static", "bar", :ios)
|
49
|
+
project.save
|
50
|
+
git.add(all: true)
|
51
|
+
git.commit("Add target bar")
|
52
|
+
|
53
|
+
`git -C #{git_directory_path} #{git_command} #{first_commit_hash} &> /dev/null`
|
54
|
+
Kintsugi.run([File.join(project.path, "project.pbxproj")])
|
55
|
+
|
56
|
+
project = Xcodeproj::Project.open(project.path)
|
57
|
+
expect(project.targets.map(&:display_name)).to contain_exactly("foo", "bar")
|
58
|
+
end
|
59
|
+
|
60
|
+
it "resolves conflicts automatically with driver" do
|
61
|
+
git.config("merge.kintsugi.name", "Kintsugi driver")
|
62
|
+
git.config("merge.kintsugi.driver", "#{__dir__}/../bin/kintsugi driver %O %A %B %P")
|
63
|
+
File.write(File.join(git_directory_path, ".gitattributes"), "*.pbxproj merge=kintsugi")
|
64
|
+
|
65
|
+
project = create_new_project_at_path(File.join(git_directory_path, project_name))
|
66
|
+
|
67
|
+
git.add(File.join(git_directory_path, ".gitattributes"))
|
68
|
+
git.add(project.path)
|
69
|
+
git.commit("Initial project")
|
70
|
+
|
71
|
+
project.new_target("com.apple.product-type.library.static", "foo", :ios)
|
72
|
+
project.save
|
73
|
+
|
74
|
+
git.add(all: true)
|
75
|
+
git.commit("Add target foo")
|
76
|
+
first_commit_hash = git.revparse("HEAD")
|
77
|
+
|
78
|
+
git.checkout("HEAD^")
|
79
|
+
project = Xcodeproj::Project.open(project.path)
|
80
|
+
project.new_target("com.apple.product-type.library.static", "bar", :ios)
|
81
|
+
project.save
|
82
|
+
git.add(all: true)
|
83
|
+
git.commit("Add target bar")
|
84
|
+
|
85
|
+
`git -C #{git_directory_path} #{git_command} #{first_commit_hash} &> /dev/null`
|
86
|
+
|
87
|
+
project = Xcodeproj::Project.open(project.path)
|
88
|
+
expect(project.targets.map(&:display_name)).to contain_exactly("foo", "bar")
|
89
|
+
end
|
90
|
+
|
91
|
+
it "keeps conflicts if failed to resolve conflicts" do
|
92
|
+
File.write(File.join(git_directory_path, ".gitattributes"), "*.pbxproj merge=Unset")
|
93
|
+
|
94
|
+
project = create_new_project_at_path(File.join(git_directory_path, project_name))
|
95
|
+
project.new_target("com.apple.product-type.library.static", "foo", :ios)
|
96
|
+
project.save
|
97
|
+
|
98
|
+
git.add(File.join(git_directory_path, ".gitattributes"))
|
99
|
+
git.add(project.path)
|
100
|
+
git.commit("Initial project")
|
101
|
+
|
102
|
+
project.targets[0].build_configurations.each do |configuration|
|
103
|
+
configuration.build_settings["PRODUCT_NAME"] = "bar"
|
104
|
+
end
|
105
|
+
project.save
|
106
|
+
git.add(all: true)
|
107
|
+
git.commit("Change target product name to bar")
|
108
|
+
first_commit_hash = git.revparse("HEAD")
|
109
|
+
|
110
|
+
git.checkout("HEAD^")
|
111
|
+
project = Xcodeproj::Project.open(project.path)
|
112
|
+
project.targets[0].build_configurations.each do |configuration|
|
113
|
+
configuration.build_settings["PRODUCT_NAME"] = "baz"
|
114
|
+
end
|
115
|
+
project.save
|
116
|
+
git.add(all: true)
|
117
|
+
git.commit("Change target product name to baz")
|
118
|
+
|
119
|
+
`git -C #{git_directory_path} #{git_command} #{first_commit_hash} &> /dev/null`
|
120
|
+
|
121
|
+
expect {
|
122
|
+
Kintsugi.run([File.join(project.path, "project.pbxproj")])
|
123
|
+
}.to raise_error(Kintsugi::MergeError)
|
124
|
+
expect(`git -C #{git_directory_path} diff --name-only --diff-filter=U`.chomp)
|
125
|
+
.to eq("#{project_name}/project.pbxproj")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def make_temp_directory
|
130
|
+
directory_path = Dir.mktmpdir
|
131
|
+
temporary_directories_paths << directory_path
|
132
|
+
directory_path
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def create_new_project_at_path(path)
|
137
|
+
project = Xcodeproj::Project.new(path)
|
138
|
+
project.save
|
139
|
+
project
|
140
|
+
end
|
141
|
+
|
142
|
+
describe Kintsugi, :kintsugi do
|
143
|
+
%w[rebase cherry-pick merge].each do |git_command|
|
144
|
+
["foo.xcodeproj", "foo with space.xcodeproj"].each do |project_name|
|
145
|
+
it_behaves_like("tests", git_command, project_name)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kintsugi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Yohay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 1.19.0
|
20
20
|
- - "<="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
22
|
+
version: 1.22.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,21 @@ dependencies:
|
|
29
29
|
version: 1.19.0
|
30
30
|
- - "<="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
32
|
+
version: 1.22.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: git
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.11'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.11'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: rake
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,12 +139,15 @@ files:
|
|
125
139
|
- lib/kintsugi/apply_change_to_project.rb
|
126
140
|
- lib/kintsugi/cli.rb
|
127
141
|
- lib/kintsugi/error.rb
|
142
|
+
- lib/kintsugi/merge.rb
|
143
|
+
- lib/kintsugi/settings.rb
|
128
144
|
- lib/kintsugi/utils.rb
|
129
145
|
- lib/kintsugi/version.rb
|
130
146
|
- lib/kintsugi/xcodeproj_extensions.rb
|
131
147
|
- logo/kintsugi.png
|
132
148
|
- spec/be_equivalent_to_project.rb
|
133
149
|
- spec/kintsugi_apply_change_to_project_spec.rb
|
150
|
+
- spec/kintsugi_integration_spec.rb
|
134
151
|
- spec/spec_helper.rb
|
135
152
|
homepage: https://github.com/Lightricks/Kintsugi
|
136
153
|
licenses:
|
@@ -151,11 +168,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
168
|
- !ruby/object:Gem::Version
|
152
169
|
version: '0'
|
153
170
|
requirements: []
|
154
|
-
rubygems_version: 3.3.
|
171
|
+
rubygems_version: 3.3.20
|
155
172
|
signing_key:
|
156
173
|
specification_version: 4
|
157
174
|
summary: pbxproj files git conflicts solver
|
158
175
|
test_files:
|
159
176
|
- spec/be_equivalent_to_project.rb
|
160
177
|
- spec/kintsugi_apply_change_to_project_spec.rb
|
178
|
+
- spec/kintsugi_integration_spec.rb
|
161
179
|
- spec/spec_helper.rb
|