Class: Pod::Command::Binary::Lib::Import
- Inherits:
-
Pod::Command::Binary::Lib
- Object
- Pod::Command
- Pod::Command::Binary
- Pod::Command::Binary::Lib
- Pod::Command::Binary::Lib::Import
- Defined in:
- lib/cocoapods-tdfire-binary/command/lib/import.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Import
constructor
A new instance of Import.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pod::Command::Binary
#binary_config, #first_podspec, #private_sources
Constructor Details
#initialize(argv) ⇒ Import
Returns a new instance of Import.
19 20 21 22 23 |
# File 'lib/cocoapods-tdfire-binary/command/lib/import.rb', line 19 def initialize(argv) @path = argv.shift_argument @spec_file = first_podspec super end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cocoapods-tdfire-binary/command/lib/import.rb', line 30 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. "Tdfire: import public header files #{public_header_files.map(&:to_s)}" header_generator.imports = public_header_files header_generator.save_as(@path) end end |
#validate! ⇒ Object
25 26 27 28 |
# File 'lib/cocoapods-tdfire-binary/command/lib/import.rb', line 25 def validate! super help! '当前目录下没有podspec文件.' if @spec_file.nil? end |