cocoapods-bb-bin 0.2.6.1 → 0.2.7

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: d1cdc1d9981ad04ed6d174e1234cf97946cf9053590c9626f2c39a552e89625c
4
- data.tar.gz: 5b201e5cc0bd349ce52fda0d423020f211172c05857a60341c764a7c89832f20
3
+ metadata.gz: a6d7ed2b021027dcd6f7ce5b5924e6527eae30107123250bff8bba761a5e5ec1
4
+ data.tar.gz: 9f7db13d3bdaecdf92aa5d41d3aaca05b543745ebcd9a6da729c45b9cfe93033
5
5
  SHA512:
6
- metadata.gz: 6fe18b6d92c6a1a4ab1bcfc46ace767a09a750e704f8008857dedae9c89f8fc8e903a4f3047f5cdb255680a374c194e14413f5af15990a4397ae630c244fc7f0
7
- data.tar.gz: b38737fc90cb2003468b66579a0f6c26d1f86c2f9602bd1109f55eba16fbcf02f471c28ebd9d4867f5ea38e1f9e77161a641279267106b34b1eee94f144aa55a
6
+ metadata.gz: 74f02d04acc23dc999f9bad0af3d4bd7c4073a18a7f997be946c025ae742340389d2b27959ac84ac210e59c39975fae353face18d0b9fd6cbc68f55258a7b189
7
+ data.tar.gz: 379aedee58963ceb87da4de8ac3d83627e00574b8f0a415e9ba3835276a7ec33dbed2489cfe868aa3a99246ee57c5a5348f932e78b3e727424436eecd1e14a4f
@@ -7,7 +7,7 @@ module Pod
7
7
  class Command
8
8
  class Bin < Command
9
9
  class Auto < Bin
10
- self.summary = '打开 workspace 工程.'
10
+ self.summary = '制作二进制组件库、podspec索引推送.'
11
11
 
12
12
  self.arguments = [
13
13
  CLAide::Argument.new('NAME.podspec', false)
@@ -4,7 +4,7 @@ module Pod
4
4
  class Command
5
5
  class Bin < Command
6
6
  class Code < Bin
7
- self.summary = '通过将二进制对应源码放置在临时目录中,让二进制出现断点时可以跳到对应的源码,方便调试。'
7
+ self.summary = '通过将二进制对应源码放置在临时目录中,让二进制出现断点时可以跳到对应的源码。切换源码调试 pod bin code <组件名称> -—source=<组件本地路径>'
8
8
 
9
9
  self.description = <<-DESC
10
10
  通过将二进制对应源码放置在临时目录中,让二进制出现断点时可以跳到对应的源码,方便调试。
@@ -0,0 +1,131 @@
1
+ require 'cocoapods-bb-bin/native/podfile'
2
+ require 'cocoapods/command/gen'
3
+ require 'cocoapods/generate'
4
+ require 'xcodeproj'
5
+ require 'cocoapods-bb-bin/helpers/push_spec_helper'
6
+ require 'cocoapods-bb-bin/helpers/build_helper'
7
+ require 'cocoapods-bb-bin/helpers/spec_source_creator'
8
+
9
+ module Pod
10
+ class Command
11
+ class Bin < Command
12
+ class LocalPush < Bin
13
+ self.summary = '本地推送,支持二进制文件上传.'
14
+
15
+ self.arguments = [
16
+ CLAide::Argument.new('NAME.podspec', false)
17
+ ]
18
+ def self.options
19
+ [
20
+ ['--sources', '私有源地址,多个用分号区分'],
21
+ ['--path', '(必传)需要上传文件路径'],
22
+ ['--vendored_framework_name', '(可选)组件库依赖framework名称,默认组件名称'],
23
+ ['--dylib', '(可选)是否动态库,默认静态库'],
24
+ ].concat(Pod::Command::Gen.options).concat(super).uniq
25
+ end
26
+
27
+ def initialize(argv)
28
+ @help = argv.flag?('help', false )
29
+ if @help
30
+ else
31
+ @env = argv.option('env') || 'dev'
32
+ CBin.config.set_configuration_env(@env)
33
+
34
+ @podspec = argv.shift_argument || find_podspec
35
+ @sources = argv.option('sources') || []
36
+ @localPath = argv.option('path') || nil
37
+ @vendored_framework_name = argv.option('vendored_framework_name') || nil
38
+ @is_dylib = argv.flag?('dylib', false )
39
+ end
40
+ super
41
+ end
42
+
43
+ def validate!
44
+ help! "未找到 podspec文件" unless @podspec
45
+ super
46
+ end
47
+
48
+ def run
49
+ # 配置二进制库环境,需要区分静态库还是动态库
50
+ isGenDylib = @is_dylib
51
+ sources_manager = Pod::Config.instance.sources_manager
52
+ sources_manager.initLibEnv(isGenDylib)
53
+ # 清除之前的缓存
54
+ CBin::Config::Builder.instance.clean
55
+ @spec = Specification.from_file(@podspec)
56
+ # 上传文件
57
+ localPath = update_uploadpath unless !@localPath
58
+ if File.file?(localPath)
59
+ # 生成podspec
60
+ sources_sepc = Array.new
61
+ sources_sepc << @spec
62
+
63
+ fail_push_specs = []
64
+ sources_sepc.uniq.each do |spec|
65
+ begin
66
+ fail_push_specs << spec unless CBin::Upload::Helper.new(spec,true,@sources,true).upload_binary_file(localPath, @is_dylib, @vendored_framework_name)
67
+ rescue Object => exception
68
+ UI.puts exception
69
+ fail_push_specs << spec
70
+ end
71
+ end
72
+
73
+ if fail_push_specs.any?
74
+ fail_push_specs.uniq.each do |spec|
75
+ UI.warn "【#{spec.name} | #{spec.version}】组件spec push失败 ."
76
+ end
77
+ end
78
+
79
+ success_specs = sources_sepc - fail_push_specs
80
+ if success_specs.any?
81
+ auto_success = ""
82
+ success_specs.uniq.each do |spec|
83
+ auto_success += "#{spec.name} | #{spec.version}\n"
84
+ UI.warn "===【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!! "
85
+ end
86
+ puts auto_success
87
+ ENV['auto_success'] = auto_success
88
+ end
89
+ #pod repo update
90
+ UI.section("\nUpdating Spec Repositories\n".yellow) do
91
+ Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
92
+ end
93
+ end
94
+ end
95
+
96
+ #Dir.glob 可替代
97
+ def find_podspec
98
+ name = nil
99
+ Pathname.pwd.children.each do |child|
100
+ # puts child
101
+ if File.file?(child)
102
+ if child.extname == '.podspec'
103
+ name = File.basename(child)
104
+ unless name.include?("binary-template")
105
+ return name
106
+ end
107
+ end
108
+ end
109
+ end
110
+ raise Informative, "podspec File no exist, please check" unless name
111
+ return name
112
+ end
113
+
114
+ def update_uploadpath
115
+ worksppace_path = Dir.pwd
116
+ path = @localPath
117
+ if File.absolute_path?(path) # 判断文件绝对路径
118
+ return path
119
+ else
120
+ path = File.join(worksppace_path, @localPath)
121
+ if File.absolute_path?(path)
122
+ return path
123
+ end
124
+ end
125
+ return nil
126
+ end
127
+
128
+ end
129
+ end
130
+ end
131
+ end
@@ -10,7 +10,7 @@ module Pod
10
10
  class Command
11
11
  class Bin < Command
12
12
  class Tag < Bin
13
- self.summary = '推送标签.'
13
+ self.summary = '同时支持推送源码/二进制标签.'
14
14
 
15
15
  self.arguments = [
16
16
  CLAide::Argument.new('NAME.podspec', false)
@@ -8,6 +8,7 @@ require 'cocoapods-bb-bin/command/bin/update'
8
8
  require 'cocoapods-bb-bin/command/bin/install'
9
9
  require 'cocoapods-bb-bin/command/bin/imy'
10
10
  require 'cocoapods-bb-bin/command/bin/tag'
11
+ require 'cocoapods-bb-bin/command/bin/localPush'
11
12
 
12
13
  require 'cocoapods-bb-bin/helpers'
13
14
 
@@ -36,7 +37,7 @@ module Pod
36
37
 
37
38
  self.abstract_command = true
38
39
 
39
- self.default_subcommand = 'open'
40
+ self.default_subcommand = 'auto'
40
41
  self.summary = '组件二进制化插件.'
41
42
  self.description = <<-DESC
42
43
  组件二进制化插件。利用源码私有源与二进制私有源实现对组件依赖类型的切换。
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.2.6.1'
3
+ VERSION = '0.2.7'
4
4
  end
5
5
 
6
6
  module Pod
@@ -19,13 +19,16 @@ module CBin
19
19
  raise Pod::Informative, '源码 podspec 不能为空 .' unless code_spec
20
20
  end
21
21
 
22
- def create
22
+ def create(frameworkName=nil)
23
23
  # spec = nil
24
24
  if CBin::Build::Utils.is_framework(@code_spec)
25
- Pod::UI::puts "make framework spec"
26
- spec = create_framework_from_code_spec
25
+ Pod::UI::puts "make framework spec. vendored_framework_name:#{frameworkName}"
26
+ if !frameworkName # 如果外部没有传入fk名称默认组件名称
27
+ frameworkName = code_spec.root.name
28
+ end
29
+ spec = create_framework_from_code_spec(frameworkName)
27
30
  else
28
- Pod::UI::puts "make source code spec"
31
+ Pod::UI::puts "make source code spec. vendored_framework_name:#{frameworkName}"
29
32
  spec = create_from_code_spec
30
33
  end
31
34
 
@@ -137,13 +140,13 @@ module CBin
137
140
  @spec
138
141
  end
139
142
 
140
- def create_framework_from_code_spec
143
+ def create_framework_from_code_spec(frameworkName)
141
144
  @spec = code_spec.dup
142
145
  # vendored_frameworks | resources | source | source_files | public_header_files
143
146
  # license | resource_bundles | vendored_libraries
144
147
 
145
148
  # Project Linkin
146
- @spec.vendored_frameworks = "#{code_spec.root.name}.{framework,xcframework}" # 支持framework、xcframework
149
+ @spec.vendored_frameworks = "#{frameworkName}.{framework,xcframework}" # 支持framework、xcframework
147
150
 
148
151
  # Resources
149
152
  extnames = []
@@ -23,37 +23,42 @@ module CBin
23
23
  end
24
24
 
25
25
  def upload(isGenDylib=false)
26
+ return upload_binary_file(own_source_binary_file, isGenDylib, @spec.name)
27
+ end
28
+
29
+ def upload_binary_file(zip_file, isGenDylib=false, vendored_framework_name=nil)
26
30
  Dir.chdir(CBin::Config::Builder.instance.root_dir) do
27
31
  # 创建binary-template.podsepc
28
32
  # 上传二进制文件
29
33
  # 上传二进制 podspec
30
- res_zip = curl_zip
31
- if res_zip
32
- filename = spec_creator
33
- Pod::UI.message "上传二进制 podspec: #{filename} 是否动态库: #{isGenDylib}"
34
+ isupload = binary_upload(zip_file)
35
+ if isupload
36
+ filename = spec_creator(vendored_framework_name)
37
+ Pod::UI.puts "上传二进制 podspec: #{filename} 是否动态库: #{isGenDylib} vendored_framework_name:#{vendored_framework_name}"
34
38
  push_helper = CBin::Push::Helper.new()
35
39
  push_helper.push_binary_repo(filename,isGenDylib)
36
40
  # 上传源码 podspec
37
41
  if @pushsourcespec
38
- Pod::UI.message "上传源码 podspec: #{@spec_creator.sourceSpecFilePath}"
42
+ Pod::UI.puts "上传源码 podspec: #{@spec_creator.sourceSpecFilePath}"
39
43
  push_helper.push_source_repo(@spec_creator.sourceSpecFilePath)
40
44
  end
41
45
  end
42
- res_zip
46
+ isupload
43
47
  end
44
48
  end
45
49
 
46
- def spec_creator
50
+ private
51
+ def spec_creator(vendored_framework_name=nil)
47
52
  spec_creator = CBin::SpecificationSource::Creator.new(@spec)
48
53
  @spec_creator = spec_creator
49
- spec_creator.create
54
+ spec_creator.create(vendored_framework_name)
50
55
  spec_creator.write_spec_file
51
56
  spec_creator.filename
52
57
  end
53
58
 
54
- #推送二进制
55
- # 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"
56
- def curl_zip
59
+ private
60
+ #推送源码组件库二进制文件
61
+ def own_source_binary_file
57
62
  # lib
58
63
  zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip"
59
64
  res = File.exist?(zip_file)
@@ -67,14 +72,23 @@ module CBin
67
72
  zip_file = CBin::Config::Builder.instance.xcframework_zip_file(@spec) + ".zip"
68
73
  res = File.exist?(zip_file)
69
74
  end
75
+ if res
76
+ return zip_file
77
+ end
78
+ return nil
79
+ end
80
+
81
+ # 上传二进制文件
82
+ private
83
+ def binary_upload(zip_file)
84
+ res = File.file?(zip_file)
70
85
  if res
71
86
  print <<EOF
72
- 上传二进制文件
87
+ 上传二进制文件: #{@spec.name} (#{@spec.version})
73
88
  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}"
74
89
  EOF
75
90
  `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}"` if res
76
91
  end
77
-
78
92
  res
79
93
  end
80
94
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bb-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.1
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-13 00:00:00.000000000 Z
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -70,7 +70,7 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: 0.2.6.1
73
+ version: 0.2.6.3
74
74
  - - "<"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '1.0'
@@ -80,7 +80,7 @@ dependencies:
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 0.2.6.1
83
+ version: 0.2.6.3
84
84
  - - "<"
85
85
  - !ruby/object:Gem::Version
86
86
  version: '1.0'
@@ -134,6 +134,7 @@ files:
134
134
  - lib/cocoapods-bb-bin/command/bin/initHotKey.rb
135
135
  - lib/cocoapods-bb-bin/command/bin/install.rb
136
136
  - lib/cocoapods-bb-bin/command/bin/lib/lint.rb
137
+ - lib/cocoapods-bb-bin/command/bin/localPush.rb
137
138
  - lib/cocoapods-bb-bin/command/bin/repo/push.rb
138
139
  - lib/cocoapods-bb-bin/command/bin/repo/update.rb
139
140
  - lib/cocoapods-bb-bin/command/bin/spec/create.rb
@@ -205,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
206
  - !ruby/object:Gem::Version
206
207
  version: '0'
207
208
  requirements: []
208
- rubygems_version: 3.4.16
209
+ rubygems_version: 3.4.14
209
210
  signing_key:
210
211
  specification_version: 4
211
212
  summary: cocoapods-bb-bin is a plugin which helps develpers switching pods between