lib/cocoapods-tj/helpers/spec_creator.rb in cocoapods-tj-1.0.2 vs lib/cocoapods-tj/helpers/spec_creator.rb in cocoapods-tj-1.0.3
- old
+ new
@@ -5,15 +5,17 @@
module CBin
class Specification
class Creator
attr_reader :code_spec
+ attr_reader :binary_source #二进制仓库地址
attr_reader :template_spec
attr_reader :spec
- def initialize(code_spec, template_spec, platforms = 'ios')
+ def initialize(code_spec, binary_source, template_spec, platforms = 'ios')
@code_spec = code_spec
+ @binary_source = binary_source
@template_spec = template_spec
@platforms = Array(platforms)
validate!
end
@@ -48,11 +50,11 @@
def clear_spec_file
File.delete(filename) if File.exist?(filename)
end
def filename
- @filename ||= "#{spec.name}.binary.podspec.json"
+ @filename ||= "#{spec.name}.podspec.json"
end
private
def create_from_code_spec
@@ -65,11 +67,11 @@
extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
if code_spec_consumer.resources.any?
extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
end
if extnames.any?
- @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
+ @spec.resources = framework_contents_root().flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
end
# Source Location
@spec.source = binary_source
@@ -83,11 +85,11 @@
spec_hash.delete('resource_bundles')
spec_hash.delete('exclude_files')
spec_hash.delete('preserve_paths')
spec_hash.delete('vendored_libraries')
- spec_hash['vendored_libraries'] = binary_vendored_libraries
+ # spec_hash['vendored_libraries'] = binary_vendored_libraries
platforms = spec_hash['platforms']
selected_platforms = platforms.select { |k, _v| @platforms.include?(k) }
spec_hash['platforms'] = selected_platforms.empty? ? platforms : selected_platforms
@@ -102,28 +104,32 @@
@spec.version = code_spec.version
@spec.source = binary_source
@spec.source_files = binary_source_files
@spec.public_header_files = binary_public_header_files
- @spec.vendored_libraries = binary_vendored_libraries
+ # @spec.vendored_libraries = binary_vendored_libraries
@spec.resources = binary_resources if @spec.attributes_hash.keys.include?("resources")
@spec
end
def binary_source
- { http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
+ { git: @binary_source, tag:code_spec.version }
end
def code_spec_consumer(_platform = :ios)
code_spec.consumer(:ios)
end
def framework_contents(name)
["#{code_spec.root.name}.framework", "#{code_spec.root.name}.framework/Versions/A"].map { |path| "#{path}/#{name}" }
+ end
+
+ def framework_contents_root()
+ ["#{code_spec.root.name}.framework", "#{code_spec.root.name}.framework/Versions/A"]
end
def binary_source_files
{ http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
end