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
d746ab3b
Commit
d746ab3b
authored
Mar 20, 2014
by
Piet Brauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add possibility to specify a template URL
parent
a88e48f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
lib.rb
lib/cocoapods/command/lib.rb
+11
-3
lib_spec.rb
spec/functional/command/lib_spec.rb
+17
-0
No files found.
lib/cocoapods/command/lib.rb
View file @
d746ab3b
...
@@ -13,10 +13,11 @@ module Pod
...
@@ -13,10 +13,11 @@ module Pod
Creates a new Pod with the given name from the template in the working directory.
Creates a new Pod with the given name from the template in the working directory.
DESC
DESC
self
.
arguments
=
'[NAME]'
self
.
arguments
=
'[NAME]
[TEMPLATE_URL]
'
def
initialize
(
argv
)
def
initialize
(
argv
)
@name
=
argv
.
shift_argument
@name
=
argv
.
shift_argument
@template_url
=
argv
.
shift_argument
super
super
end
end
...
@@ -53,7 +54,7 @@ module Pod
...
@@ -53,7 +54,7 @@ module Pod
#
#
def
clone_template
def
clone_template
UI
.
section
(
"Creating `
#{
@name
}
` Pod"
)
do
UI
.
section
(
"Creating `
#{
@name
}
` Pod"
)
do
git!
"clone '
#{
TEMPLATE_REPO
}
'
#{
@name
}
"
git!
"clone '
#{
template_repo_url
}
'
#{
@name
}
"
end
end
end
end
...
@@ -74,10 +75,17 @@ module Pod
...
@@ -74,10 +75,17 @@ module Pod
# @return [void]
# @return [void]
#
#
def
print_info
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
}
`."
UI
.
puts
"To learn more about creating a new pod, see `
#{
CREATE_NEW_POD_INFO_URL
}
`."
end
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
end
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
...
...
spec/functional/command/lib_spec.rb
View file @
d746ab3b
...
@@ -77,5 +77,22 @@ module Pod
...
@@ -77,5 +77,22 @@ module Pod
output
=
run_command
(
'lib'
,
'create'
,
'TestPod'
)
output
=
run_command
(
'lib'
,
'create'
,
'TestPod'
)
output
.
should
.
include?
'http://guides.cocoapods.org/making/making-a-cocoapod'
output
.
should
.
include?
'http://guides.cocoapods.org/making/making-a-cocoapod'
end
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
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