cocoapods-modularization 0.3.2 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ef233aa5cb35dabcfdb1c5d73bfd39873a2426b53c8f43067b998a2696808ec
4
- data.tar.gz: 63e4b092e68e900beded3b7539ad0cdc0f1d81dfad1b1fbe5661a4699b2ec4f0
3
+ metadata.gz: 42d014222c41482f1b2df08d7311a46239f4568f2e909543b846b60727b334b6
4
+ data.tar.gz: 18c9f07033eab5f6fa81c44f850b97dc66cb5fa87489a8d9cb444e354e856f07
5
5
  SHA512:
6
- metadata.gz: 17ff2f5a7b32612c1c2b9811a6ab6a17433b5412dbd231f2067a5d6f80d24b5c1fc28b612b38fb14e7fa3b24948ea92c5c397cc7fc8d423df13f199fd7b2c96a
7
- data.tar.gz: 762caf19c7f6e5bb6a0fd148caa99f0d5ce0794cd16e43b9df8f0e6c9618938306917e81b7f560d32f53e73264712c74b601cd1e4a7808a8380c5378c24dcbcf
6
+ metadata.gz: 1a2e5f5b3c43a60595a8e5343768a5d4ba08e72b619a66345d80cf3d0bd94f5e5147885454c254bf2a6b7467da81b673f1c71f312fa39180e3f8e83600fda851
7
+ data.tar.gz: 025aacca5b1f552e251ca79adc5549779b2aeaa4e8e5c7c5f9a740929da6b0a6b1671a03d2775cb7f199509d9cfc374e765a010c5f7462935ec5c3deca6ddf88
@@ -1,5 +1,6 @@
1
1
  require 'cocoapods-modularization/meta'
2
2
  require 'fileutils'
3
+ require 'yaml'
3
4
 
4
5
  module Pod
5
6
  class Command
@@ -38,7 +39,8 @@ module Pod
38
39
  ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
39
40
  'applies to projects that have enabled incremental installation'],
40
41
  ['--enable-branch', 'Enable branch dependency'],
41
- ['--original', 'Run pod install ignore cocoapods-modularization']
42
+ ['--original', 'Run pod install ignore cocoapods-modularization'],
43
+ ['--sync', 'Run pod install and sync all local dependencies according with branch_cache.yml']
42
44
  ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
43
45
  end
44
46
 
@@ -48,6 +50,7 @@ module Pod
48
50
  @clean_install = argv.flag?('clean-install', false)
49
51
  @enable_branch = argv.flag?('enable-branch', false)
50
52
  @original = argv.flag?('original', false)
53
+ @sync = argv.flag?('sync', false)
51
54
  end
52
55
 
53
56
  def run
@@ -56,6 +59,10 @@ module Pod
56
59
  FileUtils.rm_rf('Podfile.lock')
57
60
  end
58
61
 
62
+ if @sync
63
+ sync_local_dependencies
64
+ end
65
+
59
66
  unless @original
60
67
  begin
61
68
  Meta::MetaReference.encode_podfile(@enable_branch)
@@ -104,6 +111,39 @@ module Pod
104
111
  end
105
112
  end
106
113
 
114
+ def sync_local_dependencies
115
+ return unless File.exist?(Meta::MetaConstants.branch_cache_path)
116
+ branch_cache_hash = YAML.load_file(Meta::MetaConstants.branch_cache_path)
117
+ return unless branch_cache_hash.kind_of?(Hash)
118
+
119
+ podfile_hash = YAML.load_file(Meta::MetaConstants.podfile_local_path)
120
+ return unless podfile_hash.kind_of?(Hash)
121
+
122
+ branch_cache_hash.each do |key, value|
123
+ local_data_hash = podfile_hash[key]
124
+ next unless local_data_hash.kind_of?(Hash)
125
+ git = value[Meta::MetaConstants.git_key]
126
+ next unless git.kind_of?(String)
127
+ branch = value[Meta::MetaConstants.branch_key]
128
+ next unless branch.kind_of?(String)
129
+ local_path = local_data_hash[Meta::MetaConstants.local_path_key]
130
+ next unless local_path.kind_of?(String)
131
+
132
+ puts "Start checkout #{key}, git: #{git}, branch: #{branch}, local_path: #{local_path}"
133
+ `git -C #{local_path} checkout #{branch}`
134
+ end
135
+
136
+ podfile_hash.each do |key, value|
137
+ local_path = value[Meta::MetaConstants.local_path_key]
138
+ next unless local_path.kind_of?(String)
139
+
140
+ if branch_cache_hash.has_key?(key)
141
+ Meta::MetaAccessor.set_local_path(key, local_path)
142
+ else
143
+ Meta::MetaAccessor.remove_local_path(key)
144
+ end
145
+ end
146
+ end
107
147
  end
108
148
  end
109
149
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsModularization
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -12,12 +12,12 @@ module Pod
12
12
  end
13
13
 
14
14
  def git
15
- git = `git -C #{@path} remote get-url origin`.lines.to_a.first
15
+ git = `git -C #{@path} remote get-url origin`
16
16
  git.strip if git
17
17
  end
18
18
 
19
19
  def branch
20
- branch = `git -C #{@path} rev-parse --abbrev-ref HEAD`.lines.to_a.first
20
+ branch = `git -C #{@path} rev-parse --abbrev-ref HEAD`
21
21
  branch.strip if branch
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-modularization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lazy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-27 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler