class CBin::Library::Builder
Public Class Methods
new(spec, file_accessor, platform, source_dir,framework_path)
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 14 def initialize(spec, file_accessor, platform, source_dir,framework_path) @spec = spec @source_dir = source_dir @file_accessor = file_accessor @platform = platform @framework = framework_path @source_files = "#{@source_dir}/#{library.name_path}" @source_zip_file = "#{@source_files}.zip" end
Public Instance Methods
build()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 24 def build UI.section("Building static library #{@spec}") do clean_source_dir copy_headers copy_library copy_resources cp_to_source_dir end end
Private Instance Methods
clean_source_dir()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 39 def clean_source_dir FileUtils.rm_rf(@source_files) if File.exist?(@source_files) FileUtils.rm_rf(@source_zip_file) if File.exist?(@source_zip_file) end
copy_headers()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 52 def copy_headers FileUtils.cp_r(framework.headers_path,library.versions_path) if File.exist?(framework.headers_path) end
copy_library()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 56 def copy_library src_file = "#{framework.versions_path}/#{@spec.name}" unless File.exist?(src_file) raise Informative, "framework没有文件:#{src_file}" end dest_file = "#{library.versions_path}/#{@spec.name}" rename_dest_file = "#{library.versions_path}/lib#{@spec.name}.a" FileUtils.cp_r(src_file,dest_file) File.rename(dest_file, rename_dest_file ) if File.exist?(dest_file) end
copy_resources()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 68 def copy_resources FileUtils.cp_r(framework.resources_path,library.versions_path) if File.exist?(framework.resources_path) end
cp_to_source_dir()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 44 def cp_to_source_dir target_dir = library.versions_path dest_file = "#{@source_dir}/#{library.name_path}" FileUtils.rm_rf(dest_file) if File.exist?(dest_file) `cp -fa #{target_dir} #{dest_file}/` end
framework()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 73 def framework @framework ||= begin framework = Framework.new(@spec.name, @platform.name.to_s) framework.make framework end end
library()
click to toggle source
# File lib/cocoapods-lhj-bin/helpers/library_builder.rb, line 81 def library @library ||= begin library = Library.new(@spec.name, @platform.name.to_s,@spec.version) library.make library end end