cocoapods-fy-bin 0.0.4 → 0.0.5
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 +4 -4
- data/lib/cocoapods-fy-bin/command/bin/archive.rb +2 -2
- data/lib/cocoapods-fy-bin/command/bin/auto.rb +2 -2
- data/lib/cocoapods-fy-bin/config/config.rb +14 -21
- data/lib/cocoapods-fy-bin/config/config_asker.rb +1 -1
- data/lib/cocoapods-fy-bin/config/config_builder.rb +2 -1
- data/lib/cocoapods-fy-bin/gem_version.rb +1 -1
- data/lib/cocoapods-fy-bin/helpers/build_helper.rb +4 -3
- data/lib/cocoapods-fy-bin/helpers/remote_helper.rb +44 -0
- data/lib/cocoapods-fy-bin/helpers/spec_source_creator.rb +2 -1
- data/lib/cocoapods-fy-bin/helpers/upload_helper.rb +17 -14
- data/lib/cocoapods-fy-bin/native/podfile.rb +4 -5
- data/lib/cocoapods-fy-bin/source_provider_hook.rb +2 -2
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7374e2f9c342f5e3d244eb1f16b40e7d51eba73404c9f580e514788c1eec74d
|
4
|
+
data.tar.gz: f689aff47091bc47316d37b464913e6fdc09589167ba07d6b12fbedf773f3d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74f1bde47198d2147a7cc638344dd962bd17deef18cfa02d9ab9d35756bd37cbe73086e1a963d99234da35d0b8de1b702c9c3d312151d81c5fcfdde1eba845ae
|
7
|
+
data.tar.gz: a4ec90337c36906530be7a64c1d15072be17872d6bfc44bad7a7e275597703e191e2e435aecb4698271b8e609985078f5c16b3de79f471a408bb8dfc015b9d25
|
@@ -30,7 +30,7 @@ module Pod
|
|
30
30
|
['--framework-output', '输出framework文件'],
|
31
31
|
['--no-zip', '不压缩静态库 为 zip'],
|
32
32
|
['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
|
33
|
-
['--env', "该组件上传的环境 %w[
|
33
|
+
['--env', "该组件上传的环境 %w[debug release]"],
|
34
34
|
['--archs', "需要二进制组件的架构"]
|
35
35
|
].concat(Pod::Command::Gen.options).concat(super).uniq
|
36
36
|
end
|
@@ -40,7 +40,7 @@ module Pod
|
|
40
40
|
]
|
41
41
|
|
42
42
|
def initialize(argv)
|
43
|
-
@env = argv.option('env') || '
|
43
|
+
@env = argv.option('env') || 'debug'
|
44
44
|
CBin.config.set_configuration_env(@env)
|
45
45
|
UI.warn "====== cocoapods-fy-bin #{CBin::VERSION} 版本 ======== \n "
|
46
46
|
UI.warn "====== #{@env} 环境 ======== \n "
|
@@ -20,14 +20,14 @@ module Pod
|
|
20
20
|
['--no-zip', '不压缩静态 framework 为 zip'],
|
21
21
|
['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
|
22
22
|
['--configuration', 'Build the specified configuration (e.g. Release ). Defaults to Debug'],
|
23
|
-
['--env', "该组件上传的环境 %w[
|
23
|
+
['--env', "该组件上传的环境 %w[debug release]"],
|
24
24
|
['--archs', "需要二进制组件的架构"]
|
25
25
|
].concat(Pod::Command::Gen.options).concat(super).uniq
|
26
26
|
end
|
27
27
|
|
28
28
|
def initialize(argv)
|
29
29
|
|
30
|
-
@env = argv.option('env') || '
|
30
|
+
@env = argv.option('env') || 'release'
|
31
31
|
CBin.config.set_configuration_env(@env)
|
32
32
|
@podspec = argv.shift_argument
|
33
33
|
@specification = Specification.from_file(@podspec)
|
@@ -11,39 +11,37 @@ module CBin
|
|
11
11
|
|
12
12
|
def template_hash
|
13
13
|
{
|
14
|
-
'configuration_env' => { description: '编译环境', default: '
|
15
|
-
'code_repo_url' => { description: '源码私有源 Git 地址', default: '
|
16
|
-
'binary_repo_url' => { description: '二进制私有源 Git 地址', default: '
|
17
|
-
'binary_download_url' => { description: '
|
14
|
+
'configuration_env' => { description: '编译环境', default: 'debug', selection: %w[debug release] },
|
15
|
+
'code_repo_url' => { description: '源码私有源 Git 地址', default: 'https://gitlab.fuyoukache.com/iosThird/swiftThird/FYSwiftSpecs.git' },
|
16
|
+
'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'https://gitlab.fuyoukache.com/binaryThirdDemo/FYBinarySpecs.git' },
|
17
|
+
'binary_download_url' => { description: '二进制下载主机地址,内部会依次传入组件名称、版本、打包模式', default: 'https://mobilepods.fuyoukache.com' },
|
18
18
|
# 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
|
19
19
|
'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] }
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
23
|
def config_file_with_configuration_env(configuration_env)
|
24
|
-
file =
|
25
|
-
if configuration_env == "
|
24
|
+
file = config_debug_iphoneos_file
|
25
|
+
if configuration_env == "release"
|
26
26
|
file = config_release_iphoneos_file
|
27
27
|
puts "\n====== #{configuration_env} 环境 ========"
|
28
|
-
elsif configuration_env == "
|
28
|
+
elsif configuration_env == "debug"
|
29
29
|
file = config_debug_iphoneos_file
|
30
30
|
puts "\n====== #{configuration_env} 环境 ========"
|
31
|
-
elsif configuration_env == "dev"
|
32
|
-
puts "\n====== #{configuration_env} 环境 ========"
|
33
31
|
else
|
34
|
-
raise "\n===== #{configuration_env} 参数有误,请检查%w[
|
32
|
+
raise "\n===== #{configuration_env} 参数有误,请检查%w[debug release]===="
|
35
33
|
end
|
36
34
|
|
37
35
|
File.expand_path("#{Pod::Config.instance.home_dir}/#{file}")
|
38
36
|
end
|
39
37
|
|
40
38
|
def configuration_env
|
41
|
-
#如果是
|
42
|
-
if @configuration_env == "
|
39
|
+
#如果是debug 再去 podfile的配置文件中获取,确保是正确的, pod update时会用到
|
40
|
+
if @configuration_env == "debug" || @configuration_env == nil
|
43
41
|
if Pod::Config.instance.podfile
|
44
42
|
configuration_env ||= Pod::Config.instance.podfile.configuration_env
|
45
43
|
end
|
46
|
-
configuration_env ||= "
|
44
|
+
configuration_env ||= "debug"
|
47
45
|
@configuration_env = configuration_env
|
48
46
|
end
|
49
47
|
@configuration_env
|
@@ -51,8 +49,7 @@ module CBin
|
|
51
49
|
|
52
50
|
#上传的url
|
53
51
|
def binary_upload_url
|
54
|
-
|
55
|
-
binary_download_url[0,binary_download_url.length - cut_string.length]
|
52
|
+
binary_download_url
|
56
53
|
end
|
57
54
|
|
58
55
|
def set_configuration_env(env)
|
@@ -61,15 +58,11 @@ module CBin
|
|
61
58
|
|
62
59
|
#包含arm64 armv7架构,xcodebuild 是Debug模式
|
63
60
|
def config_debug_iphoneos_file
|
64
|
-
"
|
61
|
+
"bin_debug.yml"
|
65
62
|
end
|
66
63
|
#包含arm64 armv7架构,xcodebuild 是Release模式
|
67
64
|
def config_release_iphoneos_file
|
68
|
-
"
|
69
|
-
end
|
70
|
-
#包含x86 arm64 armv7架构,xcodebuild 是Release模式
|
71
|
-
def config_dev_file
|
72
|
-
"bin_dev.yml"
|
65
|
+
"bin_release.yml"
|
73
66
|
end
|
74
67
|
|
75
68
|
def sync_config(config)
|
@@ -42,7 +42,7 @@ module CBin
|
|
42
42
|
|
43
43
|
开始设置二进制化初始信息.
|
44
44
|
所有的信息都会保存在 #{CBin.config.config_file} 文件中.
|
45
|
-
%w[
|
45
|
+
%w[bin_debug.yml bin_release.yml]
|
46
46
|
你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
|
47
47
|
|
48
48
|
#{CBin.config.default_config.to_yaml}
|
@@ -90,7 +90,7 @@ module CBin
|
|
90
90
|
|
91
91
|
def zip_static_library
|
92
92
|
Dir.chdir(zip_dir) do
|
93
|
-
output_library = "
|
93
|
+
output_library = "file.zip"
|
94
94
|
unless File.exist?(library_name)
|
95
95
|
raise Informative, "没有需要压缩的 library 文件:#{library_name}"
|
96
96
|
end
|
@@ -111,7 +111,7 @@ module CBin
|
|
111
111
|
FileUtils.rm_rf(framework_name) if @zip
|
112
112
|
FileUtils.rm_rf(library_name)
|
113
113
|
FileUtils.rm_rf(framework_name) unless @framework_output
|
114
|
-
FileUtils.rm_rf("
|
114
|
+
FileUtils.rm_rf("file.zip") unless @framework_output
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
@@ -124,7 +124,8 @@ module CBin
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def framework_name_zip
|
127
|
-
CBin::Config::Builder.instance.framework_name_version(@spec) + ".zip"
|
127
|
+
# CBin::Config::Builder.instance.framework_name_version(@spec) + ".zip"
|
128
|
+
"file.zip"
|
128
129
|
end
|
129
130
|
|
130
131
|
def library_name
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
module CBin
|
4
|
+
class Remote
|
5
|
+
class Helper
|
6
|
+
def initialize
|
7
|
+
@base_url = CBin.config.binary_upload_url
|
8
|
+
end
|
9
|
+
|
10
|
+
def exist?(name, version, tag)
|
11
|
+
uri = URI.join @base_url, "/frameworks/exit/#{name}/#{version}/#{tag}"
|
12
|
+
resp = RestClient.get(uri.to_s)
|
13
|
+
json = JSON.parse(resp.body)
|
14
|
+
json["data"]
|
15
|
+
end
|
16
|
+
|
17
|
+
def delete(name, version, tag)
|
18
|
+
uri = URI.join @base_url, "/frameworks/#{name}/#{version}/#{tag}"
|
19
|
+
resp = RestClient.delete uri.to_s
|
20
|
+
json = JSON.parse(resp.body)
|
21
|
+
json["status"]['code'] == 0
|
22
|
+
end
|
23
|
+
|
24
|
+
def upload(name, version, tag, file)
|
25
|
+
uri = URI.join @base_url, "/frameworks"
|
26
|
+
resp = RestClient.post(uri.to_s, {
|
27
|
+
file: File.new(file, 'rb'),
|
28
|
+
name: name,
|
29
|
+
version: version,
|
30
|
+
tag: tag
|
31
|
+
})
|
32
|
+
json = JSON.parse(resp.body)
|
33
|
+
@base_url + json["data"]['download_url']
|
34
|
+
end
|
35
|
+
|
36
|
+
def download_url(name, version, tag)
|
37
|
+
uri = URI.join @base_url, "/frameworks/#{name}/#{version}/#{tag}"
|
38
|
+
resp = RestClient.get uri.to_s
|
39
|
+
json = JSON.parse(resp.body)
|
40
|
+
@base_url + json["data"]['download_url']
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -99,6 +99,7 @@ module CBin
|
|
99
99
|
# spec_hash.delete('vendored_libraries')
|
100
100
|
# libraries 只能假设为动态库不做处理了,如果有例外,需要开发者自行处理
|
101
101
|
spec_hash.delete('vendored_libraries')
|
102
|
+
spec_hash.delete('vendored_library')
|
102
103
|
|
103
104
|
# vendored_libraries = Array(vendored_libraries).reject { |l| l.end_with?('.a') }
|
104
105
|
# if vendored_libraries.any?
|
@@ -186,7 +187,7 @@ module CBin
|
|
186
187
|
|
187
188
|
|
188
189
|
def binary_source
|
189
|
-
{ http:
|
190
|
+
{ http: "#{CBin.config.binary_download_url}/frameworks/download/#{code_spec.root.name}/#{code_spec.version}/#{CBin.config.configuration_env}/file.zip", type: CBin.config.download_file_type }
|
190
191
|
end
|
191
192
|
|
192
193
|
def code_spec_consumer(_platform = :ios)
|
@@ -9,6 +9,7 @@ require 'cocoapods-fy-bin/helpers/framework_builder'
|
|
9
9
|
require 'cocoapods-fy-bin/helpers/library_builder'
|
10
10
|
require 'cocoapods-fy-bin/helpers/sources_helper'
|
11
11
|
require 'cocoapods-fy-bin/command/bin/spec/push'
|
12
|
+
require 'cocoapods-fy-bin/helpers/remote_helper'
|
12
13
|
|
13
14
|
module CBin
|
14
15
|
class Upload
|
@@ -19,10 +20,11 @@ module CBin
|
|
19
20
|
@spec = spec
|
20
21
|
@code_dependencies = code_dependencies
|
21
22
|
@sources = sources
|
23
|
+
@remote_helper = CBin::Remote::Helper.new
|
22
24
|
end
|
23
25
|
|
24
26
|
def upload
|
25
|
-
|
27
|
+
del_zip
|
26
28
|
Dir.chdir(CBin::Config::Builder.instance.root_dir) do
|
27
29
|
# 创建binary-template.podsepc
|
28
30
|
# 上传二进制文件
|
@@ -43,28 +45,29 @@ module CBin
|
|
43
45
|
spec_creator.filename
|
44
46
|
end
|
45
47
|
|
46
|
-
|
48
|
+
# 如果存在相同的版本号先删除组件二进制
|
49
|
+
def del_zip
|
47
50
|
print <<EOF
|
48
|
-
删除已上传的二进制文件
|
49
|
-
curl -v -X DELETE "#{CBin.config.binary_upload_url}/#{@spec.name}/#{@spec.version}"
|
51
|
+
删除已上传的二进制文件 #{@spec.name} #{@spec.version} #{CBin.config.configuration_env}
|
50
52
|
EOF
|
51
|
-
|
53
|
+
result = @remote_helper.exist?(@spec.name, @spec.version, CBin.config.configuration_env)
|
54
|
+
if result
|
55
|
+
print <<EOF
|
56
|
+
删除中
|
57
|
+
EOF
|
58
|
+
@remote_helper.delete(@spec.name, @spec.version, CBin.config.configuration_env)
|
59
|
+
end
|
52
60
|
end
|
61
|
+
|
53
62
|
#推送二进制
|
54
|
-
# curl http://ci.xxx:9192/frameworks -F "name=IMYFoundation" -F "version=7.7.4.2" -F "annotate=IMYFoundation_7.7.4.2_log" -F "file=@bin_zip/bin_IMYFoundation_7.7.4.2.zip"
|
55
63
|
def curl_zip
|
56
|
-
zip_file =
|
64
|
+
zip_file = CBin::Config::Builder.instance.framework_zip_file(@spec)
|
57
65
|
res = File.exist?(zip_file)
|
58
|
-
unless res
|
59
|
-
zip_file = CBin::Config::Builder.instance.framework_zip_file(@spec) + ".zip"
|
60
|
-
res = File.exist?(zip_file)
|
61
|
-
end
|
62
66
|
if res
|
63
67
|
print <<EOF
|
64
|
-
上传二进制文件
|
65
|
-
curl #{CBin.config.binary_upload_url} -F "name=#{@spec.name}" -F "version=#{@spec.version}" -F "annotate=#{@spec.name}_#{@spec.version}_log" -F "file=@#{zip_file}"
|
68
|
+
上传二进制文件 #{@spec.name} #{@spec.version} #{CBin.config.configuration_env}
|
66
69
|
EOF
|
67
|
-
|
70
|
+
@remote_helper.upload(@spec.name, @spec.version, CBin.config.configuration_env, zip_file) if res
|
68
71
|
end
|
69
72
|
|
70
73
|
res
|
@@ -28,11 +28,10 @@ module Pod
|
|
28
28
|
set_internal_hash_value(USE_SOURCE_PODS, hash_pods_use_source)
|
29
29
|
end
|
30
30
|
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# 2 release_iphoneos
|
31
|
+
# 1 debug
|
32
|
+
# 2 release
|
34
33
|
# 需要在podfile_env 先定义 CONFIGURATION_ENV
|
35
|
-
def set_configuration_env(env = "
|
34
|
+
def set_configuration_env(env = "debug")
|
36
35
|
set_internal_hash_value(CONFIGURATION_ENV, env)
|
37
36
|
end
|
38
37
|
end
|
@@ -66,7 +65,7 @@ module Pod
|
|
66
65
|
end
|
67
66
|
|
68
67
|
def configuration_env
|
69
|
-
get_internal_hash_value(CONFIGURATION_ENV, "
|
68
|
+
get_internal_hash_value(CONFIGURATION_ENV, "release") || ENV[CONFIGURATION_ENV] == "release"
|
70
69
|
end
|
71
70
|
|
72
71
|
private
|
@@ -8,8 +8,8 @@ Pod::HooksManager.register('cocoapods-fy-bin', :pre_install) do |_context, _|
|
|
8
8
|
# pod bin repo update 更新二进制私有源
|
9
9
|
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
|
10
10
|
|
11
|
-
# 有插件/本地库 且是
|
12
|
-
if _context.podfile.plugins.keys.include?('cocoapods-fy-bin') && _context.podfile.configuration_env == '
|
11
|
+
# 有插件/本地库 且是debug环境下,默认进入源码白名单 过滤 archive命令
|
12
|
+
if _context.podfile.plugins.keys.include?('cocoapods-fy-bin') && _context.podfile.configuration_env == 'debug'
|
13
13
|
dependencies = _context.podfile.dependencies
|
14
14
|
dependencies.each do |d|
|
15
15
|
# 组件存在external_source,并且external_source有值 并且external_source path不为空 且不为archive状态时 设置组件加载路径
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-fy-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.0.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.1.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.1.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,6 +132,7 @@ files:
|
|
118
132
|
- lib/cocoapods-fy-bin/helpers/framework_builder.rb
|
119
133
|
- lib/cocoapods-fy-bin/helpers/library.rb
|
120
134
|
- lib/cocoapods-fy-bin/helpers/library_builder.rb
|
135
|
+
- lib/cocoapods-fy-bin/helpers/remote_helper.rb
|
121
136
|
- lib/cocoapods-fy-bin/helpers/sources_helper.rb
|
122
137
|
- lib/cocoapods-fy-bin/helpers/spec_creator.rb
|
123
138
|
- lib/cocoapods-fy-bin/helpers/spec_files_helper.rb
|