Sha256: 187452f6789c0107af994962e7f9063831aa3d0f358b2a077ca53b41cd5bb22f

Contents?: true

Size: 1.7 KB

Versions: 42

Compression:

Stored size: 1.7 KB

Contents

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

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

    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

    def spec_metadata
      spec = spec_header
      spec
    end

    def spec_close
      "end\n"
    end

    private

    def spec_header
      spec = "Pod::Spec.new do |s|\n"

      %w(name version summary license authors homepage description social_media_url
         docset_url documentation_url screenshots frameworks weak_frameworks libraries requires_arc
         deployment_target xcconfig).each do |attribute|
        value = @spec.attributes_hash[attribute]
        next if value.nil?
        value = value.dump if value.class == String
        spec += "  s.#{attribute} = #{value}\n"
      end

      spec + "  s.source = #{@source}\n\n"
    end
  end
end

Version data entries

42 entries across 42 versions & 16 rubygems

Version Path
cocoapods-packager-next-2.0.1 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-next-2.0.0 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-tj-1.5.0 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-test-scl-1.6.2 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-test-scl-1.6.1 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-test-scl-1.6.0 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-test-scl-1.5.0 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-clone-master-1.5.2 lib/cocoapods-packager/spec_builder.rb
cocoapods-panglePackager-1.5.0.2 lib/cocoapods-panglePackager/spec_builder.rb
cocoapods-panglePackager-1.5.0.1 lib/cocoapods-panglePackager/spec_builder.rb
cocoapods-fanQiePackager-1.5.0.1 lib/cocoapods-fanQiePackager/spec_builder.rb
cocoapods-nepackage-0.0.2 lib/cocoapods-nepackager/spec_builder.rb
cocoapods-nepackage-0.0.1 lib/cocoapods-nepackager/spec_builder.rb
cocoapods-packager-m-1.6.4 lib/cocoapods-packager/spec_builder.rb
ty-cocoapods-packager-1.5.13 lib/cocoapods-packager/spec_builder.rb
ty-cocoapods-packager-1.5.12 lib/cocoapods-packager/spec_builder.rb
ty-cocoapods-packager-1.5.11 lib/cocoapods-packager/spec_builder.rb
ty-cocoapods-packager-1.5.10 lib/cocoapods-packager/spec_builder.rb
ty-cocoapods-packager-1.5.9 lib/cocoapods-packager/spec_builder.rb
cocoapods-packager-hira-1.5.6 lib/cocoapods-packager/spec_builder.rb