class Pod::Specification

Public Class Methods

from_string(spec_contents, path, subspec_name = nil) click to toggle source
# File lib/cocoapods-force-static-framework/command/framework.rb, line 24
def self.from_string(spec_contents, path, subspec_name = nil)
  path = Pathname.new(path).expand_path
  spec = nil
  case path.extname
  when '.podspec'
    Dir.chdir(path.parent.directory? ? path.parent : Dir.pwd) do
      spec = ::Pod._eval_podspec(spec_contents, path)
      unless spec.is_a?(Specification)
        raise Informative, "Invalid podspec file at path `#{path}`."
      end
    end
  when '.json'
    spec = Specification.from_json(spec_contents)
  else
    raise Informative, "Unsupported specification format `#{path.extname}` for spec at `#{path}`."
  end
  name = ''
  case path.extname
  when '.podspec'
    name = File.basename(path, '.podspec')
  when '.json'
    name = File.basename(path, '.podspec.json')
  end  
  if Pod.all_framework_static or Pod.static_framework_names.include?(name)
    spec.static_framework = true
  end
  spec.defined_in_file = path
  spec.subspec_by_name(subspec_name, true)
end