Commit 9d1808da authored by Ian Ynda-Hummel's avatar Ian Ynda-Hummel

Only use help! when validating command-line arguments.

parent c4dd56e9
......@@ -23,13 +23,14 @@ module Pod
def validate!
super
help! "Existing Podfile found in directory" unless config.podfile.nil?
unless @project_path
help! "No xcode project found, please specify one" unless @project_paths.length > 0
help! "Multiple xcode projects found, please specify one" unless @project_paths.length == 1
raise Informative, "Existing Podfile found in directory" unless config.podfile.nil?
if @project_path
help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path
else
raise Informative, "No xcode project found, please specify one" unless @project_paths.length > 0
raise Informative, "Multiple xcode projects found, please specify one" unless @project_paths.length == 1
@project_path = @project_paths.first
end
help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path
@xcode_project = Xcodeproj::Project.new(@project_path)
end
......
......@@ -7,7 +7,7 @@ module Pod
describe Command::Init do
it "complains if project does not exist" do
lambda { run_command('init') }.should.raise CLAide::Help
lambda { run_command('init') }.should.raise Informative
lambda { run_command('init', 'foo.xcodeproj') }.should.raise CLAide::Help
end
......@@ -19,7 +19,7 @@ module Pod
Dir.chdir(temporary_directory) do
Xcodeproj::Project.new.save_as(temporary_directory + 'test1.xcodeproj')
Xcodeproj::Project.new.save_as(temporary_directory + 'test2.xcodeproj')
lambda { run_command('init') }.should.raise CLAide::Help
lambda { run_command('init') }.should.raise Informative
end
end
......@@ -27,7 +27,7 @@ module Pod
Dir.chdir(temporary_directory) do
(Pathname.pwd + 'Podfile').open('w') { |f| f << "pod 'AFNetworking'" }
Xcodeproj::Project.new.save_as(temporary_directory + 'test1.xcodeproj')
lambda { run_command('init') }.should.raise CLAide::Help
lambda { run_command('init') }.should.raise Informative
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