cocoapods-patch 1.0.0 → 1.0.1

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: '09b3961ea67614d95650203463aa53b0e556e4630f52bc88a1d826670aa932db'
4
- data.tar.gz: 2bbd9aeedbf8912b991c7e83762b12c5b1ef4def1d2fc0af03a066126fd6569f
3
+ metadata.gz: 9f8a1091ce7f95d367d0fb5cdcdc01533bade7aa87c3750c03607ca0d0d6893b
4
+ data.tar.gz: 91ad3babdd2763618a7bedc0bb4186d63558df08c6bbc2a72453e4dcc2fbe555
5
5
  SHA512:
6
- metadata.gz: d973db22fe9a736b16df29b251cc3cd177ce6c7cac399f3f7f75ca55786776015e650fb680003c4376d144621c765c6eaca66d429e4eae8e00e86bcbea2f3bb9
7
- data.tar.gz: ee4054f9540888b48282e1275355658d17bf1b744dbe2f3ad725b53b4cf0a980085f49d34eb6815fdbf03484b92bb3e253669702bd6804b6ff50aefcd470e5d0
6
+ metadata.gz: 56c086ce0f18238fedb169377d9de115cf50a660d2d5356b78c9c973441fe79e30f98372fcce72242431afcbbe418ae95aaaa23f5986ba9bdbdf551f8a8843ba
7
+ data.tar.gz: 29cafa7c713700b5ff74a3c82ade35f20885d8411ee9a117be870e473ee60a8d4c58f377c0506ab9e2b4ef382734b1768c4318d65c930000008357178221749d
data/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  To install or update cocoapods-patch see [README](https://github.com/DoubleSymmetry/cocoapods-patch).
4
4
 
5
- ## Main
5
+ ## Master
6
6
 
7
7
  ##### Enhancements
8
8
 
@@ -12,6 +12,20 @@ To install or update cocoapods-patch see [README](https://github.com/DoubleSymme
12
12
 
13
13
  * None.
14
14
 
15
+ ## 1.0.1 (2.11.21)
16
+
17
+ ##### Enhancements
18
+
19
+ * Change name of generated patch files to include pod version used
20
+ [dcvz](https://github.com/dcvz)
21
+
22
+ * Use lockfile to use more correct installation of fresh dependencies.
23
+ [dcvz](https://github.com/dcvz)
24
+
25
+ ##### Bug Fixes
26
+
27
+ * None.
28
+
15
29
  ## 1.0.0 (1.11.21)
16
30
 
17
31
  ##### Enhancements
data/README.md CHANGED
@@ -17,7 +17,13 @@ That's it, you're done.
17
17
 
18
18
  **NOTE:**
19
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.5.
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.
21
27
 
22
28
  ## Usage
23
29
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPatch
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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
@@ -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
@@ -21,7 +21,15 @@ module CocoapodsPatch
21
21
  patches_dir = Pathname.new(Dir.pwd) + 'patches'
22
22
  if patches_dir.directory?
23
23
  patches = patches_dir.each_child.select { |c| c.to_s.end_with?('.diff') }
24
- patches.each { |p| apply_patch(p) }
24
+ patches.each do |p|
25
+ pod_name = File.basename(p, ".diff")
26
+ # check if patch is in new format otherwise warn user
27
+ unless p.to_s.include?('+')
28
+ 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
29
+ end
30
+
31
+ apply_patch(p)
32
+ end
25
33
  end
26
34
  end
27
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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-11-01 00:00:00.000000000 Z
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -81,6 +81,7 @@ files:
81
81
  - lib/pod/command/patch.rb
82
82
  - lib/pod/command/patch/apply.rb
83
83
  - lib/pod/command/patch/create.rb
84
+ - lib/pod/command/patch/migrate.rb
84
85
  - lib/pod/hook.rb
85
86
  homepage: https://github.com/DoubleSymmetry/cocoapods-patch
86
87
  licenses: