Commit cd931998 authored by Ben Scheirman's avatar Ben Scheirman Committed by Eloy Duran

Raise an informative error if xcodeproj is not present in Podfile, for now.

parent ff71c745
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*.rbo *.rbo
*.gem *.gem
.DS_Store .DS_Store
.rbenv-version
xcuserdata xcuserdata
project.xcworkspace project.xcworkspace
DerivedData DerivedData
......
* No need to pass the project path and podfile separately to UserProjectIntegrator.
* Move Platform#xcodeproj to TargetDefinition#link_with.
* Add multiple-platforms section to changelog. * Add multiple-platforms section to changelog.
* Validate platforms for each target definition. * Validate platforms for each target definition.
* Validate that there are dependencies in a Podfile. * Validate that there are dependencies in a Podfile.
......
...@@ -4,16 +4,22 @@ module Pod ...@@ -4,16 +4,22 @@ module Pod
def self.banner def self.banner
%{Installing dependencies of a project: %{Installing dependencies of a project:
$ pod install [PROJECT] $ pod install
Downloads all dependencies defined in `Podfile' and creates an Xcode Downloads all dependencies defined in `Podfile' and creates an Xcode
Pods library project in `./Pods'. Pods library project in `./Pods'.
In case `PROJECT' is given, it configures it to use the specified Pods The Xcode project file should be specified in your `Podfile` like this:
and generates a workspace with the Pods project and `PROJECT'. (It is
important that once you have run this you open the workspace instead of xcodeproj "path/to/project.xcodeproj"
`PROJECT'.) You usually specify `PROJECT' only the first time that you
run `pod install'. If no xcodeproj is specified, then a search for an Xcode project will
be made. If more than one Xcode project is found, the command will
raise an error.
This will configure the project to reference the Pods static library,
add a build configuration file, and add a post build script to copy
Pod resources.
} }
end end
...@@ -30,7 +36,6 @@ module Pod ...@@ -30,7 +36,6 @@ module Pod
config.doc = !argv.option('--no-doc') config.doc = !argv.option('--no-doc')
config.force_doc = argv.option('--force-doc') config.force_doc = argv.option('--force-doc')
@update_repo = !argv.option('--no-update') @update_repo = !argv.option('--no-update')
@projpath = argv.shift_argument
super unless argv.empty? super unless argv.empty?
end end
...@@ -38,13 +43,22 @@ module Pod ...@@ -38,13 +43,22 @@ module Pod
unless podfile = config.podfile unless podfile = config.podfile
raise Informative, "No `Podfile' found in the current working directory." raise Informative, "No `Podfile' found in the current working directory."
end end
if @projpath && !File.exist?(@projpath)
raise Informative, "The specified project `#{@projpath}' does not exist." if podfile.xcodeproj.nil?
raise Informative, "Please specify a valid xcodeproj path in your Podfile.\n\n" +
"Usage:\n\t" +
"xcodeproj 'path/to/project.xcodeproj'"
end
unless File.exist?(podfile.xcodeproj)
raise Informative, "The specified project `#{podfile.xcodeproj}' does not exist."
end end
if @update_repo if @update_repo
puts "\nUpdating Spec Repositories\n".yellow if config.verbose? puts "\nUpdating Spec Repositories\n".yellow if config.verbose?
Repo.new(ARGV.new(["update"])).run Repo.new(ARGV.new(["update"])).run
end end
Installer.new(podfile, @projpath).install! Installer.new(podfile, @projpath).install!
end end
end end
......
...@@ -91,7 +91,7 @@ module Pod ...@@ -91,7 +91,7 @@ module Pod
puts "* Writing Xcode project file to `#{@sandbox.project_path}'\n\n" if config.verbose? puts "* Writing Xcode project file to `#{@sandbox.project_path}'\n\n" if config.verbose?
project.save_as(@sandbox.project_path) project.save_as(@sandbox.project_path)
UserProjectIntegrator.new(@user_project_path, @podfile).integrate! if @user_project_path UserProjectIntegrator.new(@podfile.xcodeproj, @podfile).integrate!
end end
def run_post_install_hooks def run_post_install_hooks
......
require File.expand_path('../../spec_helper', __FILE__)
describe "Pod::Command::Install" do
it "should include instructions on how to reference the xcode project" do
Pod::Command::Install.banner.should.match /xcodeproj path\/to\/project.xcodeproj/
end
before do
@config_before = config
Pod::Config.instance = nil
config.silent = true
end
after do
Pod::Config.instance = @config_before
end
describe "When the Podfile does not specify the xcodeproject" do
before do
config.stubs(:rootspec).returns(Pod::Podfile.new { platform :ios; dependency 'AFNetworking'})
end
it "raises an informative error if the xcodproj is not specified in the podfile" do
installer = Pod::Command::Install.new(Pod::Command::ARGV.new)
should.raise(Pod::Informative) { installer.run }
end
end
end
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