Sha256: 7a4ef4e3c34ea6b7c46f8520286a17763e0dcbdd4db2b785b606ade352bffa54

Contents?: true

Size: 1.77 KB

Versions: 23

Compression:

Stored size: 1.77 KB

Contents

require 'cocoapods'
require 'cocoapods-tdfire-binary/binary_url_manager'

module Pod
  class Command
    class Binary < Command
      class Lib < Binary
      	class Import < Lib
      		self.abstract_command = false
	        self.summary = '根据 podspec 生成伞头文件'
	        self.description = <<-DESC
						根据 podspec 生成伞头文件, 没有将根据组件名创建, 已存在直接替换
	        DESC

	        self.arguments = [
            CLAide::Argument.new('PATH', false),
        	]

	        def initialize(argv)
	        	@path = argv.shift_argument 
	        	@spec_file = first_podspec
	          super
	        end

	        def validate!
	          super
	          help! '当前目录下没有podspec文件.' if @spec_file.nil?
	        end

	        def run
	          UI.section("Tdfire: import public header files to #{@path} ...") do
	          	pod_name = @spec_file.split('.').first
	          	@path ||= "#{pod_name}.h"
	          	@path = Pathname.new(@path)

	          	header_generator = Pod::Generator::Header.new(Platform.ios)  
	          	spec = Pod::Specification.from_file(Pathname.new(@spec_file))
	          	public_header_files = spec.consumer(:ios).public_header_files
	          	public_header_files = spec.consumer(:ios).source_files if public_header_files.empty?
	          	public_header_files = Pathname.glob(public_header_files).map(&:basename).select do |pathname|
	          		pathname.extname.to_s == '.h' &&
	          		pathname.basename('.h').to_s != pod_name
	          	end

	          	UI.message "Tdfire: import public header files #{public_header_files.map(&:to_s)}"

	          	header_generator.imports = public_header_files
	          	header_generator.save_as(@path)
	          end
	        end
      	end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
cocoapods-tdfire-binary-2.0.9 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-2.0.8 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-2.0.7 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-2.0.6 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-2.0.5 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-2.0.4 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-2.0.3 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.30 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.29 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.28 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.26 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.25 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.24 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.23 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.22 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.21 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.20 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.19 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.4.18 lib/cocoapods-tdfire-binary/command/lib/import.rb
cocoapods-tdfire-binary-1.3.18 lib/cocoapods-tdfire-binary/command/lib/import.rb