cocoapods-miBin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rakeTasks +7 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +104 -0
- data/LICENSE.txt +22 -0
- data/README.md +522 -0
- data/Rakefile +13 -0
- data/cocoapods-miBin.gemspec +27 -0
- data/lib/cocoapods-miBin.rb +4 -0
- data/lib/cocoapods-miBin/command.rb +3 -0
- data/lib/cocoapods-miBin/command/bin.rb +60 -0
- data/lib/cocoapods-miBin/command/bin/archive.rb +134 -0
- data/lib/cocoapods-miBin/command/bin/init.rb +71 -0
- data/lib/cocoapods-miBin/command/bin/lib.rb +14 -0
- data/lib/cocoapods-miBin/command/bin/lib/lint.rb +69 -0
- data/lib/cocoapods-miBin/command/bin/list.rb +50 -0
- data/lib/cocoapods-miBin/command/bin/open.rb +61 -0
- data/lib/cocoapods-miBin/command/bin/repo.rb +15 -0
- data/lib/cocoapods-miBin/command/bin/repo/push.rb +116 -0
- data/lib/cocoapods-miBin/command/bin/repo/update.rb +42 -0
- data/lib/cocoapods-miBin/command/bin/search.rb +69 -0
- data/lib/cocoapods-miBin/command/bin/spec.rb +15 -0
- data/lib/cocoapods-miBin/command/bin/spec/create.rb +75 -0
- data/lib/cocoapods-miBin/command/bin/spec/lint.rb +111 -0
- data/lib/cocoapods-miBin/command/bin/umbrella.rb +55 -0
- data/lib/cocoapods-miBin/config/config.rb +81 -0
- data/lib/cocoapods-miBin/config/config_asker.rb +58 -0
- data/lib/cocoapods-miBin/gem_version.rb +11 -0
- data/lib/cocoapods-miBin/helpers.rb +5 -0
- data/lib/cocoapods-miBin/helpers/framework.rb +64 -0
- data/lib/cocoapods-miBin/helpers/framework_builder.rb +227 -0
- data/lib/cocoapods-miBin/helpers/sources_helper.rb +33 -0
- data/lib/cocoapods-miBin/helpers/spec_creator.rb +159 -0
- data/lib/cocoapods-miBin/helpers/spec_files_helper.rb +77 -0
- data/lib/cocoapods-miBin/native.rb +21 -0
- data/lib/cocoapods-miBin/native/acknowledgements.rb +27 -0
- data/lib/cocoapods-miBin/native/analyzer.rb +53 -0
- data/lib/cocoapods-miBin/native/installation_options.rb +26 -0
- data/lib/cocoapods-miBin/native/installer.rb +116 -0
- data/lib/cocoapods-miBin/native/linter.rb +26 -0
- data/lib/cocoapods-miBin/native/path_source.rb +33 -0
- data/lib/cocoapods-miBin/native/pod_source_installer.rb +19 -0
- data/lib/cocoapods-miBin/native/pod_target.rb +8 -0
- data/lib/cocoapods-miBin/native/podfile.rb +79 -0
- data/lib/cocoapods-miBin/native/podfile_env.rb +36 -0
- data/lib/cocoapods-miBin/native/podspec_finder.rb +25 -0
- data/lib/cocoapods-miBin/native/resolver.rb +200 -0
- data/lib/cocoapods-miBin/native/sandbox_analyzer.rb +34 -0
- data/lib/cocoapods-miBin/native/source.rb +35 -0
- data/lib/cocoapods-miBin/native/sources_manager.rb +20 -0
- data/lib/cocoapods-miBin/native/specification.rb +31 -0
- data/lib/cocoapods-miBin/native/validator.rb +16 -0
- data/lib/cocoapods-miBin/source_provider_hook.rb +21 -0
- data/lib/cocoapods_plugin.rb +5 -0
- data/spec/command/bin_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +173 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Source
|
7
|
+
# Returns the path of the specification with the given name and version.
|
8
|
+
#
|
9
|
+
# @param [String] name
|
10
|
+
# the name of the Pod.
|
11
|
+
#
|
12
|
+
# @param [Version,String] version
|
13
|
+
# the version for the specification.
|
14
|
+
#
|
15
|
+
# @return [Pathname] The path of the specification.
|
16
|
+
#
|
17
|
+
def specification_path(name, version)
|
18
|
+
raise ArgumentError, 'No name' unless name
|
19
|
+
raise ArgumentError, 'No version' unless version
|
20
|
+
|
21
|
+
path = pod_path(name) + version.to_s
|
22
|
+
|
23
|
+
specification_path = Specification::VALID_EXTNAME
|
24
|
+
.map { |extname| "#{name}#{extname}" }
|
25
|
+
.map { |file| path + file }
|
26
|
+
.find(&:exist?)
|
27
|
+
|
28
|
+
unless specification_path
|
29
|
+
raise StandardError, "Unable to find the specification #{name} " \
|
30
|
+
"(#{version}) in the #{self.name} source."
|
31
|
+
end
|
32
|
+
specification_path
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods'
|
4
|
+
require 'cocoapods-miBin/config/config'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Source
|
8
|
+
class Manager
|
9
|
+
# 源码 source
|
10
|
+
def code_source
|
11
|
+
source_with_name_or_url(CBin.config.code_repo_url)
|
12
|
+
end
|
13
|
+
|
14
|
+
# 二进制 source
|
15
|
+
def binary_source
|
16
|
+
source_with_name_or_url(CBin.config.binary_repo_url)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods-miBin/native/sources_manager'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Specification
|
7
|
+
VALID_EXTNAME = %w[.binary.podspec.json .binary.podspec .podspec.json .podspec].freeze
|
8
|
+
DEFAULT_TEMPLATE_EXTNAME = %w[.binary-template.podspec .binary-template.podspec.json].freeze
|
9
|
+
|
10
|
+
# TODO
|
11
|
+
# 可以在这里根据组件依赖二进制或源码调整 sources 的先后顺序
|
12
|
+
# 如果是源码,则调整 code_source 到最前面
|
13
|
+
# 如果是二进制,则调整 binary_source 到最前面
|
14
|
+
# 这样 CocoaPods 分析时,就会优先获取到对应源的 podspec
|
15
|
+
#
|
16
|
+
# 先要把 Podfile 里面的配置数据保存到单例中,再在这里判断,就不需要 resolver 了
|
17
|
+
# 但是现在这个插件依旧可用,重构需要时间 = = ,没什么动力去重构了呀。。。
|
18
|
+
#
|
19
|
+
# class Set
|
20
|
+
# old_initialize = instance_method(:initialize)
|
21
|
+
# define_method(:initialize) do |name, sources|
|
22
|
+
# if name == 'TDFAdaptationKit'
|
23
|
+
# sources_manager = Pod::Config.instance.sources_manager
|
24
|
+
# # sources = [sources_manager.binary_source, *sources].uniq
|
25
|
+
# sources = [sources_manager.code_source, *sources].uniq
|
26
|
+
# end
|
27
|
+
# old_initialize.bind(self).call(name, sources)
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Validator
|
5
|
+
# def validate_source_url(spec)
|
6
|
+
# return if spec.source.nil? || spec.source[:http].nil?
|
7
|
+
# url = URI(spec.source[:http])
|
8
|
+
# return if url.scheme == 'https' || url.scheme == 'file'
|
9
|
+
# warning('http', "The URL (`#{url}`) doesn't use the encrypted HTTPs protocol. " \
|
10
|
+
# 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\
|
11
|
+
# 'This will be an error in future releases. Please update the URL to use https.')
|
12
|
+
# end
|
13
|
+
|
14
|
+
def validate_source_url(spec); end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cocoapods-miBin/native/sources_manager'
|
4
|
+
|
5
|
+
Pod::HooksManager.register('cocoapods-miBin', :pre_install) do |_context, _|
|
6
|
+
require 'cocoapods-miBin/native'
|
7
|
+
end
|
8
|
+
|
9
|
+
Pod::HooksManager.register('cocoapods-miBin', :source_provider) do |context, _|
|
10
|
+
sources_manager = Pod::Config.instance.sources_manager
|
11
|
+
podfile = Pod::Config.instance.podfile
|
12
|
+
|
13
|
+
if podfile
|
14
|
+
# 添加二进制私有源 && 源码私有源
|
15
|
+
added_sources = [sources_manager.code_source, sources_manager.binary_source]
|
16
|
+
if podfile.use_binaries? || podfile.use_binaries_selector
|
17
|
+
added_sources.reverse!
|
18
|
+
end
|
19
|
+
added_sources.each { |source| context.add_source(source) }
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,50 @@
|
|
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
|
+
#-----------------------------------------------------------------------------#
|
metadata
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-miBin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- zhangyanbin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: parallel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cocoapods
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cocoapods-generate
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: cocoapods-miBin is a plugin which helps develpers switching pods between
|
84
|
+
source code and binary.
|
85
|
+
email:
|
86
|
+
- zhangyanbin@xiaomi.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rakeTasks"
|
93
|
+
- Gemfile
|
94
|
+
- Gemfile.lock
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- cocoapods-miBin.gemspec
|
99
|
+
- lib/cocoapods-miBin.rb
|
100
|
+
- lib/cocoapods-miBin/command.rb
|
101
|
+
- lib/cocoapods-miBin/command/bin.rb
|
102
|
+
- lib/cocoapods-miBin/command/bin/archive.rb
|
103
|
+
- lib/cocoapods-miBin/command/bin/init.rb
|
104
|
+
- lib/cocoapods-miBin/command/bin/lib.rb
|
105
|
+
- lib/cocoapods-miBin/command/bin/lib/lint.rb
|
106
|
+
- lib/cocoapods-miBin/command/bin/list.rb
|
107
|
+
- lib/cocoapods-miBin/command/bin/open.rb
|
108
|
+
- lib/cocoapods-miBin/command/bin/repo.rb
|
109
|
+
- lib/cocoapods-miBin/command/bin/repo/push.rb
|
110
|
+
- lib/cocoapods-miBin/command/bin/repo/update.rb
|
111
|
+
- lib/cocoapods-miBin/command/bin/search.rb
|
112
|
+
- lib/cocoapods-miBin/command/bin/spec.rb
|
113
|
+
- lib/cocoapods-miBin/command/bin/spec/create.rb
|
114
|
+
- lib/cocoapods-miBin/command/bin/spec/lint.rb
|
115
|
+
- lib/cocoapods-miBin/command/bin/umbrella.rb
|
116
|
+
- lib/cocoapods-miBin/config/config.rb
|
117
|
+
- lib/cocoapods-miBin/config/config_asker.rb
|
118
|
+
- lib/cocoapods-miBin/gem_version.rb
|
119
|
+
- lib/cocoapods-miBin/helpers.rb
|
120
|
+
- lib/cocoapods-miBin/helpers/framework.rb
|
121
|
+
- lib/cocoapods-miBin/helpers/framework_builder.rb
|
122
|
+
- lib/cocoapods-miBin/helpers/sources_helper.rb
|
123
|
+
- lib/cocoapods-miBin/helpers/spec_creator.rb
|
124
|
+
- lib/cocoapods-miBin/helpers/spec_files_helper.rb
|
125
|
+
- lib/cocoapods-miBin/native.rb
|
126
|
+
- lib/cocoapods-miBin/native/acknowledgements.rb
|
127
|
+
- lib/cocoapods-miBin/native/analyzer.rb
|
128
|
+
- lib/cocoapods-miBin/native/installation_options.rb
|
129
|
+
- lib/cocoapods-miBin/native/installer.rb
|
130
|
+
- lib/cocoapods-miBin/native/linter.rb
|
131
|
+
- lib/cocoapods-miBin/native/path_source.rb
|
132
|
+
- lib/cocoapods-miBin/native/pod_source_installer.rb
|
133
|
+
- lib/cocoapods-miBin/native/pod_target.rb
|
134
|
+
- lib/cocoapods-miBin/native/podfile.rb
|
135
|
+
- lib/cocoapods-miBin/native/podfile_env.rb
|
136
|
+
- lib/cocoapods-miBin/native/podspec_finder.rb
|
137
|
+
- lib/cocoapods-miBin/native/resolver.rb
|
138
|
+
- lib/cocoapods-miBin/native/sandbox_analyzer.rb
|
139
|
+
- lib/cocoapods-miBin/native/source.rb
|
140
|
+
- lib/cocoapods-miBin/native/sources_manager.rb
|
141
|
+
- lib/cocoapods-miBin/native/specification.rb
|
142
|
+
- lib/cocoapods-miBin/native/validator.rb
|
143
|
+
- lib/cocoapods-miBin/source_provider_hook.rb
|
144
|
+
- lib/cocoapods_plugin.rb
|
145
|
+
- spec/command/bin_spec.rb
|
146
|
+
- spec/spec_helper.rb
|
147
|
+
homepage: https://github.com/zhangjianbin/cocoapods-bin.git
|
148
|
+
licenses:
|
149
|
+
- MIT
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubygems_version: 3.0.6
|
167
|
+
signing_key:
|
168
|
+
specification_version: 4
|
169
|
+
summary: cocoapods-miBin is a plugin which helps develpers switching pods between
|
170
|
+
source code and binary.
|
171
|
+
test_files:
|
172
|
+
- spec/command/bin_spec.rb
|
173
|
+
- spec/spec_helper.rb
|