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