Permalink
Browse files

Allow the user to use the Podfile#post_install hook. Closes #8.

  • Loading branch information...
1 parent d841766 commit e5d196f366267c56402f1113b380d2029d644f3c @alloy alloy committed May 11, 2012
Showing with 20 additions and 4 deletions.
  1. +4 −0 lib/motion/project/cocoapods.rb
  2. +16 −4 spec/cocoapods_spec.rb
@@ -65,6 +65,10 @@ def dependency(*name_and_version_requirements, &block)
@podfile.dependency(*name_and_version_requirements, &block)
end
+ def post_install(&block)
+ @podfile.post_install(&block)
+ end
+
def pods_installer
@installer ||= Pod::Installer.new(@podfile)
end
View
@@ -9,21 +9,31 @@ class Vendor
describe "CocoaPodsConfig" do
extend SpecHelper::TemporaryDirectory
+ def podfile=(podfile); @podfile = podfile; end
+ def installer=(installer); @installer = installer; end
+ def installer_from_post_install_hook=(installer); @installer_from_post_install_hook = installer; end
+
before do
#ENV['COCOAPODS_VERBOSE'] = '1'
Pod::Config.instance.repos_dir = ROOT + 'spec/fixtures/spec-repos'
- podfile = nil
+ context = self
@config = Motion::Project::Config.new(temporary_directory.to_s, :development)
@config.instance_eval do
pods do
- podfile = @podfile
+ context.podfile = @podfile
dependency 'Reachability', '2.0.4' # the one that comes with ASIHTTPRequest
dependency 'ASIHTTPRequest', '1.8.1'
+ post_install do |installer|
+ context.installer_from_post_install_hook = installer
+ end
+
+ context.installer = pods_installer
+
if pods_installer.respond_to?(:dependency_specifications)
specs = pods_installer.dependency_specifications
else
@@ -34,8 +44,6 @@ class Vendor
spec.libraries = 'z.1', 'xml2'
end
end
-
- @podfile = podfile
end
it "installs the Pods to vendor/Pods" do
@@ -67,4 +75,8 @@ class Vendor
@config.frameworks.sort.should == %w{ CFNetwork CoreGraphics Foundation MobileCoreServices SystemConfiguration UIKit }
@config.libs.sort.should == %w{ /usr/lib/libxml2.dylib /usr/lib/libz.1.dylib }
end
+
+ it "runs the pos_install hook" do
+ @installer_from_post_install_hook.should == @installer
+ end
end

0 comments on commit e5d196f

Please sign in to comment.