Commit 3c03a9d1 authored by Eloy Duran's avatar Eloy Duran

Add examples on how to install a library from a spec repo, upstream repo,…

Add examples on how to install a library from a spec repo, upstream repo, :podspec, and inline spec.
parent aef7ea0f
platform :ios platform :ios
dependency 'SSToolkit'
dependency 'AFNetworking' dependency 'AFNetworking'
# From a spec repo
#dependency 'SSToolkit'
# Directly from the Pod’s repo
#dependency 'SSToolkit', :git => 'https://github.com/samsoffes/sstoolkit.git'
# Directly from the Pod’s repo with a specific commit (or tag)
#dependency 'SSToolkit', :git => 'https://github.com/samsoffes/sstoolkit.git',
# :commit => '2adcd0f81740d6b0cd4589af98790eee3bd1ae7b'
# From a podspec that's outside a spec repo and the library’s repo
#dependency 'SSToolkit', :podspec => 'https://raw.github.com/gist/1353347/ef1800da9c5f5d267a642b8d3950b41174f2a6d7/SSToolkit-0.1.1.podspec'
# If no podspec is available anywhere, you can define one right in your Podfile
dependency do |s|
s.name = 'SSToolkit'
s.version = '0.1.3'
s.platform = :ios
s.source = { :git => 'https://github.com/samsoffes/sstoolkit.git', :commit => '2adcd0f81740d6b0cd4589af98790eee3bd1ae7b' }
s.resources = 'Resources'
s.source_files = 'SSToolkit/**/*.{h,m}'
s.frameworks = 'QuartzCore', 'CoreGraphics'
def s.post_install(target)
prefix_header = config.project_pods_root + target.prefix_header_filename
prefix_header.open('a') do |file|
file.puts(%{#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif})
end
end
end
...@@ -41,17 +41,21 @@ module Pod ...@@ -41,17 +41,21 @@ module Pod
def specification def specification
@specification ||= begin @specification ||= begin
if @external_spec_source if @external_spec_source
pod_root = Config.instance.project_pods_root + @name config = Config.instance
pod_root = config.project_pods_root + @name
spec = nil spec = nil
if @external_spec_source[:podspec] if @external_spec_source[:podspec]
Config.instance.project_pods_root.mkdir config.project_pods_root.mkpath
spec = Config.instance.project_pods_root + "#{@name}.podspec" spec = config.project_pods_root + "#{@name}.podspec"
source = @external_spec_source[:podspec]
# can be http, file, etc # can be http, file, etc
require 'open-uri' require 'open-uri'
open(@external_spec_source[:podspec]) do |io| puts " * Fetching podspec for `#{@name}' from: #{source}" unless config.silent?
open(source) do |io|
spec.open('w') { |f| f << io.read } spec.open('w') { |f| f << io.read }
end end
else else
puts " * Pre-downloading: `#{@name}'" unless config.silent?
Downloader.for_source(pod_root, @external_spec_source).download Downloader.for_source(pod_root, @external_spec_source).download
spec = pod_root + "#{@name}.podspec" spec = pod_root + "#{@name}.podspec"
end end
......
...@@ -10,6 +10,9 @@ module Pod ...@@ -10,6 +10,9 @@ module Pod
# The file is expected to define and return a Pods::Specification. # The file is expected to define and return a Pods::Specification.
def self.from_file(path) def self.from_file(path)
unless path.exist?
raise Informative, "No podspec exists at path `#{path}'."
end
spec = Pod._eval_podspec(path) spec = Pod._eval_podspec(path)
spec.defined_in_file = path spec.defined_in_file = path
spec spec
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment