cocoapods-modularization 0.3.2 → 0.5.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56537d38322e4052df931fb49411ae622d97a11739ef53edc414bfc08e6f55c1
|
4
|
+
data.tar.gz: 52e5d74e0403f1b67438ff4cd6974f1d266a2204d751ab28b414aa8e3cf0a9dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da8df3c05c0b37d9fcae59445b52a24f53d2bd43f4aff04b096ff3b4260048e1fca9d444362436b35933c611d70cdf12e69d25b9ab412f87b920e8dd77a3ccf8
|
7
|
+
data.tar.gz: 5acc32106f62cce5c781012ebd3e28a49da5ea4776e826e39177c5b07cc69c8a3704ec4a9e131787070b19abbeab98127e66cda22977f06cefcdda7dd0de58c6
|
@@ -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
|
@@ -5,22 +5,13 @@ module Pod
|
|
5
5
|
class Mod < Command
|
6
6
|
class Template < Mod
|
7
7
|
|
8
|
-
self.summary = 'Fetch build.
|
8
|
+
self.summary = 'Fetch build.sh from remote'
|
9
9
|
|
10
10
|
self.description = <<-DESC
|
11
|
-
Fetch build.
|
11
|
+
Fetch build.sh from remote
|
12
12
|
DESC
|
13
13
|
|
14
|
-
def self.options
|
15
|
-
[
|
16
|
-
['--binary-only', '把framework推送到source和binary,一般用于三方库本地化'],
|
17
|
-
['--framework-only', '把Binary/*framework推送到source和binary,一般用于私有库']
|
18
|
-
].concat(super)
|
19
|
-
end
|
20
|
-
|
21
14
|
def initialize(argv)
|
22
|
-
@binary = argv.flag?('binary-only')
|
23
|
-
@framework = argv.flag?('framework-only')
|
24
15
|
super
|
25
16
|
end
|
26
17
|
|
@@ -29,7 +20,7 @@ module Pod
|
|
29
20
|
end
|
30
21
|
|
31
22
|
def run
|
32
|
-
build_path = "#{Dir.pwd}/build.
|
23
|
+
build_path = "#{Dir.pwd}/build.sh"
|
33
24
|
if File.exist?(build_path)
|
34
25
|
FileUtils.rm_rf(build_path)
|
35
26
|
end
|
@@ -41,13 +32,7 @@ module Pod
|
|
41
32
|
return
|
42
33
|
end
|
43
34
|
|
44
|
-
|
45
|
-
FileUtils.mv("#{Dir.pwd}/.build/Binary/binary_only.rb", "#{Dir.pwd}/build.rb")
|
46
|
-
elsif @framework
|
47
|
-
FileUtils.mv("#{Dir.pwd}/.build/Binary/framework_only.rb", "#{Dir.pwd}/build.rb")
|
48
|
-
else
|
49
|
-
FileUtils.mv("#{Dir.pwd}/.build/build.rb", "#{Dir.pwd}/build.rb")
|
50
|
-
end
|
35
|
+
FileUtils.mv("#{Dir.pwd}/.build/build.sh", "#{Dir.pwd}/build.sh")
|
51
36
|
FileUtils.rm_rf("#{Dir.pwd}/.build")
|
52
37
|
end
|
53
38
|
end
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module CocoapodsModularization
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
2
|
+
VERSION = "0.5.0"
|
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
|
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
|
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.
|
4
|
+
version: 0.5.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-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|