Permalink
Browse files

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

…epo, :podspec, and inline spec.
  • Loading branch information...
1 parent aef7ea0 commit 3c03a9d15de7c8b9d5c338718e67aa34e6a87778 @alloy committed Nov 9, 2011
Showing with 43 additions and 6 deletions.
  1. +31 −1 examples/SSCatalog/Podfile
  2. +9 −5 lib/cocoapods/dependency.rb
  3. +3 −0 lib/cocoapods/specification.rb
@@ -1,4 +1,34 @@
platform :ios
-dependency 'SSToolkit'
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 @@ def ==(other)
def specification
@specification ||= begin
if @external_spec_source
- pod_root = Config.instance.project_pods_root + @name
- spec = nil
+ config = Config.instance
+ pod_root = config.project_pods_root + @name
+ spec = nil
if @external_spec_source[:podspec]
- Config.instance.project_pods_root.mkdir
- spec = Config.instance.project_pods_root + "#{@name}.podspec"
+ config.project_pods_root.mkpath
+ spec = config.project_pods_root + "#{@name}.podspec"
+ source = @external_spec_source[:podspec]
# can be http, file, etc
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 }
end
else
+ puts " * Pre-downloading: `#{@name}'" unless config.silent?
Downloader.for_source(pod_root, @external_spec_source).download
spec = pod_root + "#{@name}.podspec"
end
@@ -10,6 +10,9 @@ class Specification
# The file is expected to define and return a Pods::Specification.
def self.from_file(path)
+ unless path.exist?
+ raise Informative, "No podspec exists at path `#{path}'."
+ end
spec = Pod._eval_podspec(path)
spec.defined_in_file = path
spec

0 comments on commit 3c03a9d

Please sign in to comment.