kintsugi 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ci.yml +25 -0
- data/.gitignore +56 -0
- data/.rspec +1 -0
- data/.rubocop.yml +221 -0
- data/CONTRIBUTING.md +23 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +51 -0
- data/Rakefile +13 -0
- data/bin/kintsugi +44 -0
- data/kintsugi.gemspec +30 -0
- data/lib/kintsugi.rb +119 -0
- data/lib/kintsugi/apply_change_to_project.rb +592 -0
- data/lib/kintsugi/utils.rb +37 -0
- data/lib/kintsugi/xcodeproj_extensions.rb +31 -0
- data/logo/kintsugi.png +0 -0
- data/spec/be_equivalent_to_project.rb +63 -0
- data/spec/kintsugi_apply_change_to_project_spec.rb +885 -0
- data/spec/spec_helper.rb +105 -0
- metadata +151 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3047191981783a65015d6646c15e0c4aa5cba3b3a6f32b6328163a4e8ca7ff37
|
4
|
+
data.tar.gz: 0653aa77f904b249d285feade1d8b5d34a2fbd4ee25bd9431cb32be6462a938e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f15ab16432c5b3bf335a1b25cac66d2e7bc0b20ec29b3b374b6d88010efc804b292750b703af3aed353a2c01666e116b11290ed32d48731ac3471f94a964c70c
|
7
|
+
data.tar.gz: 54220422787ba0bf75c1cb1594ad3dfed6414e7d95df1193de3e2550953aee798396ed99204e433e10522577b51f2655b15e90b98219c7c608dca6379557580e
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
main-job:
|
11
|
+
name: Main
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- name: Checkout repo
|
16
|
+
uses: actions/checkout@v2
|
17
|
+
|
18
|
+
- name: Set up Ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.5.8
|
22
|
+
bundler-cache: true
|
23
|
+
|
24
|
+
- name: Run Rake
|
25
|
+
run: bundle exec rake
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
Gemfile.lock
|
49
|
+
.ruby-version
|
50
|
+
.ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
RSpec/ExampleLength:
|
4
|
+
Enabled: false
|
5
|
+
|
6
|
+
RSpec/DescribeClass:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
AllCops:
|
10
|
+
DisplayCopNames: true
|
11
|
+
TargetRubyVersion: 2.5
|
12
|
+
NewCops: enable
|
13
|
+
|
14
|
+
Metrics/BlockLength:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/NumericPredicate:
|
18
|
+
Exclude:
|
19
|
+
- 'features/steps/**'
|
20
|
+
|
21
|
+
Layout/EndAlignment:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Lint/UnusedBlockArgument:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Lint/UnusedMethodArgument:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Lint/UselessAccessModifier:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
Lint/Void:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Metrics/AbcSize:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Metrics/ClassLength:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/CyclomaticComplexity:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Layout/EmptyLinesAroundArguments:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Layout/LineLength:
|
49
|
+
Max: 100
|
50
|
+
Exclude:
|
51
|
+
- 'spec/**/*.rb'
|
52
|
+
|
53
|
+
Metrics/MethodLength:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Metrics/ModuleLength:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Metrics/PerceivedComplexity:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Layout/HashAlignment:
|
63
|
+
Enabled: true
|
64
|
+
Exclude:
|
65
|
+
- 'spec/**/*.rb'
|
66
|
+
|
67
|
+
Layout/ParameterAlignment:
|
68
|
+
Enabled: true
|
69
|
+
Exclude:
|
70
|
+
- 'spec/**/*.rb'
|
71
|
+
|
72
|
+
Style/BarePercentLiterals:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
Style/BlockDelimiters:
|
76
|
+
Enabled: false
|
77
|
+
|
78
|
+
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep.
|
79
|
+
Layout/CaseIndentation:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
Style/ClassVars:
|
83
|
+
Enabled: false
|
84
|
+
|
85
|
+
Layout/ClosingParenthesisIndentation:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
# Offense count: 1
|
89
|
+
# Cop supports --auto-correct.
|
90
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerBackticks.
|
91
|
+
Style/CommandLiteral:
|
92
|
+
Exclude:
|
93
|
+
- 'features/support/*.rb'
|
94
|
+
|
95
|
+
Layout/CommentIndentation:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Style/Documentation:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
Layout/EmptyLines:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Layout/EmptyLinesAroundBlockBody:
|
105
|
+
Exclude:
|
106
|
+
- 'spec/**/*.rb'
|
107
|
+
|
108
|
+
Layout/EmptyLinesAroundClassBody:
|
109
|
+
Enabled: false
|
110
|
+
|
111
|
+
Layout/EmptyLinesAroundModuleBody:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Style/GuardClause:
|
115
|
+
Enabled: false
|
116
|
+
|
117
|
+
Style/HashSyntax:
|
118
|
+
EnforcedStyle: ruby19
|
119
|
+
|
120
|
+
Style/IfUnlessModifier:
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Layout/IndentationWidth:
|
124
|
+
Exclude:
|
125
|
+
- 'spec/**/*.rb'
|
126
|
+
|
127
|
+
Layout/LeadingCommentSpace:
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
Style/LineEndConcatenation:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
Style/MethodDefParentheses:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
Layout/MultilineOperationIndentation:
|
137
|
+
Enabled: false
|
138
|
+
|
139
|
+
Style/NonNilCheck:
|
140
|
+
Enabled: false
|
141
|
+
|
142
|
+
Style/PercentLiteralDelimiters:
|
143
|
+
Enabled: true
|
144
|
+
|
145
|
+
Style/PercentQLiterals:
|
146
|
+
Enabled: false
|
147
|
+
|
148
|
+
Style/PerlBackrefs:
|
149
|
+
Enabled: false
|
150
|
+
|
151
|
+
Style/RedundantBegin:
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
Style/RegexpLiteral:
|
155
|
+
Enabled: false
|
156
|
+
|
157
|
+
Style/SignalException:
|
158
|
+
Enabled: false
|
159
|
+
|
160
|
+
Layout/SpaceAfterComma:
|
161
|
+
Enabled: true
|
162
|
+
|
163
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
164
|
+
Enabled: false
|
165
|
+
|
166
|
+
Layout/SpaceAroundOperators:
|
167
|
+
Enabled: true
|
168
|
+
|
169
|
+
Layout/SpaceInsideBlockBraces:
|
170
|
+
Enabled: true
|
171
|
+
EnforcedStyle: space
|
172
|
+
|
173
|
+
Layout/SpaceInsideHashLiteralBraces:
|
174
|
+
Enabled: true
|
175
|
+
EnforcedStyle: no_space
|
176
|
+
|
177
|
+
Layout/SpaceInsideParens:
|
178
|
+
Enabled: true
|
179
|
+
|
180
|
+
Style/SpecialGlobalVars:
|
181
|
+
Enabled: false
|
182
|
+
|
183
|
+
Style/StringLiterals:
|
184
|
+
Enabled: false
|
185
|
+
|
186
|
+
Style/StringLiteralsInInterpolation:
|
187
|
+
Enabled: false
|
188
|
+
|
189
|
+
Style/SymbolProc:
|
190
|
+
Enabled: false
|
191
|
+
|
192
|
+
Style/TrailingCommaInArguments:
|
193
|
+
Enabled: true
|
194
|
+
|
195
|
+
Style/TrailingCommaInArrayLiteral:
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
Style/TrailingCommaInHashLiteral:
|
199
|
+
Enabled: true
|
200
|
+
|
201
|
+
Layout/TrailingWhitespace:
|
202
|
+
Enabled: true
|
203
|
+
|
204
|
+
Style/RedundantPercentQ:
|
205
|
+
Exclude:
|
206
|
+
- 'kintsugi.gemspec'
|
207
|
+
|
208
|
+
Lint/RaiseException:
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
Lint/StructNewOverride:
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Style/HashEachMethods:
|
215
|
+
Enabled: true
|
216
|
+
|
217
|
+
Style/HashTransformKeys:
|
218
|
+
Enabled: true
|
219
|
+
|
220
|
+
Style/HashTransformValues:
|
221
|
+
Enabled: true
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
If you wish to contribute to the project, please follow the guidelines below.
|
4
|
+
|
5
|
+
## Opening issues
|
6
|
+
|
7
|
+
- Check that the issue doesn't exist already.
|
8
|
+
- Check that the issue was not already fixed in the latest `main`.
|
9
|
+
|
10
|
+
## Pull requests
|
11
|
+
|
12
|
+
**During development**
|
13
|
+
|
14
|
+
- Make sure you're on the latest version to avoid conflicts when opening the pull request.
|
15
|
+
- Install the needed gems by running `bundle install`.
|
16
|
+
- Make the changes you need and commit them.
|
17
|
+
- Add tests for the new functionality.
|
18
|
+
- Run `bundle exec rake` and make sure all the tests pass.
|
19
|
+
|
20
|
+
**Before opening a pull request:**
|
21
|
+
|
22
|
+
- Squash the commits such that each represents a single coherent change. Make sure that they have [good commit messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
23
|
+
- Open a [pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests).
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Lightricks
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="./logo/kintsugi.png" alt="Kintsugi Logo"/>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
# Kintsugi [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
|
6
|
+
|
7
|
+
## What is this?
|
8
|
+
|
9
|
+
One of the frustrations of working with Xcode together with Git is resolving conflicts in Xcode project files, i.e. the `project.pbxproj` file.
|
10
|
+
|
11
|
+
Kintsugi sets out to solve this exact problem: Automatically resolving Git merge conflicts occurring in `.pbxproj` files.
|
12
|
+
|
13
|
+
The end goal is for the tool to succeed 99.9% of the time, and let you resolve the real conflicts in a convenient way the rest of the time.
|
14
|
+
|
15
|
+
> Kintsugi (金継ぎ) is the art of repairing broken pottery by mending it with gold. [Wikipedia](http://en.wikipedia.org/wiki/Kintsugi)
|
16
|
+
|
17
|
+
## How?
|
18
|
+
|
19
|
+
Kintsugi understands the changes you've made to the `.pbxproj` file, so it simply resets the conflicts and re-applies those changes to it.
|
20
|
+
|
21
|
+
From a technical perspective, Kintsugi heavily relies on [Xcodeproj](https://github.com/CocoaPods/Xcodeproj). It uses its diff capability to extract the changes, and uses its project files editing capabilities to apply the changes.
|
22
|
+
|
23
|
+
## Installing Kintsugi
|
24
|
+
|
25
|
+
```sh
|
26
|
+
$ gem install kintsugi
|
27
|
+
```
|
28
|
+
|
29
|
+
If you prefer to use bundler, add the following line to your Gemfile:
|
30
|
+
|
31
|
+
```rb
|
32
|
+
gem 'kintsugi', require: false
|
33
|
+
```
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
When there's a `.pbxproj` file with Git conflicts, run `kintsugi <path_to_pbxproj_file>`.
|
38
|
+
|
39
|
+
And see the magic happen! :sparkles:
|
40
|
+
|
41
|
+
## Contribution
|
42
|
+
|
43
|
+
See our [Contribution guidelines](./CONTRIBUTING.md).
|
44
|
+
|
45
|
+
## Alternatives
|
46
|
+
|
47
|
+
- [XcodeGen](https://github.com/yonaskolb/XcodeGen): You can commit this JSON file into Git instead of the `.pbxproj` file. Then resolving conflicts is much easier.
|
48
|
+
|
49
|
+
## Copyright
|
50
|
+
|
51
|
+
Copyright (c) 2021 Lightricks. See [LICENSE](./LICENSE) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020 Lightricks. All rights reserved.
|
4
|
+
# Created by Ben Yohay.
|
5
|
+
|
6
|
+
require "rspec/core/rake_task"
|
7
|
+
require "rubocop/rake_task"
|
8
|
+
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
|
11
|
+
RuboCop::RakeTask.new(:rubocop)
|
12
|
+
|
13
|
+
task default: %i[rubocop spec]
|
data/bin/kintsugi
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Copyright (c) 2020 Lightricks. All rights reserved.
|
5
|
+
# Created by Ben Yohay.
|
6
|
+
|
7
|
+
require "json"
|
8
|
+
require "optparse"
|
9
|
+
|
10
|
+
require "kintsugi"
|
11
|
+
|
12
|
+
def parse_options!(argv)
|
13
|
+
options_parser = create_options_parser
|
14
|
+
|
15
|
+
options = {}
|
16
|
+
options_parser.parse!(argv, into: options)
|
17
|
+
|
18
|
+
if argv.length != 1
|
19
|
+
puts "Incorrect number of arguments\n\n"
|
20
|
+
puts options_parser
|
21
|
+
exit(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
options
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_options_parser
|
28
|
+
OptionParser.new do |opts|
|
29
|
+
opts.banner = "Usage: kintsugi [pbxproj_filepath] [options]"
|
30
|
+
opts.on("--changes-output-path=PATH", "Path to which changes applied to the project are " \
|
31
|
+
"written in JSON format. Used for debug purposes.")
|
32
|
+
|
33
|
+
opts.on("-h", "--help", "Prints this help") do
|
34
|
+
puts opts
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
options = parse_options!(ARGV)
|
41
|
+
project_file_path = File.expand_path(ARGV[0])
|
42
|
+
Kintsugi.resolve_conflicts(project_file_path, options[:"changes-output-path"])
|
43
|
+
|
44
|
+
puts "Resolved conflicts successfully"
|