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
9fa878c9
Commit
9fa878c9
authored
Mar 24, 2014
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1909 from pietbrauer/add_dynamic_url_to_pod_template
Add possibility to specify a template URL
parents
b0c71244
35c03c7d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
4 deletions
+33
-4
CHANGELOG.md
CHANGELOG.md
+3
-0
lib.rb
lib/cocoapods/command/lib.rb
+13
-4
lib_spec.rb
spec/functional/command/lib_spec.rb
+17
-0
No files found.
CHANGELOG.md
View file @
9fa878c9
...
...
@@ -19,6 +19,9 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
*
Improves
`pod init`
to save Xcode project file in Podfile when one was supplied.
[
Kyle Fuller
](
https://github.com/kylef
)
*
Adds functionality to specify a template URL for the
`pod lib create`
command.
[
Piet Brauer
](
https://github.com/pietbrauer
)
###### Bug Fixes
*
Fixes a bug with
`pod repo remove`
silently handling permission errors.
...
...
lib/cocoapods/command/lib.rb
View file @
9fa878c9
...
...
@@ -10,13 +10,15 @@ module Pod
self
.
summary
=
'Creates a new Pod'
self
.
description
=
<<-
DESC
Creates a new Pod with the given name from the template in the working directory.
Creates a scaffold for the development of a new Pod according to the CocoaPods best practices.
If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one.
DESC
self
.
arguments
=
'
[NAME
]'
self
.
arguments
=
'
NAME [TEMPLATE_URL
]'
def
initialize
(
argv
)
@name
=
argv
.
shift_argument
@template_url
=
argv
.
shift_argument
super
end
...
...
@@ -53,7 +55,7 @@ module Pod
#
def
clone_template
UI
.
section
(
"Creating `
#{
@name
}
` Pod"
)
do
git!
"clone '
#{
TEMPLATE_REPO
}
'
#{
@name
}
"
git!
"clone '
#{
template_repo_url
}
'
#{
@name
}
"
end
end
...
...
@@ -74,10 +76,17 @@ module Pod
# @return [void]
#
def
print_info
UI
.
puts
"
\n
To learn more about the template see `
#{
TEMPLATE_INFO_URL
}
`."
UI
.
puts
"
\n
To learn more about the template see `
#{
template_repo_url
}
`."
UI
.
puts
"To learn more about creating a new pod, see `
#{
CREATE_NEW_POD_INFO_URL
}
`."
end
# Checks if a template URL is given else returns the TEMPLATE_REPO URL
#
# @return String
#
def
template_repo_url
@template_url
||
TEMPLATE_REPO
end
end
#-----------------------------------------------------------------------#
...
...
spec/functional/command/lib_spec.rb
View file @
9fa878c9
...
...
@@ -77,5 +77,22 @@ module Pod
output
=
run_command
(
'lib'
,
'create'
,
'TestPod'
)
output
.
should
.
include?
'http://guides.cocoapods.org/making/making-a-cocoapod'
end
before
do
Command
::
Lib
::
Create
.
any_instance
.
stubs
(
:configure_template
)
Command
::
Lib
::
Create
.
any_instance
.
stubs
(
:git!
)
end
it
"should use the given template URL"
do
template_url
=
'https://github.com/custom/template.git'
Command
::
Lib
::
Create
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
sut
=
run_command
(
'lib'
,
'create'
,
'TestPod'
,
template_url
)
end
it
"should use the default URL if no template URL is given"
do
template_url
=
'https://github.com/CocoaPods/pod-template.git'
Command
::
Lib
::
Create
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
)
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