Class: Pod::SpecBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-packager/spec_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(spec, source, embedded, dynamic) ⇒ SpecBuilder

Returns a new instance of SpecBuilder.



3
4
5
6
7
8
# File 'lib/cocoapods-packager/spec_builder.rb', line 3

def initialize(spec, source, embedded, dynamic)
  @spec = spec
  @source = source.nil? ? '{ :path => \'.\' }' : source
  @embedded = embedded
  @dynamic = dynamic
end

Instance Method Details

#framework_pathObject



10
11
12
13
14
15
16
# File 'lib/cocoapods-packager/spec_builder.rb', line 10

def framework_path
  if @embedded
    @spec.name + '.embeddedframework' + '/' + @spec.name + '.framework'
  else
    @spec.name + '.framework'
  end
end

#spec_closeObject



42
43
44
# File 'lib/cocoapods-packager/spec_builder.rb', line 42

def spec_close
  "end\n"
end

#spec_metadataObject



37
38
39
40
# File 'lib/cocoapods-packager/spec_builder.rb', line 37

def 
  spec = spec_header
  spec
end

#spec_platform(platform) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cocoapods-packager/spec_builder.rb', line 18

def spec_platform(platform)
  fwk_base = platform.name.to_s + '/' + framework_path
  spec = <<RB
  s.#{platform.name}.deployment_target    = '#{platform.deployment_target}'
  s.#{platform.name}.vendored_framework   = '#{fwk_base}'
RB

  %w(frameworks weak_frameworks libraries requires_arc xcconfig).each do |attribute|
    attributes_hash = @spec.attributes_hash[platform.name.to_s]
    next if attributes_hash.nil?
    value = attributes_hash[attribute]
    next if value.nil?

    value = "'#{value}'" if value.class == String
    spec += "  s.#{platform.name}.#{attribute} = #{value}\n"
  end
  spec
end