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
8a814f81
Commit
8a814f81
authored
Jan 19, 2014
by
Kyle Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`pod init` shouild save xcodeproj if it was defined
parent
55117eb3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
3 deletions
+31
-3
CHANGELOG.md
CHANGELOG.md
+3
-0
init.rb
lib/cocoapods/command/init.rb
+6
-3
init_spec.rb
spec/functional/command/init_spec.rb
+22
-0
No files found.
CHANGELOG.md
View file @
8a814f81
...
@@ -16,6 +16,9 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
...
@@ -16,6 +16,9 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
*
Improves the error message when searching with an invalid regular expression.
*
Improves the error message when searching with an invalid regular expression.
[
Kyle Fuller
](
https://github.com/kylef
)
[
Kyle Fuller
](
https://github.com/kylef
)
*
Improves
`pod init`
to save Xcode project file in Podfile when one was supplied.
[
Kyle Fuller
](
https://github.com/kylef
)
## 0.29.0
## 0.29.0
[
CocoaPods
](
https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0
)
[
CocoaPods
](
https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0
)
...
...
lib/cocoapods/command/init.rb
View file @
8a814f81
...
@@ -31,12 +31,13 @@ module Pod
...
@@ -31,12 +31,13 @@ module Pod
raise
Informative
,
"Existing Podfile found in directory"
unless
config
.
podfile
.
nil?
raise
Informative
,
"Existing Podfile found in directory"
unless
config
.
podfile
.
nil?
if
@project_path
if
@project_path
help!
"Xcode project at
#{
@project_path
}
does not exist"
unless
File
.
exist?
@project_path
help!
"Xcode project at
#{
@project_path
}
does not exist"
unless
File
.
exist?
@project_path
project_path
=
@project_path
else
else
raise
Informative
,
"No xcode project found, please specify one"
unless
@project_paths
.
length
>
0
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
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
@xcode_project
=
Xcodeproj
::
Project
.
open
(
@
project_path
)
@xcode_project
=
Xcodeproj
::
Project
.
open
(
project_path
)
end
end
def
run
def
run
...
@@ -51,7 +52,9 @@ module Pod
...
@@ -51,7 +52,9 @@ module Pod
# @return [String] the text of the Podfile for the provided project
# @return [String] the text of the Podfile for the provided project
#
#
def
podfile_template
(
project
)
def
podfile_template
(
project
)
podfile
=
<<-
PLATFORM
.
strip_heredoc
podfile
=
''
podfile
<<
"xcodeproj '
#{
@project_path
}
'
\n\n
"
if
@project_path
podfile
<<
<<-
PLATFORM
.
strip_heredoc
# Uncomment this line to define a global platform for your project
# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"
# platform :ios, "6.0"
PLATFORM
PLATFORM
...
...
spec/functional/command/init_spec.rb
View file @
8a814f81
...
@@ -122,5 +122,27 @@ module Pod
...
@@ -122,5 +122,27 @@ module Pod
end
end
end
end
it
"saves xcode project file in Podfile if one was supplied"
do
Dir
.
chdir
(
temporary_directory
)
do
Xcodeproj
::
Project
.
new
(
temporary_directory
+
'test1.xcodeproj'
).
save
Xcodeproj
::
Project
.
new
(
temporary_directory
+
'Project.xcodeproj'
).
save
run_command
(
'init'
,
'Project.xcodeproj'
)
target_definition
=
config
.
podfile
.
target_definitions
.
values
.
first
target_definition
.
user_project_path
.
should
==
'Project.xcodeproj'
end
end
it
"doesn't save xcode project file in Podfile if one wasn't supplied"
do
Dir
.
chdir
(
temporary_directory
)
do
Xcodeproj
::
Project
.
new
(
temporary_directory
+
'Project.xcodeproj'
).
save
run_command
(
'init'
)
target_definition
=
config
.
podfile
.
target_definitions
.
values
.
first
target_definition
.
user_project_path
.
should
==
nil
end
end
end
end
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