cocoapods-tj 1.0.0
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 +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +1 -0
- data/lib/cocoapods-tj/command/bin/archive.rb +203 -0
- data/lib/cocoapods-tj/command/bin/auto.rb +189 -0
- data/lib/cocoapods-tj/command/bin/code.rb +198 -0
- data/lib/cocoapods-tj/command/bin/imy.rb +45 -0
- data/lib/cocoapods-tj/command/bin/init.rb +65 -0
- data/lib/cocoapods-tj/command/bin/initHotKey.rb +66 -0
- data/lib/cocoapods-tj/command/bin/install.rb +41 -0
- data/lib/cocoapods-tj/command/bin/lib/lint.rb +66 -0
- data/lib/cocoapods-tj/command/bin/local.rb +142 -0
- data/lib/cocoapods-tj/command/bin/repo/update.rb +42 -0
- data/lib/cocoapods-tj/command/bin/spec/create.rb +68 -0
- data/lib/cocoapods-tj/command/bin/spec/push.rb +114 -0
- data/lib/cocoapods-tj/command/bin/update.rb +144 -0
- data/lib/cocoapods-tj/command/bin.rb +42 -0
- data/lib/cocoapods-tj/command.rb +2 -0
- data/lib/cocoapods-tj/config/config.rb +129 -0
- data/lib/cocoapods-tj/config/config_asker.rb +49 -0
- data/lib/cocoapods-tj/config/config_builder.rb +201 -0
- data/lib/cocoapods-tj/config/config_hot_key.rb +102 -0
- data/lib/cocoapods-tj/config/config_hot_key_asker.rb +48 -0
- data/lib/cocoapods-tj/gem_version.rb +10 -0
- data/lib/cocoapods-tj/helpers/Info.plist +0 -0
- data/lib/cocoapods-tj/helpers/build_helper.rb +154 -0
- data/lib/cocoapods-tj/helpers/build_utils.rb +62 -0
- data/lib/cocoapods-tj/helpers/framework.rb +79 -0
- data/lib/cocoapods-tj/helpers/framework_builder.rb +391 -0
- data/lib/cocoapods-tj/helpers/library.rb +54 -0
- data/lib/cocoapods-tj/helpers/library_builder.rb +89 -0
- data/lib/cocoapods-tj/helpers/local/loca_llibrary.rb +57 -0
- data/lib/cocoapods-tj/helpers/local/local_build_helper.rb +177 -0
- data/lib/cocoapods-tj/helpers/local/local_framework.rb +85 -0
- data/lib/cocoapods-tj/helpers/local/local_framework_builder.rb +226 -0
- data/lib/cocoapods-tj/helpers/local/local_library_builder.rb +91 -0
- data/lib/cocoapods-tj/helpers/sources_helper.rb +32 -0
- data/lib/cocoapods-tj/helpers/spec_creator.rb +150 -0
- data/lib/cocoapods-tj/helpers/spec_files_helper.rb +73 -0
- data/lib/cocoapods-tj/helpers/spec_source_creator.rb +189 -0
- data/lib/cocoapods-tj/helpers/upload_helper.rb +81 -0
- data/lib/cocoapods-tj/helpers.rb +5 -0
- data/lib/cocoapods-tj/native/acknowledgements.rb +26 -0
- data/lib/cocoapods-tj/native/analyzer.rb +29 -0
- data/lib/cocoapods-tj/native/file_accessor.rb +20 -0
- data/lib/cocoapods-tj/native/installation_options.rb +21 -0
- data/lib/cocoapods-tj/native/installer.rb +106 -0
- data/lib/cocoapods-tj/native/linter.rb +26 -0
- data/lib/cocoapods-tj/native/path_source.rb +29 -0
- data/lib/cocoapods-tj/native/pod_source_installer.rb +18 -0
- data/lib/cocoapods-tj/native/pod_target_installer.rb +81 -0
- data/lib/cocoapods-tj/native/podfile.rb +91 -0
- data/lib/cocoapods-tj/native/podfile_env.rb +37 -0
- data/lib/cocoapods-tj/native/podfile_generator.rb +135 -0
- data/lib/cocoapods-tj/native/podspec_finder.rb +23 -0
- data/lib/cocoapods-tj/native/resolver.rb +202 -0
- data/lib/cocoapods-tj/native/sandbox_analyzer.rb +11 -0
- data/lib/cocoapods-tj/native/source.rb +35 -0
- data/lib/cocoapods-tj/native/sources_manager.rb +18 -0
- data/lib/cocoapods-tj/native/specification.rb +10 -0
- data/lib/cocoapods-tj/native/target_validator.rb +41 -0
- data/lib/cocoapods-tj/native/validator.rb +40 -0
- data/lib/cocoapods-tj/native.rb +23 -0
- data/lib/cocoapods-tj/source_provider_hook.rb +50 -0
- data/lib/cocoapods-tj.rb +2 -0
- data/lib/cocoapods_plugin.rb +3 -0
- data/spec/command/bin_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +182 -0
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'parallel'
|
4
|
+
require 'cocoapods'
|
5
|
+
require 'cocoapods-tj/native/podfile'
|
6
|
+
require 'cocoapods-tj/native/sources_manager'
|
7
|
+
require 'cocoapods-tj/native/installation_options'
|
8
|
+
require 'cocoapods-tj/gem_version'
|
9
|
+
require 'cocoapods-tj/command/bin/archive'
|
10
|
+
|
11
|
+
module Pod
|
12
|
+
class Resolver
|
13
|
+
if Pod.match_version?('~> 1.6')
|
14
|
+
|
15
|
+
def aggregate_for_dependency(dependency)
|
16
|
+
sources_manager = Config.instance.sources_manager
|
17
|
+
if dependency&.podspec_repo
|
18
|
+
sources_manager.aggregate_for_dependency(dependency)
|
19
|
+
|
20
|
+
else
|
21
|
+
@aggregate ||= Source::Aggregate.new(sources)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if Pod.match_version?('~> 1.4')
|
27
|
+
def specifications_for_dependency(dependency, additional_requirements_frozen = [])
|
28
|
+
additional_requirements = additional_requirements_frozen.dup.compact
|
29
|
+
requirement = Requirement.new(dependency.requirement.as_list + additional_requirements.flat_map(&:as_list))
|
30
|
+
if podfile.allow_prerelease? && !requirement.prerelease?
|
31
|
+
requirement = Requirement.new(dependency.requirement.as_list.map { |r| r + '.a' } + additional_requirements.flat_map(&:as_list))
|
32
|
+
end
|
33
|
+
|
34
|
+
options = if Pod.match_version?('~> 1.7')
|
35
|
+
podfile.installation_options
|
36
|
+
else
|
37
|
+
installation_options
|
38
|
+
end
|
39
|
+
|
40
|
+
if Pod.match_version?('~> 1.8')
|
41
|
+
specifications = find_cached_set(dependency)
|
42
|
+
.all_specifications(options.warn_for_multiple_pod_sources, requirement)
|
43
|
+
else
|
44
|
+
specifications = find_cached_set(dependency)
|
45
|
+
.all_specifications(options.warn_for_multiple_pod_sources)
|
46
|
+
.select { |s| requirement.satisfied_by? s.version }
|
47
|
+
end
|
48
|
+
|
49
|
+
specifications
|
50
|
+
.map { |s| s.subspec_by_name(dependency.name, false, true) }
|
51
|
+
.compact
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if Pod.match_version?('~> 1.6')
|
56
|
+
alias old_valid_possibility_version_for_root_name? valid_possibility_version_for_root_name?
|
57
|
+
|
58
|
+
def valid_possibility_version_for_root_name?(requirement, activated, spec)
|
59
|
+
return true if podfile.allow_prerelease?
|
60
|
+
|
61
|
+
old_valid_possibility_version_for_root_name?(requirement, activated, spec)
|
62
|
+
end
|
63
|
+
elsif Pod.match_version?('~> 1.4')
|
64
|
+
def requirement_satisfied_by?(requirement, activated, spec)
|
65
|
+
version = spec.version
|
66
|
+
return false unless requirement.requirement.satisfied_by?(version)
|
67
|
+
|
68
|
+
shared_possibility_versions, prerelease_requirement = possibility_versions_for_root_name(requirement, activated)
|
69
|
+
if !shared_possibility_versions.empty? && !shared_possibility_versions.include?(version)
|
70
|
+
return false
|
71
|
+
end
|
72
|
+
if !podfile.allow_prerelease? && version.prerelease? && !prerelease_requirement
|
73
|
+
return false
|
74
|
+
end
|
75
|
+
unless spec_is_platform_compatible?(activated, requirement, spec)
|
76
|
+
return false
|
77
|
+
end
|
78
|
+
|
79
|
+
true
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# >= 1.4.0 才有 resolver_specs_by_target 以及 ResolverSpecification
|
84
|
+
# >= 1.5.0 ResolverSpecification 才有 source,供 install 或者其他操作时,输入 source 变更
|
85
|
+
#
|
86
|
+
if Pod.match_version?('~> 1.4')
|
87
|
+
old_resolver_specs_by_target = instance_method(:resolver_specs_by_target)
|
88
|
+
define_method(:resolver_specs_by_target) do
|
89
|
+
specs_by_target = old_resolver_specs_by_target.bind(self).call
|
90
|
+
|
91
|
+
sources_manager = Config.instance.sources_manager
|
92
|
+
use_source_pods = podfile.use_source_pods
|
93
|
+
|
94
|
+
missing_binary_specs = []
|
95
|
+
specs_by_target.each do |target, rspecs|
|
96
|
+
use_binary_rspecs = if podfile.use_binaries? || podfile.use_binaries_selector
|
97
|
+
rspecs.select do |rspec|
|
98
|
+
([rspec.name, rspec.root.name] & use_source_pods).empty? &&
|
99
|
+
(podfile.use_binaries_selector.nil? || podfile.use_binaries_selector.call(rspec.spec))
|
100
|
+
end
|
101
|
+
else
|
102
|
+
[]
|
103
|
+
end
|
104
|
+
|
105
|
+
specs_by_target[target] = rspecs.map do |rspec|
|
106
|
+
|
107
|
+
|
108
|
+
use_binary = use_binary_rspecs.include?(rspec)
|
109
|
+
source = use_binary ? sources_manager.binary_source : sources_manager.code_source
|
110
|
+
|
111
|
+
spec_version = rspec.spec.version
|
112
|
+
|
113
|
+
begin
|
114
|
+
specification = source.specification(rspec.root.name, spec_version)
|
115
|
+
UI.message "#{rspec.root.name} #{spec_version} \r\n specification =#{specification} "
|
116
|
+
if rspec.spec.subspec?
|
117
|
+
specification = specification.subspec_by_name(rspec.name, false, true)
|
118
|
+
end
|
119
|
+
|
120
|
+
next unless specification
|
121
|
+
|
122
|
+
used_by_only = if Pod.match_version?('~> 1.7')
|
123
|
+
rspec.used_by_non_library_targets_only
|
124
|
+
else
|
125
|
+
rspec.used_by_tests_only
|
126
|
+
end
|
127
|
+
|
128
|
+
rspec = if Pod.match_version?('~> 1.4.0')
|
129
|
+
ResolverSpecification.new(specification, used_by_only)
|
130
|
+
else
|
131
|
+
ResolverSpecification.new(specification, used_by_only, source)
|
132
|
+
end
|
133
|
+
|
134
|
+
# end
|
135
|
+
|
136
|
+
rescue Pod::StandardError => e
|
137
|
+
|
138
|
+
# missing_binary_specs << rspec.spec if use_binary
|
139
|
+
missing_binary_specs << rspec.spec
|
140
|
+
rspec
|
141
|
+
end
|
142
|
+
|
143
|
+
rspec
|
144
|
+
end.compact
|
145
|
+
end
|
146
|
+
|
147
|
+
if missing_binary_specs.any?
|
148
|
+
missing_binary_specs.uniq.each do |spec|
|
149
|
+
#UI.message "【#{spec.name} | #{spec.version}】组件无对应二进制版本 , 将采用源码依赖."
|
150
|
+
end
|
151
|
+
Pod::Command::Bin::Archive.missing_binary_specs(missing_binary_specs)
|
152
|
+
|
153
|
+
sources_sepc = []
|
154
|
+
des_dir = CBin::Config::Builder.instance.local_psec_dir
|
155
|
+
FileUtils.rm_f(des_dir) if File.exist?des_dir
|
156
|
+
Dir.mkdir des_dir unless File.exist?des_dir
|
157
|
+
missing_binary_specs.uniq.each do |spec|
|
158
|
+
next if spec.name.include?('/')
|
159
|
+
|
160
|
+
spec_git_res = false
|
161
|
+
CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
|
162
|
+
spec_git_res = spec.source[:git] && spec.source[:git].include?(ignore_git)
|
163
|
+
break if spec_git_res
|
164
|
+
end
|
165
|
+
next if spec_git_res
|
166
|
+
|
167
|
+
sources_sepc << spec
|
168
|
+
unless spec.defined_in_file.nil?
|
169
|
+
FileUtils.cp("#{spec.defined_in_file}", "#{des_dir}")
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
specs_by_target
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
if Pod.match_version?('~> 1.4.0')
|
180
|
+
# 1.4.0 没有 spec_source
|
181
|
+
class Specification
|
182
|
+
class Set
|
183
|
+
class LazySpecification < BasicObject
|
184
|
+
attr_reader :spec_source
|
185
|
+
|
186
|
+
old_initialize = instance_method(:initialize)
|
187
|
+
define_method(:initialize) do |name, version, source|
|
188
|
+
old_initialize.bind(self).call(name, version, source)
|
189
|
+
|
190
|
+
@spec_source = source
|
191
|
+
end
|
192
|
+
|
193
|
+
def respond_to?(method, include_all = false)
|
194
|
+
return super unless method == :spec_source
|
195
|
+
|
196
|
+
true
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
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,18 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'cocoapods'
|
4
|
+
require 'cocoapods-tj/config/config'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Source
|
8
|
+
class Manager
|
9
|
+
def code_source
|
10
|
+
nsme = "#{CBin.config.code_repo_url}"
|
11
|
+
source_with_name_or_url(CBin.config.code_repo_url)
|
12
|
+
end
|
13
|
+
def binary_source
|
14
|
+
source_with_name_or_url(CBin.config.binary_repo_url)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'cocoapods-tj/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
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Xcode
|
4
|
+
# The {Xcode::TargetValidator} ensures that the pod and aggregate target
|
5
|
+
# configuration is valid for installation.
|
6
|
+
#
|
7
|
+
class TargetValidator
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
def verify_swift_pods_have_module_dependencies
|
12
|
+
error_messages = []
|
13
|
+
pod_targets.each do |pod_target|
|
14
|
+
next unless pod_target.uses_swift?
|
15
|
+
|
16
|
+
non_module_dependencies = []
|
17
|
+
pod_target.dependent_targets.each do |dependent_target|
|
18
|
+
next if !dependent_target.should_build? || dependent_target.defines_module?
|
19
|
+
non_module_dependencies << dependent_target.name
|
20
|
+
end
|
21
|
+
|
22
|
+
next if non_module_dependencies.empty?
|
23
|
+
|
24
|
+
error_messages << "The Swift pod `#{pod_target.name}` depends upon #{non_module_dependencies.map { |d| "`#{d}`" }.to_sentence}, " \
|
25
|
+
"which #{non_module_dependencies.count == 1 ? 'does' : 'do'} not define modules. " \
|
26
|
+
'To opt into those targets generating module maps '\
|
27
|
+
'(which is necessary to import them from Swift when building as static libraries), ' \
|
28
|
+
'you may set `use_modular_headers!` globally in your Podfile, '\
|
29
|
+
'or specify `:modular_headers => true` for particular dependencies.'
|
30
|
+
end
|
31
|
+
return false
|
32
|
+
|
33
|
+
# raise Informative, 'The following Swift pods cannot yet be integrated '\
|
34
|
+
# "as static libraries:\n\n#{error_messages.join("\n\n")}"
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
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
|
+
# Perform analysis for a given spec (or subspec)
|
15
|
+
#
|
16
|
+
def perform_extensive_analysis(spec)
|
17
|
+
return true
|
18
|
+
end
|
19
|
+
|
20
|
+
#覆盖
|
21
|
+
def check_file_patterns
|
22
|
+
FILE_PATTERNS.each do |attr_name|
|
23
|
+
next if %i(source_files resources).include? attr_name
|
24
|
+
if respond_to?("_validate_#{attr_name}", true)
|
25
|
+
send("_validate_#{attr_name}")
|
26
|
+
else
|
27
|
+
validate_nonempty_patterns(attr_name, :error)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
_validate_header_mappings_dir
|
32
|
+
if consumer.spec.root?
|
33
|
+
_validate_license
|
34
|
+
_validate_module_map
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def validate_source_url(spec); end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
|
3
|
+
if Pod.match_version?('~> 1.4')
|
4
|
+
require 'cocoapods-tj/native/podfile'
|
5
|
+
require 'cocoapods-tj/native/installation_options'
|
6
|
+
require 'cocoapods-tj/native/specification'
|
7
|
+
require 'cocoapods-tj/native/path_source'
|
8
|
+
require 'cocoapods-tj/native/analyzer'
|
9
|
+
require 'cocoapods-tj/native/installer'
|
10
|
+
require 'cocoapods-tj/native/podfile_generator'
|
11
|
+
require 'cocoapods-tj/native/pod_source_installer'
|
12
|
+
require 'cocoapods-tj/native/linter'
|
13
|
+
require 'cocoapods-tj/native/resolver'
|
14
|
+
require 'cocoapods-tj/native/source'
|
15
|
+
require 'cocoapods-tj/native/validator'
|
16
|
+
require 'cocoapods-tj/native/acknowledgements'
|
17
|
+
require 'cocoapods-tj/native/sandbox_analyzer'
|
18
|
+
require 'cocoapods-tj/native/podspec_finder'
|
19
|
+
require 'cocoapods-tj/native/file_accessor'
|
20
|
+
require 'cocoapods-tj/native/pod_target_installer'
|
21
|
+
require 'cocoapods-tj/native/target_validator'
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'cocoapods-tj/native/sources_manager'
|
2
|
+
require 'cocoapods-tj/command/bin/repo/update'
|
3
|
+
require 'cocoapods/user_interface'
|
4
|
+
|
5
|
+
Pod::HooksManager.register('cocoapods-tj', :pre_install) do |_context, _|
|
6
|
+
require 'cocoapods-tj/native'
|
7
|
+
|
8
|
+
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
|
9
|
+
|
10
|
+
if _context.podfile.plugins.keys.include?('cocoapods-tj') && _context.podfile.configuration_env == 'dev'
|
11
|
+
dependencies = _context.podfile.dependencies
|
12
|
+
dependencies.each do |d|
|
13
|
+
next unless d.respond_to?(:external_source) &&
|
14
|
+
d.external_source.is_a?(Hash) &&
|
15
|
+
!d.external_source[:path].nil? &&
|
16
|
+
$ARGV[1] != 'archive'
|
17
|
+
_context.podfile.set_use_source_pods d.name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
project_root = Pod::Config.instance.project_root
|
22
|
+
path = File.join(project_root.to_s, 'BinPodfile')
|
23
|
+
|
24
|
+
next unless File.exist?(path)
|
25
|
+
|
26
|
+
contents = File.open(path, 'r:utf-8', &:read)
|
27
|
+
podfile = Pod::Config.instance.podfile
|
28
|
+
podfile.instance_eval do
|
29
|
+
begin
|
30
|
+
eval(contents, nil, path)
|
31
|
+
rescue Exception => e
|
32
|
+
message = "Invalid `#{path}` file: #{e.message}"
|
33
|
+
raise Pod::DSLError.new(message, path, e, contents)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Pod::HooksManager.register('cocoapods-tj', :source_provider) do |context, _|
|
39
|
+
sources_manager = Pod::Config.instance.sources_manager
|
40
|
+
podfile = Pod::Config.instance.podfile
|
41
|
+
|
42
|
+
if podfile
|
43
|
+
added_sources = [sources_manager.code_source]
|
44
|
+
if podfile.use_binaries? || podfile.use_binaries_selector
|
45
|
+
added_sources << sources_manager.binary_source
|
46
|
+
added_sources.reverse!
|
47
|
+
end
|
48
|
+
added_sources.each { |source| context.add_source(source) }
|
49
|
+
end
|
50
|
+
end
|
data/lib/cocoapods-tj.rb
ADDED
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
|
+
#-----------------------------------------------------------------------------#
|