cocoapods-imy-bin 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +541 -0
  4. data/lib/cocoapods-imy-bin.rb +2 -0
  5. data/lib/cocoapods-imy-bin/command.rb +2 -0
  6. data/lib/cocoapods-imy-bin/command/bin.rb +60 -0
  7. data/lib/cocoapods-imy-bin/command/bin/archive.rb +184 -0
  8. data/lib/cocoapods-imy-bin/command/bin/auto.rb +188 -0
  9. data/lib/cocoapods-imy-bin/command/bin/code.rb +237 -0
  10. data/lib/cocoapods-imy-bin/command/bin/imy.rb +46 -0
  11. data/lib/cocoapods-imy-bin/command/bin/init.rb +69 -0
  12. data/lib/cocoapods-imy-bin/command/bin/initHotKey.rb +70 -0
  13. data/lib/cocoapods-imy-bin/command/bin/install.rb +44 -0
  14. data/lib/cocoapods-imy-bin/command/bin/lib/lint.rb +69 -0
  15. data/lib/cocoapods-imy-bin/command/bin/local.rb +156 -0
  16. data/lib/cocoapods-imy-bin/command/bin/repo/update.rb +43 -0
  17. data/lib/cocoapods-imy-bin/command/bin/spec/create.rb +73 -0
  18. data/lib/cocoapods-imy-bin/command/bin/spec/push.rb +114 -0
  19. data/lib/cocoapods-imy-bin/command/bin/update.rb +148 -0
  20. data/lib/cocoapods-imy-bin/config/config.rb +137 -0
  21. data/lib/cocoapods-imy-bin/config/config_asker.rb +57 -0
  22. data/lib/cocoapods-imy-bin/config/config_builder.rb +179 -0
  23. data/lib/cocoapods-imy-bin/config/config_hot_key.rb +103 -0
  24. data/lib/cocoapods-imy-bin/config/config_hot_key_asker.rb +57 -0
  25. data/lib/cocoapods-imy-bin/gem_version.rb +10 -0
  26. data/lib/cocoapods-imy-bin/helpers.rb +4 -0
  27. data/lib/cocoapods-imy-bin/helpers/build_helper.rb +150 -0
  28. data/lib/cocoapods-imy-bin/helpers/framework.rb +62 -0
  29. data/lib/cocoapods-imy-bin/helpers/framework_builder.rb +307 -0
  30. data/lib/cocoapods-imy-bin/helpers/library.rb +54 -0
  31. data/lib/cocoapods-imy-bin/helpers/library_builder.rb +90 -0
  32. data/lib/cocoapods-imy-bin/helpers/local/loca_llibrary.rb +57 -0
  33. data/lib/cocoapods-imy-bin/helpers/local/local_build_helper.rb +146 -0
  34. data/lib/cocoapods-imy-bin/helpers/local/local_framework.rb +65 -0
  35. data/lib/cocoapods-imy-bin/helpers/local/local_framework_builder.rb +174 -0
  36. data/lib/cocoapods-imy-bin/helpers/local/local_library_builder.rb +92 -0
  37. data/lib/cocoapods-imy-bin/helpers/sources_helper.rb +33 -0
  38. data/lib/cocoapods-imy-bin/helpers/spec_creator.rb +170 -0
  39. data/lib/cocoapods-imy-bin/helpers/spec_files_helper.rb +77 -0
  40. data/lib/cocoapods-imy-bin/helpers/spec_source_creator.rb +171 -0
  41. data/lib/cocoapods-imy-bin/helpers/upload_helper.rb +84 -0
  42. data/lib/cocoapods-imy-bin/native.rb +19 -0
  43. data/lib/cocoapods-imy-bin/native/acknowledgements.rb +27 -0
  44. data/lib/cocoapods-imy-bin/native/analyzer.rb +53 -0
  45. data/lib/cocoapods-imy-bin/native/installation_options.rb +25 -0
  46. data/lib/cocoapods-imy-bin/native/installer.rb +115 -0
  47. data/lib/cocoapods-imy-bin/native/linter.rb +26 -0
  48. data/lib/cocoapods-imy-bin/native/path_source.rb +33 -0
  49. data/lib/cocoapods-imy-bin/native/pod_source_installer.rb +19 -0
  50. data/lib/cocoapods-imy-bin/native/podfile.rb +91 -0
  51. data/lib/cocoapods-imy-bin/native/podfile_env.rb +37 -0
  52. data/lib/cocoapods-imy-bin/native/podfile_generator.rb +190 -0
  53. data/lib/cocoapods-imy-bin/native/podspec_finder.rb +25 -0
  54. data/lib/cocoapods-imy-bin/native/resolver.rb +230 -0
  55. data/lib/cocoapods-imy-bin/native/sandbox_analyzer.rb +34 -0
  56. data/lib/cocoapods-imy-bin/native/source.rb +35 -0
  57. data/lib/cocoapods-imy-bin/native/sources_manager.rb +20 -0
  58. data/lib/cocoapods-imy-bin/native/specification.rb +31 -0
  59. data/lib/cocoapods-imy-bin/native/validator.rb +77 -0
  60. data/lib/cocoapods-imy-bin/source_provider_hook.rb +54 -0
  61. data/lib/cocoapods_plugin.rb +3 -0
  62. data/spec/command/bin_spec.rb +12 -0
  63. data/spec/spec_helper.rb +50 -0
  64. metadata +180 -0
@@ -0,0 +1,37 @@
1
+
2
+
3
+ module Pod
4
+ class Podfile
5
+ USE_BINARIES = 'use_binaries'
6
+ USE_SOURCE_PODS = 'use_source_pods'
7
+ USE_BINARIES_SELECTOR = 'use_binaries_selector'
8
+ ALLOW_PRERELEASE = 'allow_prerelease'
9
+ USE_PLUGINS = 'use_plugins'
10
+ CONFIGURATION_ENV = 'configuration_env'
11
+
12
+ module ENVExecutor
13
+ def execute_with_bin_plugin(&block)
14
+ execute_with_key(USE_PLUGINS, -> { 'cocoapods-imy-bin' }, &block)
15
+ end
16
+
17
+ def execute_with_allow_prerelease(allow_prerelease, &block)
18
+ execute_with_key(ALLOW_PRERELEASE, -> { allow_prerelease ? 'true' : 'false' }, &block)
19
+ end
20
+
21
+ def execute_with_use_binaries(use_binaries, &block)
22
+ execute_with_key(USE_BINARIES, -> { use_binaries ? 'true' : 'false' }, &block)
23
+ end
24
+
25
+ def execute_with_key(key, value_returner)
26
+ origin_value = ENV[key]
27
+ ENV[key] = value_returner.call
28
+
29
+ yield if block_given?
30
+
31
+ ENV[key] = origin_value
32
+ end
33
+ end
34
+
35
+ extend ENVExecutor
36
+ end
37
+ end
@@ -0,0 +1,190 @@
1
+
2
+
3
+ require 'parallel'
4
+ require 'cocoapods'
5
+ require 'cocoapods-imy-bin/native/pod_source_installer'
6
+
7
+
8
+ require 'parallel'
9
+ require 'cocoapods'
10
+
11
+ module Pod
12
+ module Generate
13
+ # Generates podfiles for pod specifications given a configuration.
14
+ #
15
+ class PodfileGenerator
16
+ # @return [Podfile] a podfile suitable for installing the given spec
17
+ #
18
+ # @param [Specification] spec
19
+ #
20
+ alias old_podfile_for_spec podfile_for_spec
21
+
22
+ def podfile_for_spec(spec)
23
+ generator = self
24
+ dir = configuration.gen_dir_for_pod(spec.name)
25
+
26
+ Pod::Podfile.new do
27
+ project "#{spec.name}.xcodeproj"
28
+ workspace "#{spec.name}.xcworkspace"
29
+
30
+ plugin 'cocoapods-generate'
31
+
32
+ install! 'cocoapods', generator.installation_options
33
+
34
+ generator.podfile_plugins.each do |name, options|
35
+ plugin(*[name, options].compact)
36
+ end
37
+
38
+ use_frameworks!(generator.configuration.use_frameworks?)
39
+
40
+ if (supported_swift_versions = generator.supported_swift_versions)
41
+ supports_swift_versions(supported_swift_versions)
42
+ end
43
+
44
+ # Explicitly set sources
45
+ generator.configuration.sources.each do |source_url|
46
+ source(source_url)
47
+ end
48
+
49
+ self.defined_in_file = dir.join('CocoaPods.podfile.yaml')
50
+
51
+ test_specs = spec.recursive_subspecs.select(&:test_specification?)
52
+ app_specs = if spec.respond_to?(:app_specification?)
53
+ spec.recursive_subspecs.select(&:app_specification?)
54
+ else
55
+ []
56
+ end
57
+
58
+ # Stick all of the transitive dependencies in an abstract target.
59
+ # This allows us to force CocoaPods to use the versions / sources / external sources
60
+ # that we want.
61
+ # By using an abstract target,
62
+
63
+ # 会导致多个dependencies出现, 注释by slj
64
+ # abstract_target 'Transitive Dependencies' do
65
+ # pods_for_transitive_dependencies = [spec.name]
66
+ # .concat(test_specs.map(&:name))
67
+ # .concat(test_specs.flat_map { |ts| ts.dependencies.flat_map(&:name) })
68
+ # .concat(app_specs.map(&:name))
69
+ # .concat(app_specs.flat_map { |as| as.dependencies.flat_map(&:name) })
70
+ #
71
+ # dependencies = generator
72
+ # .transitive_dependencies_by_pod
73
+ # .values_at(*pods_for_transitive_dependencies)
74
+ # .compact
75
+ # .flatten(1)
76
+ # .uniq
77
+ # .sort_by(&:name)
78
+ # .reject { |d| d.root_name == spec.root.name }
79
+ #
80
+ # dependencies.each do |dependency|
81
+ # pod_args = generator.pod_args_for_dependency(self, dependency)
82
+ # pod(*pod_args)
83
+ # end
84
+ # end
85
+
86
+ # Add platform-specific concrete targets that inherit the
87
+ # `pod` declaration for the local pod.
88
+ spec_platform_names = spec.available_platforms.map(&:string_name).flatten.each.reject do |platform_name|
89
+ !generator.configuration.platforms.nil? && !generator.configuration.platforms.include?(platform_name.downcase)
90
+ end
91
+
92
+ spec_platform_names.sort.each do |platform_name|
93
+ target "App-#{platform_name}" do
94
+ current_target_definition.swift_version = generator.swift_version if generator.swift_version
95
+ end
96
+ end
97
+
98
+ # this block has to come _before_ inhibit_all_warnings! / use_modular_headers!,
99
+ # and the local `pod` declaration
100
+ # 会导致多个dependencies出现, 注释by slj
101
+
102
+
103
+ inhibit_all_warnings! if generator.inhibit_all_warnings?
104
+ use_modular_headers! if generator.use_modular_headers?
105
+
106
+ # This is the pod declaration for the local pod,
107
+ # it will be inherited by the concrete target definitions below
108
+
109
+ pod_options = generator.dependency_compilation_kwargs(spec.name)
110
+ pod_options[:path] = spec.defined_in_file.relative_path_from(dir).to_s
111
+ # generator.configuration.podfile.dependencies[0].external_source
112
+
113
+
114
+ { testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
115
+ pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
116
+ end
117
+
118
+ pod spec.name, **pod_options
119
+
120
+ if Pod::Config.instance.podfile
121
+ target_definitions['Pods'].instance_exec do
122
+ target_definition = nil
123
+ Pod::Config.instance.podfile.target_definition_list.each do |target|
124
+ if target.label == "Pods-#{spec.name}"
125
+ target_definition = target
126
+ break
127
+ end
128
+ end
129
+ if target_definition
130
+ value = target_definition.to_hash['dependencies']
131
+ next if value.blank?
132
+ #删除 本地库中的 spec.name,因为本地的./spec.name地址是错的
133
+ value.each do |f|
134
+ if f.is_a?(Hash) && f.keys.first == spec.name
135
+ value.delete f
136
+ break
137
+ end
138
+ end
139
+ old_value = self.to_hash['dependencies'].first
140
+ value << old_value unless (old_value == nil || value.include?(old_value))
141
+
142
+ set_hash_value(%w(dependencies).first, value)
143
+
144
+ value = target_definition.to_hash['configuration_pod_whitelist']
145
+ next if value.blank?
146
+ set_hash_value(%w(configuration_pod_whitelist).first, value)
147
+
148
+ # self.children = Array.new
149
+ end
150
+
151
+ end
152
+
153
+ end
154
+
155
+ # if generator.configuration && generator.configuration.podfile
156
+ # #变量本地podfile下的dependencies 写入新的验证文件中,指定依赖源
157
+ # generator.configuration.podfile.dependencies.each { |dependencies|
158
+ # #如果不存在dependencies.external_source,就不变量
159
+ # next unless dependencies.external_source
160
+ #
161
+ # dependencies.external_source.each { |key_d, value|
162
+ # pod_options = generator.dependency_compilation_kwargs(dependencies.name)
163
+ # pod_options[key_d] = value.to_s
164
+ # { testspecs: test_specs, appspecs: app_specs }.each do |key, specs|
165
+ # pod_options[key] = specs.map { |s| s.name.sub(%r{^#{Regexp.escape spec.root.name}/}, '') }.sort unless specs.empty?
166
+ # end
167
+ # # 过滤 dependencies.name == spec.name
168
+ # pod(dependencies.name, **pod_options) unless dependencies.name == spec.name
169
+ # }
170
+ # }
171
+ # end
172
+
173
+
174
+ # Implement local-sources option to set up dependencies to podspecs in the local filesystem.
175
+ next if generator.configuration.local_sources.empty?
176
+ generator.transitive_local_dependencies(spec, generator.configuration.local_sources).each do |dependency, podspec_file|
177
+ pod_options = generator.dependency_compilation_kwargs(dependency.name)
178
+ pod_options[:path] = if podspec_file[0] == '/' # absolute path
179
+ podspec_file
180
+ else
181
+ '../../' + podspec_file
182
+ end
183
+ pod dependency.name, **pod_options
184
+ end
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+
@@ -0,0 +1,25 @@
1
+
2
+
3
+ require 'cocoapods-imy-bin/native/specification'
4
+
5
+ module Pod
6
+ class Sandbox
7
+ class PodspecFinder
8
+ def podspecs
9
+ return @specs_by_name if @specs_by_name
10
+
11
+ @specs_by_name = {}
12
+ spec_files = Pathname.glob(root + '{,*}.podspec{,.json}')
13
+ # pod 指向分支时,如果目标组件有 subspec ,并且有 template spec ,request 之后使用的 spec 不应该为 template spec
14
+ # 这里做下过滤
15
+ spec_files = spec_files.reject { |p| Specification::DEFAULT_TEMPLATE_EXTNAME.find { |e| p.to_s.end_with?(e) } }
16
+ spec_files.sort_by { |p| -p.to_path.split(File::SEPARATOR).size }.each do |file|
17
+ spec = Specification.from_file(file)
18
+ spec.validate_cocoapods_version
19
+ @specs_by_name[spec.name] = spec
20
+ end
21
+ @specs_by_name
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,230 @@
1
+
2
+
3
+ require 'parallel'
4
+ require 'cocoapods'
5
+ require 'cocoapods-imy-bin/native/podfile'
6
+ require 'cocoapods-imy-bin/native/sources_manager'
7
+ require 'cocoapods-imy-bin/native/installation_options'
8
+ require 'cocoapods-imy-bin/gem_version'
9
+ require 'cocoapods-imy-bin/command/bin/archive'
10
+
11
+ module Pod
12
+ class Resolver
13
+ if Pod.match_version?('~> 1.6')
14
+ # 其实不用到 resolver_specs_by_target 再改 spec
15
+ # 在这个方法里面,通过修改 dependency 的 source 应该也可以
16
+ # 就是有一点,如果改了之后,对应的 source 没有符合 dependency 的版本
17
+ # 分析依赖阶段就会报错了,没法像 resolver_specs_by_target 一样
18
+ # 没有对应的二进制版本时还可以转到源码源码
19
+ #
20
+ def aggregate_for_dependency(dependency)
21
+ sources_manager = Config.instance.sources_manager
22
+ if dependency&.podspec_repo
23
+ sources_manager.aggregate_for_dependency(dependency)
24
+ # 采用 lock 中的 source ,会导致插件对 source 的先后调整失效
25
+ # elsif (locked_vertex = @locked_dependencies.vertex_named(dependency.name)) && (locked_dependency = locked_vertex.payload) && locked_dependency.podspec_repo
26
+ # sources_manager.aggregate_for_dependency(locked_dependency)
27
+ else
28
+ @aggregate ||= Source::Aggregate.new(sources)
29
+ end
30
+ end
31
+ end
32
+
33
+ if Pod.match_version?('~> 1.4')
34
+ def specifications_for_dependency(dependency, additional_requirements_frozen = [])
35
+ additional_requirements = additional_requirements_frozen.dup.compact
36
+ requirement = Requirement.new(dependency.requirement.as_list + additional_requirements.flat_map(&:as_list))
37
+ if podfile.allow_prerelease? && !requirement.prerelease?
38
+ requirement = Requirement.new(dependency.requirement.as_list.map { |r| r + '.a' } + additional_requirements.flat_map(&:as_list))
39
+ end
40
+
41
+ options = if Pod.match_version?('~> 1.7')
42
+ podfile.installation_options
43
+ else
44
+ installation_options
45
+ end
46
+
47
+ if Pod.match_version?('~> 1.8')
48
+ specifications = find_cached_set(dependency)
49
+ .all_specifications(options.warn_for_multiple_pod_sources, requirement)
50
+ else
51
+ specifications = find_cached_set(dependency)
52
+ .all_specifications(options.warn_for_multiple_pod_sources)
53
+ .select { |s| requirement.satisfied_by? s.version }
54
+ end
55
+
56
+ specifications
57
+ .map { |s| s.subspec_by_name(dependency.name, false, true) }
58
+ .compact
59
+ end
60
+ end
61
+
62
+ if Pod.match_version?('~> 1.6')
63
+ alias old_valid_possibility_version_for_root_name? valid_possibility_version_for_root_name?
64
+
65
+ def valid_possibility_version_for_root_name?(requirement, activated, spec)
66
+ return true if podfile.allow_prerelease?
67
+
68
+ old_valid_possibility_version_for_root_name?(requirement, activated, spec)
69
+ end
70
+ elsif Pod.match_version?('~> 1.4')
71
+ def requirement_satisfied_by?(requirement, activated, spec)
72
+ version = spec.version
73
+ return false unless requirement.requirement.satisfied_by?(version)
74
+
75
+ shared_possibility_versions, prerelease_requirement = possibility_versions_for_root_name(requirement, activated)
76
+ if !shared_possibility_versions.empty? && !shared_possibility_versions.include?(version)
77
+ return false
78
+ end
79
+ if !podfile.allow_prerelease? && version.prerelease? && !prerelease_requirement
80
+ return false
81
+ end
82
+ unless spec_is_platform_compatible?(activated, requirement, spec)
83
+ return false
84
+ end
85
+
86
+ true
87
+ end
88
+ end
89
+
90
+ # >= 1.4.0 才有 resolver_specs_by_target 以及 ResolverSpecification
91
+ # >= 1.5.0 ResolverSpecification 才有 source,供 install 或者其他操作时,输入 source 变更
92
+ #
93
+ if Pod.match_version?('~> 1.4')
94
+ old_resolver_specs_by_target = instance_method(:resolver_specs_by_target)
95
+ define_method(:resolver_specs_by_target) do
96
+ specs_by_target = old_resolver_specs_by_target.bind(self).call
97
+
98
+ sources_manager = Config.instance.sources_manager
99
+ use_source_pods = podfile.use_source_pods
100
+
101
+ missing_binary_specs = []
102
+ specs_by_target.each do |target, rspecs|
103
+ # use_binaries 并且 use_source_pods 不包含 本地可过滤
104
+ use_binary_rspecs = if podfile.use_binaries? || podfile.use_binaries_selector
105
+ rspecs.select do |rspec|
106
+ ([rspec.name, rspec.root.name] & use_source_pods).empty? &&
107
+ (podfile.use_binaries_selector.nil? || podfile.use_binaries_selector.call(rspec.spec))
108
+ end
109
+ else
110
+ []
111
+ end
112
+
113
+ # Parallel.map(rspecs, in_threads: 8) do |rspec|
114
+ specs_by_target[target] = rspecs.map do |rspec|
115
+ # 含有 subspecs 的组件暂不处理
116
+ # next rspec if rspec.spec.subspec? || rspec.spec.subspecs.any?
117
+
118
+ # developments 组件采用默认输入的 spec (development pods 的 source 为 nil)
119
+ # 可以使 :podspec => "htts://IMYFoundation.podspec"可以走下去,by slj
120
+ # unless rspec.spec.respond_to?(:spec_source) && rspec.spec.spec_source
121
+ # next rspec
122
+ # end
123
+
124
+ # 采用二进制依赖并且不为开发组件
125
+ use_binary = use_binary_rspecs.include?(rspec)
126
+ source = use_binary ? sources_manager.binary_source : sources_manager.code_source
127
+
128
+ spec_version = rspec.spec.version
129
+ UI.message 'cocoapods-imy-bin 插件'
130
+ UI.message "- 开始处理 #{rspec.spec.name} #{spec_version} 组件."
131
+
132
+ begin
133
+ # 从新 source 中获取 spec,在bin archive中会异常,因为找不到
134
+ specification = source.specification(rspec.root.name, spec_version)
135
+ UI.message "#{rspec.root.name} #{spec_version} \r\n specification =#{specification} "
136
+ # 组件是 subspec
137
+ if rspec.spec.subspec?
138
+ specification = specification.subspec_by_name(rspec.name, false, true)
139
+ end
140
+ # 这里可能出现分析依赖的 source 和切换后的 source 对应 specification 的 subspec 对应不上
141
+ # 造成 subspec_by_name 返回 nil,这个是正常现象
142
+ next unless specification
143
+
144
+ used_by_only = if Pod.match_version?('~> 1.7')
145
+ rspec.used_by_non_library_targets_only
146
+ else
147
+ rspec.used_by_tests_only
148
+ end
149
+ # used_by_only = rspec.respond_to?(:used_by_tests_only) ? rspec.used_by_tests_only : rspec.used_by_non_library_targets_only
150
+ # 组装新的 rspec ,替换原 rspec
151
+ if use_binary
152
+ rspec = if Pod.match_version?('~> 1.4.0')
153
+ ResolverSpecification.new(specification, used_by_only)
154
+ else
155
+ ResolverSpecification.new(specification, used_by_only, source)
156
+ end
157
+ UI.message "组装新的 rspec ,替换原 rspec #{rspec.root.name} #{spec_version} \r\n specification =#{specification} \r\n #{rspec} "
158
+
159
+ end
160
+
161
+ rescue Pod::StandardError => e
162
+ # 没有从新的 source 找到对应版本组件,直接返回原 rspec
163
+
164
+ # missing_binary_specs << rspec.spec if use_binary
165
+ missing_binary_specs << rspec.spec
166
+ rspec
167
+ end
168
+
169
+ rspec
170
+ end.compact
171
+ end
172
+
173
+ if missing_binary_specs.any?
174
+ missing_binary_specs.uniq.each do |spec|
175
+ UI.message "【#{spec.name} | #{spec.version}】组件无对应二进制版本 , 将采用源码依赖."
176
+ end
177
+ Pod::Command::Bin::Archive.missing_binary_specs(missing_binary_specs)
178
+
179
+ #缓存没有二进制组件到spec文件,local_psec_dir 目录
180
+ sources_sepc = []
181
+ des_dir = CBin::Config::Builder.instance.local_psec_dir
182
+ FileUtils.rm_f(des_dir) if File.exist?des_dir
183
+ Dir.mkdir des_dir unless File.exist?des_dir
184
+ missing_binary_specs.uniq.each do |spec|
185
+ next if spec.name.include?('/')
186
+
187
+ spec_git_res = false
188
+ CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
189
+ spec_git_res = spec.source[:git] && spec.source[:git].include?(ignore_git)
190
+ break if spec_git_res
191
+ end
192
+ next if spec_git_res
193
+
194
+ #获取没有制作二进制版本的spec集合
195
+ sources_sepc << spec
196
+ unless spec.defined_in_file.nil?
197
+ FileUtils.cp("#{spec.defined_in_file}", "#{des_dir}")
198
+ end
199
+ end
200
+ end
201
+
202
+ specs_by_target
203
+ end
204
+ end
205
+ end
206
+
207
+ if Pod.match_version?('~> 1.4.0')
208
+ # 1.4.0 没有 spec_source
209
+ class Specification
210
+ class Set
211
+ class LazySpecification < BasicObject
212
+ attr_reader :spec_source
213
+
214
+ old_initialize = instance_method(:initialize)
215
+ define_method(:initialize) do |name, version, source|
216
+ old_initialize.bind(self).call(name, version, source)
217
+
218
+ @spec_source = source
219
+ end
220
+
221
+ def respond_to?(method, include_all = false)
222
+ return super unless method == :spec_source
223
+
224
+ true
225
+ end
226
+ end
227
+ end
228
+ end
229
+ end
230
+ end