Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
9d1808da
Commit
9d1808da
authored
Jun 13, 2013
by
Ian Ynda-Hummel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only use help! when validating command-line arguments.
parent
c4dd56e9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
init.rb
lib/cocoapods/command/init.rb
+6
-5
init_spec.rb
spec/functional/command/init_spec.rb
+3
-3
No files found.
lib/cocoapods/command/init.rb
View file @
9d1808da
...
...
@@ -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
...
...
spec/functional/command/init_spec.rb
View file @
9d1808da
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment