cocoapods-util 0.0.12 → 0.0.15

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: 7a288d0cd86146de6d734f9a0f292db9bdda764e4e95b21b9b8ed0af38544a93
4
- data.tar.gz: a07465a12f9d5c800d9c6acb25c46394e59916349714d092140ccf874019aadc
3
+ metadata.gz: d3e136a04158a95c53ec3bf85971b13f137f85ad816633d64cf9655fca06234c
4
+ data.tar.gz: 32fd218bb662f121551dd394782a97691fee24c86d7105cf3d5c0f7d5a16275c
5
5
  SHA512:
6
- metadata.gz: ba53816980be856b40546b803f22d5d1bf081efd1d42e587095e6f20402d5bca4c4f9342e8fe8df37fbcd3500afdd1094cbb37e90884eb467ed0fb3ad2d9360e
7
- data.tar.gz: abf3a469e43499b1943ab01caf1620cd4e4067132936f9c5a6db98413d1e8eaf76a467e9df094692f0f6e98f602533509427d5e03d46d9fb70e9d3cc782565db
6
+ metadata.gz: 14561d493194c787d69f8749f30e14c57227f623a3954cf8017376a84544df4dbd23906e4041b3361211e31340cae48344ff4c0b61601bd02d9cb27db96bf07b
7
+ data.tar.gz: dc4fcb6c4dafd62b2b107d6f7d40f254b2544e91beeaaa9ca75296c2816c5af3b48c46f1dd44c9af622835a25db823f6eec9b606e57f87ec14535f1aad5c39c0
data/README.md CHANGED
@@ -1,20 +1,24 @@
1
- # cocoapods-util
1
+ ### **cocoapods-util是一个pod插件集合,集成了一些ios开发过程中提效的一些插件。**
2
2
 
3
- cocoapods-util是一个pod插件集合,支持package、生成xcframework、linksource、repo push等功能。
4
-
5
- ## Installation
3
+ # Installation
6
4
 
5
+ ```
7
6
  $ gem install cocoapods-util
7
+ ```
8
8
 
9
- ## Usage
9
+ # Usage
10
10
 
11
+ ```
11
12
  $ pod util --help
13
+ ```
12
14
 
13
- ## 功能
15
+ ![fde10974894037fe52660a72e4057929.png](./assets/fde10974894037fe52660a72e4057929.png)
14
16
 
15
- ### package
17
+ # 功能
16
18
 
17
- $ pod util package --help
19
+ ## package
20
+
21
+ ### 介绍
18
22
 
19
23
  通过podspec文件生成library、framework、xcframework。
20
24
 
@@ -23,32 +27,145 @@ $ pod util package --help
23
27
  - [x] 支持排除模拟器
24
28
  - [x] 支持多平台(ios、osx、watchos、tvos)
25
29
  - [x] 支持自定义设置工程的build settings(如:排除ios模拟器64位架构、设置支持的架构等)
26
-
27
30
 
28
- ###  xcframework
31
+ ```
32
+ $ pod util package --help
33
+ ```
34
+
35
+ ![74dd1a40ffa3af3744fdf79384fdebdb.png](./assets/74dd1a40ffa3af3744fdf79384fdebdb.png)
36
+
37
+ ### 示例
38
+
39
+ #### 生成xcfrmework/framework/library
40
+
41
+ 生成AFNetworking组件的xcframework 进入AFNetworking源码的根目录下,执行下面的命令
42
+
43
+ ```
44
+ $ pod util package AFNetworking.podspec --force --local --xcframework
45
+
46
+ $ pod util package AFNetworking.podspec --force --local --framework
47
+
48
+ $ pod util package AFNetworking.podspec --force --local --library
49
+ ```
50
+
51
+ ![d5410dda08a99ee977dd6ca8af98ef74.png](./assets/d5410dda08a99ee977dd6ca8af98ef74.png)
52
+
53
+ #### 排除模拟器
54
+
55
+ 如果你不需要编译模拟器架构,可以添加--exclude-sim
56
+
57
+ ```
58
+ $ pod util package AFNetworking.podspec --force --local --xcframework --exclude-sim
59
+ ```
60
+
61
+ #### 平台设置
62
+
63
+ 如果你只需要编译ios架构下的xcframework,可以添加--platforms=ios
64
+
65
+ ```
66
+ $ pod util package AFNetworking.podspec --force --local --xcframework --exclude-sim --platforms=ios
67
+ ```
68
+
69
+ #### build settings配置
70
+
71
+ 如果你想要做一些build settings特殊配置,可以添加 --build-settings,如设置编译选项排除模拟器arm64架构。理论上来讲,可以像直接操作工程一样,灵活的配置build settings
72
+
73
+ - 如设置排除arm64位架构
74
+
75
+ ```
76
+ $ --build-settings='{"EXCLUDED_ARCHS[sdk=iphonesimulator*]":"arm64"}'
77
+ ```
78
+
79
+ - 设置编译swift生成swiftinterface文件
80
+
81
+ ```
82
+ $ -build-settings='{"BUILD_LIBRARY_FOR_DISTRIBUTION":"YES"}'
83
+ ```
29
84
 
30
- $ pod util xcframework --help
85
+ - 或者你想设置多个编译选项
86
+
87
+ ```
88
+ $ -build-settings='{"EXCLUDED_ARCHS[sdk=iphonesimulator*]":"arm64","BUILD_LIBRARY_FOR_DISTRIBUTION":"YES","VALID_ARCHS":"arm64"}'
89
+ ```
90
+
91
+ #### 自定义dependencies
92
+
93
+ 如果你依赖的组件并没有发布到私有仓库,你只是分支依赖! 如果你依赖的组件和官方源有冲突,你改需要指定source源! 这时候你可以通过配置`--dependency-config={}`选项指定仓库分支、tag或指定source源。
94
+
95
+ ```
96
+ $ --dependency-config='{"PodA":{"git":"xxx","branch":"xxx"},"PodB":{"source":"xxx"}}'
97
+ ```
98
+
99
+ ## xcframework
100
+
101
+ ### 介绍
31
102
 
32
103
  可以把现有的framework生成xcframework。
33
104
 
34
105
  - 内部可以判断是某个平台的framework(如ios、osx、watchos),直接在framework同级目录生成xcframework。
35
106
 
36
- ### linksource
107
+ ![132d6cec7bc64488deca731d37438cdd.png](./assets/132d6cec7bc64488deca731d37438cdd.png)
108
+
109
+ ### 示例
110
+
111
+ 生成Alamofire的framework
112
+
113
+ ```
114
+ $ pod util xcframework Alamofire.framework --force
115
+ ```
116
+
117
+ ![e32ea9af2dfae1e3d6b03f0278c33057.png](./assets/e32ea9af2dfae1e3d6b03f0278c33057.png)
118
+
119
+ ![23332974a4941bae97010afb4b4d4c1c.png](./assets/23332974a4941bae97010afb4b4d4c1c.png)
120
+
121
+ ## linksource
37
122
 
123
+ 源码二进制链接功能。
124
+
125
+ ```
38
126
  $ pod util linksource --help
127
+ ```
128
+
129
+ ![b605570c681e5d7877f08458cfd1dbc7.png](./assets/b605570c681e5d7877f08458cfd1dbc7.png)
130
+
131
+ ## repo push
39
132
 
40
- 源码二进制链接功能
133
+ 推送私有pods仓库的命令。
41
134
 
42
- ### repo push
135
+ - 可以通过添加--skip-validate的选项跳过验证步骤。
43
136
 
137
+ ```
44
138
  $ pod util repo push --help
139
+ ```
45
140
 
46
- 推送私有pods仓库的命令
141
+ ![2947331da6ee0c269dbd6ea073d15d4e.png](./assets/2947331da6ee0c269dbd6ea073d15d4e.png)
47
142
 
48
- - 可以通过添加--skip-validate的选项跳过验证步骤。
143
+ 该命令是一个提效命令,在推送自己私有仓库的时候可以通过设置--skip-validate选项跳过验证直接推送到私有仓库。
144
+
145
+ ```
146
+ $ pod util repo push [yourSpecs] [xxx.podspec] --skip-validate
147
+ ```
49
148
 
50
- ### install list
149
+ 当然你也可以不使用--skip-validate,参数设置和`pod repo push`命令一致
51
150
 
151
+ ## install list
152
+
153
+ 列出安装的pod库及相关依赖信息。
154
+
155
+ - 该命令同样为提效命令,可以省去开发者自己去阅读Podfile.lock文件的时间,直接友好的提示开发者
156
+ - 可以清晰的看出引用的组件个数、组件依赖、组件分支tag信息、仓库地址等有效信息
157
+
158
+ ```
52
159
  $ pod util install list --help
160
+ ```
161
+
162
+ ![f839eae390ea7871a5afecec093dd39c.png](./assets/f839eae390ea7871a5afecec093dd39c.png)
163
+
164
+ 可以在Podfile.lock的同级目录下执行或指定Podfile.lock的路径
165
+
166
+ ```
167
+ $ pod util install list --showmore
168
+ $ pod util install list ~/Desktop/xxxx/ProjectA/Podfile.lock --showmore
169
+ ```
53
170
 
54
- 列出安装的pod库
171
+ ![3be13cd62a8450a7c8b2a3fa728984c6.png](./assets/3be13cd62a8450a7c8b2a3fa728984c6.png)
@@ -1,6 +1,52 @@
1
1
  module CocoapodsUtilHook
2
- Pod::HooksManager.register('cocoapods-util', :pre_install) do |context, _|
2
+ Pod::HooksManager.register('cocoapods-util', :pre_install) do |installer_context, _|
3
3
  puts "pre_install"
4
+ require_relative 'hooks/feature_switch'
5
+ if Pod.is_prebuild_stage
6
+ next
7
+ end
8
+
9
+ # [Check Environment]
10
+ podfile = installer_context.podfile
11
+ # podfile.target_definition_list.each do |target_definition|
12
+ # # next if target_definition.prebuild_framework_pod_names.empty?
13
+ # # if not target_definition.uses_frameworks?
14
+ # # STDERR.puts "[!] Cocoapods-binary requires `use_frameworks!`".red
15
+ # # exit
16
+ # # end
17
+ # end
18
+
19
+ require_relative 'hooks/prebuild_sandbox'
20
+
21
+ # 读取update和repo_update参数
22
+ update = nil
23
+ repo_update = nil
24
+ include ObjectSpace
25
+ ObjectSpace.each_object(Pod::Installer) { |installer|
26
+ update = installer.update
27
+ repo_update = installer.repo_update
28
+ }
29
+
30
+ # switches setting
31
+ Pod.is_prebuild_stage = true
32
+
33
+ # make another custom sandbox
34
+ standard_sandbox = installer_context.sandbox
35
+ prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
36
+
37
+ # get the podfile for prebuild
38
+ prebuild_podfile = Pod::Podfile.from_ruby(podfile.defined_in_file)
39
+
40
+ # install
41
+ lockfile = installer_context.lockfile
42
+ binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile, lockfile)
43
+
44
+ binary_installer.update = update
45
+ binary_installer.repo_update = repo_update
46
+ # binary_installer.install!
47
+
48
+ # reset switches setting
49
+ Pod.is_prebuild_stage = false
4
50
  end
5
51
  Pod::HooksManager.register('cocoapods-util', :pre_integrate) do |context, _|
6
52
  puts "pre_integrate"
@@ -14,5 +60,4 @@ module CocoapodsUtilHook
14
60
  Pod::HooksManager.register('cocoapods-util', :source_provider) do |context, _|
15
61
  puts "source_provider"
16
62
  end
17
- end
18
-
63
+ end
@@ -1,3 +1,4 @@
1
1
  require_relative 'repo'
2
2
  require_relative 'install.rb'
3
+ require_relative 'unique'
3
4
  # require File.expand_path('../install.rb', __FILE__)
@@ -1,5 +1,3 @@
1
- require 'cocoapods/config'
2
-
3
1
  module Pod
4
2
  class Command
5
3
  class Util < Command
@@ -8,7 +6,7 @@ module Pod
8
6
  self.summary = '列出pod install安装的组件信息,Podfile.lock不传则在当前目录查找'
9
7
  self.command = 'list'
10
8
  self.arguments = [
11
- CLAide::Argument.new('Podfile.lock', false)
9
+ CLAide::Argument.new('Podfile.lock', true)
12
10
  ]
13
11
  def self.options
14
12
  [
@@ -42,7 +40,11 @@ module Pod
42
40
  check_all_componment
43
41
  else
44
42
  installed = pod_installed
45
- help! "没有找到#{@name}组件的相关信息,请检查输入的组件名称" unless installed.include?(@name)
43
+ help! "没有找到#{@name}组件的相关信息,请检查输入的组件名称" unless installed.include?(@name) || installed.map do |item|
44
+ downcase = item.downcase
45
+ @name = item if @name.downcase == downcase
46
+ downcase
47
+ end.include?(@name.downcase)
46
48
  check_componment_with_name(@name)
47
49
  end
48
50
  end
@@ -103,9 +105,9 @@ module Pod
103
105
  subspecs.uniq!
104
106
  dependencies.uniq!
105
107
  parents.uniq!
106
- UI.puts " - SUBSPEC: ".yellow "#{subspecs.join('、')}".green unless subspecs.empty?
108
+ UI.puts " - SUBSPECS: ".yellow "#{subspecs.join('、')}".green unless subspecs.empty?
107
109
  UI.puts " - DEPENDENCIES: ".yellow "#{dependencies.join('、')}".green unless dependencies.empty?
108
- UI.puts " - PARENTS: ".yellow "#{parents.join('、')}".green unless parents.empty?
110
+ UI.puts " - WHO DEPENDS ON IT: ".yellow "#{parents.join('、')}".green unless parents.empty?
109
111
  end
110
112
 
111
113
  def pod_tags_info
@@ -7,7 +7,7 @@ module Pod
7
7
  self.description = <<-DESC
8
8
  使用`pod util install list`查看pod安装的组件
9
9
  DESC
10
- self.command == 'install'
10
+ self.command = 'install'
11
11
  self.abstract_command = true
12
12
  end
13
13
  end
@@ -15,6 +15,7 @@ module Pod
15
15
 
16
16
  def initialize(argv)
17
17
  @skip_validate = argv.flag?('skip-validate', false)
18
+ @skip_build = argv.flag?('skip-build', false)
18
19
  super
19
20
  @argvs = argv.remainder!
20
21
 
@@ -31,6 +32,7 @@ module Pod
31
32
  @target = Pod::Command::Repo::Push.new(CLAide::ARGV.new(@argvs))
32
33
  @target.validate!
33
34
  @target.skip_validate = @skip_validate
35
+ @target.skip_build = @skip_build
34
36
  @target.run
35
37
  end
36
38
  end
@@ -1,29 +1,23 @@
1
- class Module
2
- def strong_alias(to, from)
3
- # https://tieba.baidu.com/p/5535445605?red_tag=0735709674 贴吧大神给出的方案
4
- # 类方法可以看做singleton class(单例类)的实例方法,下面两个方法都可以,上面这个方式也适用于早起的ruby版本
5
- (class << self;self;end).send(:alias_method, to, from)
6
- # self.singleton_class.send(:alias_method, to, from)
7
- end
8
- end
9
-
10
1
  module Pod
11
2
  class Command
12
3
  class Repo < Command
13
4
  class Push < Repo
14
- attr_accessor :skip_validate
15
-
16
- self.strong_alias(:old_options, :options)
5
+ attr_accessor :skip_validate, :skip_build
6
+
7
+ class_alias_method(:old_options, :options)
17
8
  def self.options
18
9
  [
19
- ['--skip-validate', '跳过验证,不验证推送的podspec文件,默认为验证']
10
+ ['--skip-validate', '跳过整个验证,不验证推送的podspec文件,默认为验证'],
11
+ ['--skip-build', '跳过编译过程,还是会校验pod下载和依赖']
20
12
  ].concat(self.old_options)
21
13
  end
22
14
 
23
15
  # 调用原方法的两种方式
24
16
  old_validate_podspec_files = instance_method(:validate_podspec_files)
25
17
  define_method(:validate_podspec_files) do
18
+ Pod::Validator.skip_build = @skip_build
26
19
  old_validate_podspec_files.bind(self).() unless @skip_validate
20
+ Pod::Validator.skip_build = false
27
21
  end
28
22
 
29
23
  alias_method :old_check_repo_status, :check_repo_status
@@ -33,4 +27,25 @@ module Pod
33
27
  end
34
28
  end
35
29
  end
30
+ end
31
+
32
+ module Pod
33
+ class Validator
34
+ class_attr_accessor :skip_build
35
+
36
+ alias_method :old_build_pod, :build_pod
37
+ def build_pod
38
+ old_build_pod unless Pod::Validator.skip_build
39
+ end
40
+
41
+ alias_method :old_test_pod, :test_pod
42
+ def test_pod
43
+ old_test_pod unless Pod::Validator.skip_build
44
+ end
45
+
46
+ alias_method :old_validated?, :validated?
47
+ def validated?
48
+ Pod::Validator.skip_build || old_validated?
49
+ end
50
+ end
36
51
  end
@@ -7,7 +7,7 @@ module Pod
7
7
  self.description = <<-DESC
8
8
  操作cocoapods的私有repo。如`pod util repo push`推送到私有仓库(可以设置参数跳过验证)
9
9
  DESC
10
- self.command == 'repo'
10
+ self.command = 'repo'
11
11
  self.abstract_command = true
12
12
  end
13
13
  end
@@ -0,0 +1,58 @@
1
+ module Pod
2
+ class Command
3
+ class Util < Command
4
+ class Unique < Util
5
+ self.summary = '对Xcode的工程文件做去重处理。'
6
+ self.description = <<-DESC
7
+ 日常开发过程中难免会出现一些工程文件的冲突,在解决工程文件的冲突时,如果处理不好容易造成文件在编译选项中重复配置的情况。使用该命令可去除重复的编译文件
8
+ DESC
9
+ self.command = 'uniq'
10
+ self.arguments = [
11
+ CLAide::Argument.new('project.xcodeproj', true)
12
+ ]
13
+ def self.options
14
+ [
15
+ ['--targetname=TargetName,TargetName', '指定需要操作的Target'],
16
+ ['--uniq-compile-sources', '对Build Phase中的Compile Sources中文件去重'],
17
+ ['--uniq-bundle-resources', '对Build Phase中Copy Bundle Resources中资源去重']
18
+ ]
19
+ end
20
+ def initialize(argv)
21
+ @proj_path = argv.shift_argument
22
+ @target_names = argv.option('targetname', '').split(',')
23
+ @uniq_compile_sources = argv.flag?('uniq-compile-sources', true)
24
+ @uniq_bundle_resources = argv.flag?('uniq-bundle-resources', true)
25
+ super
26
+ end
27
+
28
+ def validate!
29
+ super
30
+ help! 'An project.xcodeproj is required.' unless @proj_path
31
+ end
32
+
33
+ def run
34
+ require 'xcodeproj'
35
+
36
+ project = Xcodeproj::Project.open(@proj_path)
37
+
38
+ # uniques array
39
+ uniq_phases = []
40
+ uniq_phases |= ['SourcesBuildPhase'] if @uniq_compile_sources
41
+ uniq_phases |= ['ResourcesBuildPhase'] if @uniq_bundle_resources
42
+
43
+ project.targets.each do |target|
44
+ next if @target_names.count > 0 && !@target_names.include?(target.name)
45
+
46
+ target.build_phases.each do |phase|
47
+ phase.files.uniq! if uniq_phases.include?(phase.to_s)
48
+ end
49
+ end
50
+
51
+ project.save
52
+
53
+ puts 'xcodeproj files unique success'
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -8,20 +8,21 @@ module Framework
8
8
  attr_reader :fwk_path
9
9
 
10
10
  def delete_resources
11
- Pathname.new(@resources_path).rmtree
12
- (Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
11
+ Pathname.new(@resources_path).rmtree @contains_resources
12
+ (Pathname.new(@fwk_path) + Pathname.new('Resources')).delete @contains_resources
13
13
  end
14
14
 
15
- def initialize(name, platform)
15
+ def initialize(name, platform, contains_resources=false)
16
16
  @name = name
17
17
  @platform = platform
18
+ @contains_resources = contains_resources
18
19
  end
19
20
 
20
21
  def make
21
22
  make_root
22
23
  make_framework
23
24
  make_headers
24
- make_resources
25
+ make_resources if @contains_resources
25
26
  make_current_version
26
27
  end
27
28
 
@@ -31,7 +32,7 @@ module Framework
31
32
  current_version_path = @versions_path + Pathname.new('../Current')
32
33
  `ln -sf A #{current_version_path}`
33
34
  `ln -sf Versions/Current/Headers #{@fwk_path}/`
34
- `ln -sf Versions/Current/Resources #{@fwk_path}/`
35
+ `ln -sf Versions/Current/Resources #{@fwk_path}/` if @contains_resources
35
36
  `ln -sf Versions/Current/#{@name} #{@fwk_path}/`
36
37
  end
37
38
 
@@ -13,7 +13,7 @@ module Pod
13
13
  if @framework_contains_resources
14
14
  framework_copy_resources(os)
15
15
  else
16
- framework_copy_resources(os) if os = 'build'
16
+ framework_copy_resources(os) if os == 'build'
17
17
  end
18
18
  end
19
19
  frameworks
@@ -40,7 +40,7 @@ module Pod
40
40
  end
41
41
 
42
42
  def create_framework(os_name = '')
43
- @fwk = Framework::Tree.new(@spec.name, "#{@platform.name.to_s}/#{os_name}")
43
+ @fwk = Framework::Tree.new(@spec.name, "#{@platform.name.to_s}/#{os_name}", @framework_contains_resources)
44
44
  @fwk.make
45
45
  @fwk
46
46
  end
@@ -126,9 +126,6 @@ SWIFT_MAP
126
126
  `cp -rp #{resources.join(' ')} #{resources_path}`
127
127
  end
128
128
  end
129
-
130
- # delete framework resources
131
- @fwk.delete_resources if @fwk
132
129
  return
133
130
  end
134
131
 
@@ -29,9 +29,10 @@ module Pod
29
29
  default_build_settings = Hash.new
30
30
  default_build_settings["CLANG_MODULES_AUTOLINK"] = "NO"
31
31
  default_build_settings["GCC_GENERATE_DEBUGGING_SYMBOLS"] = "YES" # 生成Debug编译信息
32
- default_build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" unless @xcframework # 非xcframework排除ios simulator 64位架构
33
- default_build_settings["EXCLUDED_ARCHS[sdk=appletvsimulator*]"] = "arm64" unless @xcframework # 非xcframework排除tvos simulator 64位架构
32
+ default_build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" unless @xcframework && self.match_pod_version?('~> 1.11') # 非xcframework排除ios simulator 64位架构
33
+ default_build_settings["EXCLUDED_ARCHS[sdk=appletvsimulator*]"] = "arm64" unless @xcframework && self.match_pod_version?('~> 1.11') # 非xcframework排除tvos simulator 64位架构
34
34
  default_build_settings["BUILD_LIBRARY_FOR_DISTRIBUTION"] = "YES" # 编译swift生成swiftinterface文件
35
+ default_build_settings["CODE_SIGN_IDENTITY"] = "" if `xcodebuild -version`.lines.shift.gsub!('Xcode ', '') >= "14" #xcode版本大于等于xcode 14时需要添加
35
36
 
36
37
  # merge user setting
37
38
  default_build_settings.merge!(@build_settings) unless @build_settings.empty?
@@ -120,6 +121,10 @@ module Pod
120
121
 
121
122
  Specification.from_file(@path)
122
123
  end
124
+
125
+ def match_pod_version?(*version)
126
+ Gem::Dependency.new('', *version).match?('', Pod::VERSION)
127
+ end
123
128
  end
124
129
  end
125
130
  end
@@ -10,13 +10,26 @@ module Pod
10
10
  self.description = <<-DESC
11
11
  一个CocoaPods常用插件功能的集合,解决日常开发中遇到的一些问题。
12
12
  DESC
13
- self.command == 'util'
13
+ self.command = 'util'
14
14
  self.abstract_command = true
15
+
16
+ def self.options
17
+ [
18
+ ['--version', 'Show cocoapods-util version'],
19
+ ].concat(super)
20
+ end
21
+
15
22
  def initialize(argv)
23
+ @version = argv.flag?('version', false)
16
24
  super
17
25
  end
18
26
 
19
27
  def validate!
28
+ if @version
29
+ require 'cocoapods-util/gem_version.rb'
30
+ puts "#{CocoapodsUtil::VERSION}"
31
+ return
32
+ end
20
33
  super
21
34
  end
22
35
 
@@ -24,4 +37,4 @@ module Pod
24
37
  end
25
38
  end
26
39
  end
27
- end
40
+ end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsUtil
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -0,0 +1,3 @@
1
+ module Pod
2
+ class_attr_accessor :is_prebuild_stage
3
+ end
@@ -0,0 +1,14 @@
1
+ module Pod
2
+ class PrebuildSandbox < Sandbox
3
+
4
+ # [String] standard_sandbox_path
5
+ def self.from_standard_sanbox_path(path)
6
+ prebuild_sandbox_path = Pathname.new(path).realpath + "_Prebuild"
7
+ self.new(prebuild_sandbox_path)
8
+ end
9
+
10
+ def self.from_standard_sandbox(sandbox)
11
+ self.from_standard_sanbox_path(sandbox.root)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ class Module
2
+ def class_alias_method(to, from)
3
+ # https://tieba.baidu.com/p/5535445605?red_tag=0735709674 贴吧大神给出的方案
4
+ # 类方法可以看做singleton class(单例类)的实例方法,下面两个方法都可以,上面这个方式也适用于早期的ruby版本
5
+ (class << self;self;end).send(:alias_method, to, from)
6
+ # self.singleton_class.send(:alias_method, to, from)
7
+ end
8
+
9
+ def class_attr_accessor(symbol)
10
+ self.class.send(:attr_accessor, symbol)
11
+ end
12
+ end
@@ -1,2 +1,3 @@
1
+ require 'cocoapods-util/tool'
1
2
  require 'cocoapods-util/command'
2
3
  require 'cocoapods-util/CocoapodsUtilHook.rb'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - guojiashuang
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-23 00:00:00.000000000 Z
11
+ date: 2022-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.3'
39
+ version: 2.2.33
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.3'
46
+ version: 2.2.33
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -65,13 +65,8 @@ executables: []
65
65
  extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
- - ".gitignore"
69
- - Gemfile
70
68
  - LICENSE
71
- - LICENSE.txt
72
69
  - README.md
73
- - Rakefile
74
- - cocoapods-util.gemspec
75
70
  - lib/cocoapods-util.rb
76
71
  - lib/cocoapods-util/CocoapodsUtilHook.rb
77
72
  - lib/cocoapods-util/command.rb
@@ -81,6 +76,7 @@ files:
81
76
  - lib/cocoapods-util/command/cocoapods-extend/repo.rb
82
77
  - lib/cocoapods-util/command/cocoapods-extend/repo/push.rb
83
78
  - lib/cocoapods-util/command/cocoapods-extend/repo/push_helper.rb
79
+ - lib/cocoapods-util/command/cocoapods-extend/unique.rb
84
80
  - lib/cocoapods-util/command/libsource/source.rb
85
81
  - lib/cocoapods-util/command/libsource/source_linker.rb
86
82
  - lib/cocoapods-util/command/package/helper/builder.rb
@@ -94,15 +90,16 @@ files:
94
90
  - lib/cocoapods-util/command/xcframework/xcframework.rb
95
91
  - lib/cocoapods-util/command/xcframework/xcframework_build.rb
96
92
  - lib/cocoapods-util/gem_version.rb
93
+ - lib/cocoapods-util/hooks/feature_switch.rb
97
94
  - lib/cocoapods-util/hooks/installer.rb
95
+ - lib/cocoapods-util/hooks/prebuild_sandbox.rb
96
+ - lib/cocoapods-util/tool.rb
98
97
  - lib/cocoapods_plugin.rb
99
- - spec/command/util_spec.rb
100
- - spec/spec_helper.rb
101
98
  homepage: https://github.com/CaryGo/cocoapods-util
102
99
  licenses:
103
100
  - MIT
104
101
  metadata: {}
105
- post_install_message:
102
+ post_install_message:
106
103
  rdoc_options: []
107
104
  require_paths:
108
105
  - lib
@@ -118,9 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
115
  version: '0'
119
116
  requirements: []
120
117
  rubygems_version: 3.1.2
121
- signing_key:
118
+ signing_key:
122
119
  specification_version: 4
123
120
  summary: 一个常用插件功能的集合,致力于解决日常开发中遇到的一些问题。
124
- test_files:
125
- - spec/command/util_spec.rb
126
- - spec/spec_helper.rb
121
+ test_files: []
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- .DS_Store
2
- pkg
3
- .idea/
4
- .vscode/
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in cocoapods-util.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem 'cocoapods'
8
-
9
- gem 'mocha'
10
- gem 'bacon'
11
- gem 'mocha-on-bacon'
12
- gem 'prettybacon'
13
- end
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2022 guojiashuang <guojiashuang@58.com>
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,13 +0,0 @@
1
- require 'bundler/gem_tasks'
2
-
3
- def specs(dir)
4
- FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
- end
6
-
7
- desc 'Runs all the specs'
8
- task :specs do
9
- sh "bundle exec bacon #{specs('**')}"
10
- end
11
-
12
- task :default => :specs
13
-
@@ -1,25 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cocoapods-util/gem_version.rb'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'cocoapods-util'
8
- spec.version = CocoapodsUtil::VERSION
9
- spec.authors = ['guojiashuang']
10
- spec.email = ['guojiashuang@live.com']
11
- spec.description = %q{cocoapods-util是一个cocoapods插件,解决日常ios开发中遇到的一些问题。支持打包(编译)静态库、framework生成xcframework、二进制link源码、推送私有库跳过验证等功能。}
12
- spec.summary = %q{一个常用插件功能的集合,致力于解决日常开发中遇到的一些问题。}
13
- spec.homepage = 'https://github.com/CaryGo/cocoapods-util'
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_dependency "cocoapods", ">= 1.5.0", "< 2.0"
22
-
23
- spec.add_development_dependency 'bundler', '~> 1.3'
24
- spec.add_development_dependency 'rake'
25
- end
@@ -1,12 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- module Pod
4
- describe Command::Util do
5
- describe 'CLAide' do
6
- it 'registers it self' do
7
- Command.parse(%w{ util }).should.be.instance_of Command::Util
8
- end
9
- end
10
- end
11
- end
12
-
data/spec/spec_helper.rb DELETED
@@ -1,50 +0,0 @@
1
- require 'pathname'
2
- ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
- $:.unshift((ROOT + 'lib').to_s)
4
- $:.unshift((ROOT + 'spec').to_s)
5
-
6
- require 'bundler/setup'
7
- require 'bacon'
8
- require 'mocha-on-bacon'
9
- require 'pretty_bacon'
10
- require 'pathname'
11
- require 'cocoapods'
12
-
13
- Mocha::Configuration.prevent(:stubbing_non_existent_method)
14
-
15
- require 'cocoapods_plugin'
16
-
17
- #-----------------------------------------------------------------------------#
18
-
19
- module Pod
20
-
21
- # Disable the wrapping so the output is deterministic in the tests.
22
- #
23
- UI.disable_wrap = true
24
-
25
- # Redirects the messages to an internal store.
26
- #
27
- module UI
28
- @output = ''
29
- @warnings = ''
30
-
31
- class << self
32
- attr_accessor :output
33
- attr_accessor :warnings
34
-
35
- def puts(message = '')
36
- @output << "#{message}\n"
37
- end
38
-
39
- def warn(message = '', actions = [])
40
- @warnings << "#{message}\n"
41
- end
42
-
43
- def print(message)
44
- @output << message
45
- end
46
- end
47
- end
48
- end
49
-
50
- #-----------------------------------------------------------------------------#