cocoapods-patch 0.0.8 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 765a982a7881db3b57c31e3bbe5e54ec56f5d990a4918c81f1ff7dbf6e7d9cf7
4
- data.tar.gz: b9ec1d2c051c580b5f9c79f34e6905b8931a5ca3abcde268d61ff03fbdb6e938
3
+ metadata.gz: 9c776a1fc38b8a256df3593271ef62449d5eb48dd754198e718005c1107f3136
4
+ data.tar.gz: ab2a05988e78230620cfd26cd9d68442fcb85b9b1e6b9823bf1737c6d03d6863
5
5
  SHA512:
6
- metadata.gz: 32860c686e91f67ee8d4939bb1507c852b34284c626086a74375e3c51a38d6c31e4b06e4f07e401f73724105824b55e3b3cc59001fbac875843e5e904046d970
7
- data.tar.gz: 8702ff7065ed62bdca2455c145a7519bc9317db9f86a05639b8c2f08ae5dd9901e6566bfe6ea0dfd6b5501fa25d7a910af085ce3270996545a02d2117f701cfc
6
+ metadata.gz: e48a2c658ca3d8e47b03294312b945c2a4b9a797f0b6348ecf45b5877db0aaff2beb4470ead4292e1c84e99534f08624bdc345abd6c928bf000559fde0e2c55c
7
+ data.tar.gz: 9ef7532fd542f35a45cad2c239266944b8c671d9e5fec3f0c3d15394cd30b60fbdcc1ce6e795ac887f336efdc2b5898f3a633045efe083d7b4092cf1a44f074c
data/CHANGELOG.md ADDED
@@ -0,0 +1,49 @@
1
+ # Installation & Update
2
+
3
+ To install or update cocoapods-patch see [README](https://github.com/DoubleSymmetry/cocoapods-patch).
4
+
5
+ ## Master
6
+
7
+ ##### Enhancements
8
+
9
+ * None.
10
+
11
+ ##### Bug Fixes
12
+
13
+ * None.
14
+
15
+ ## 1.0.2 (6.12.21)
16
+
17
+ ##### Enhancements
18
+
19
+ * None.
20
+
21
+ ##### Bug Fixes
22
+
23
+ * Revert to previous way of applying patches. There's a bug in Cocoapods that does not call hooks.
24
+
25
+ ## 1.0.1 (2.11.21)
26
+
27
+ ##### Enhancements
28
+
29
+ * Change name of generated patch files to include pod version used
30
+ [dcvz](https://github.com/dcvz)
31
+
32
+ * Use lockfile to use more correct installation of fresh dependencies.
33
+ [dcvz](https://github.com/dcvz)
34
+
35
+ ##### Bug Fixes
36
+
37
+ * None.
38
+
39
+ ## 1.0.0 (1.11.21)
40
+
41
+ ##### Enhancements
42
+
43
+ * Use official pre_integrate hook
44
+ [dcvz](https://github.com/dcvz)
45
+ [#7](https://github.com/DoubleSymmetry/cocoapods-patch/pull/7)
46
+
47
+ ##### Bug Fixes
48
+
49
+ * None.
data/README.md CHANGED
@@ -15,6 +15,16 @@ Next, add a `plugin 'cocoapods-patch'` line to your Podfile to use the plugin. T
15
15
 
16
16
  That's it, you're done.
17
17
 
18
+ **NOTE:**
19
+ `cocoapods-patch` version 1.0.0 and above require you to use Cocoapods 1.11.0 or greater.
20
+ For anything below that please use version 0.0.9.
21
+
22
+ ## Migrating to v1.0.1+
23
+
24
+ In v1.0.1 of the plugin we've changed the naming scheme of the generated patch files to also include the version of the pods used to generate the patches. This will allow us to do more automation safety and make sure patches are applied successfully.
25
+
26
+ We've added a new command to help with the migration. After updating before doing a `pod install` please first run `pod patch migrate` which will translate any existing patches into their new format. This will use the current version of the pods stated in your lockfile.
27
+
18
28
  ## Usage
19
29
 
20
30
  ### Creating a patch
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPatch
2
- VERSION = "0.0.8"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -37,7 +37,7 @@ def apply_patch(patch_file)
37
37
  directory_arg = (ios_project_path.to_s.eql? ".") ? "Pods" : File.join(ios_project_path, 'Pods')
38
38
 
39
39
  Dir.chdir(repo_root) {
40
- check_cmd = "git apply --check #{patch_file} --directory=#{directory_arg} -p2 2> /dev/null"
40
+ check_cmd = "git apply --check '#{patch_file}' --directory='#{directory_arg}' -p2 2> /dev/null"
41
41
 
42
42
  can_apply = system(check_cmd)
43
43
  if can_apply
@@ -36,7 +36,7 @@ module Pod
36
36
 
37
37
  Dir.mktmpdir('cocoapods-patch-', config.project_root) do |work_dir|
38
38
  sandbox = Pod::Sandbox.new(work_dir)
39
- installer = Pod::Installer.new(sandbox, config.podfile)
39
+ installer = Pod::Installer.new(sandbox, config.podfile, config.lockfile)
40
40
  installer.clean_install = true
41
41
 
42
42
  installer.prepare
@@ -58,7 +58,7 @@ module Pod
58
58
  UI.puts "Creating patch"
59
59
  theirs = Pathname.new(work_dir).join(@name).relative_path_from(config.project_root)
60
60
  ours = config.project_pods_root.join(@name).relative_path_from(config.project_root)
61
- gen_diff_cmd = "git diff --no-index #{theirs} #{ours} > #{patch_file}"
61
+ gen_diff_cmd = "git diff --no-index '#{theirs}' '#{ours}' > '#{patch_file}'"
62
62
 
63
63
  did_succeed = system(gen_diff_cmd)
64
64
  if not did_succeed.nil?
@@ -0,0 +1,44 @@
1
+ require 'pathname'
2
+
3
+ module Pod
4
+ class Command
5
+ class Patch < Command
6
+ class Migrate < Patch
7
+ self.description = <<-DESC
8
+ Migrates previous patch files to the new format.
9
+ DESC
10
+
11
+ def clear_patches_folder_if_empty
12
+ if Dir.empty?(patches_path)
13
+ FileUtils.remove_dir(patches_path)
14
+ end
15
+ end
16
+
17
+ def run
18
+ UI.puts 'Migrating patches...'
19
+ patches_dir = Pathname.new(Dir.pwd) + 'patches'
20
+ if patches_dir.directory?
21
+ patches = patches_dir.each_child.select { |c| c.to_s.end_with?('.diff') }
22
+ patches.each do |p|
23
+ # check if patch file has new format
24
+ if p.to_s.include?('+')
25
+ # do nothing
26
+ else
27
+ # rename patch file
28
+ pod_name = p.basename('.diff').to_s
29
+ UI.puts "Renaming #{pod_name}"
30
+
31
+ pod_version = config.lockfile.version(pod_name)
32
+ new_patch_name = p.to_s.gsub('.diff', "+#{pod_version}.diff")
33
+
34
+ File.rename(p, new_patch_name)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+
@@ -8,7 +8,8 @@ module Pod
8
8
  self.summary = 'Create & apply patches to Pods.'
9
9
 
10
10
  def patch_file
11
- config.project_root + 'patches' + "#{@name}.diff"
11
+ version = config.lockfile.version(@name)
12
+ return config.project_root + 'patches' + "#{@name}+#{version}.diff"
12
13
  end
13
14
 
14
15
  def patches_path
data/lib/pod/command.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require_relative 'command/patch'
2
2
  require_relative 'command/patch/apply'
3
3
  require_relative 'command/patch/create'
4
+ require_relative 'command/patch/migrate'
data/lib/pod/hook.rb CHANGED
@@ -34,10 +34,20 @@ class Pod::Installer
34
34
 
35
35
  def apply_patches
36
36
  Pod::UI.puts 'Applying patches if necessary'
37
- patches_dir = Pathname.new(Dir.pwd) + 'patches'
38
- if patches_dir.directory?
39
- patches = patches_dir.each_child.select { |c| c.to_s.end_with?('.diff') }
40
- patches.each { |p| apply_patch(p) }
41
- end
37
+ patches_dir = Pathname.new(Dir.pwd) + 'patches'
38
+ if patches_dir.directory?
39
+ patches = patches_dir.each_child.select { |c| c.to_s.end_with?('.diff') }
40
+ patches.each do |p|
41
+ pod_name = File.basename(p, ".diff")
42
+ # check if patch is in new format otherwise warn user
43
+ unless p.to_s.include?('+')
44
+ Pod::UI.puts "WARNING: #{pod_name}.diff has an old naming format. Please run pod patch migration first before pod install. See the README for more information.".yellow
45
+ end
46
+
47
+ apply_patch(p)
48
+ end
49
+ end
42
50
  end
43
51
  end
52
+
53
+
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Double Symmetry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-24 00:00:00.000000000 Z
11
+ date: 2021-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: cocoapods
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
19
+ version: 1.11.0
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: 1.11.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '13.0'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '13.0'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.9'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.9'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: cocoapods
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :runtime
61
+ version: '3.9'
62
+ type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '3.9'
69
69
  description: Create & apply patches to Pods
70
70
  email:
71
71
  - dev@doublesymmetry.com
@@ -73,6 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - CHANGELOG.md
76
77
  - README.md
77
78
  - lib/cocoapods_patch.rb
78
79
  - lib/cocoapods_plugin.rb
@@ -80,6 +81,7 @@ files:
80
81
  - lib/pod/command/patch.rb
81
82
  - lib/pod/command/patch/apply.rb
82
83
  - lib/pod/command/patch/create.rb
84
+ - lib/pod/command/patch/migrate.rb
83
85
  - lib/pod/hook.rb
84
86
  homepage: https://github.com/DoubleSymmetry/cocoapods-patch
85
87
  licenses: