class Pod::Command::Bin::Umbrella

Public Class Methods

new(argv) click to toggle source
Calls superclass method Pod::Command::Bin::new
# File lib/cocoapods-miBin/command/bin/umbrella.rb, line 13
def initialize(argv)
  @path = Pathname.new(argv.shift_argument || '.')
  @spec_file = code_spec_files.first
  super
end

Public Instance Methods

run() click to toggle source
# File lib/cocoapods-miBin/command/bin/umbrella.rb, line 26
def run
  pod_name = @spec_file.to_s.split('.').first

  @path += "#{pod_name}.h" if @path.directory?

  UI.puts "Generateing umbrella file for #{pod_name}"

  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
  if public_header_files.empty?
    public_header_files = spec.consumer(:ios).source_files
  end
  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

  header_generator.imports = public_header_files

  UI.puts "Save umbrella file to #{@path.expand_path}"

  header_generator.save_as(@path)

  UI.puts 'Done!'.green
end
validate!() click to toggle source
Calls superclass method Pod::Command::Bin#validate!
# File lib/cocoapods-miBin/command/bin/umbrella.rb, line 19
def validate!
  super
  if @spec_file.nil?
    help! '[!] No `Podspec` found in the project directory.'
  end
end