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
cc69ff7a
Unverified
Commit
cc69ff7a
authored
Nov 14, 2016
by
Danielle Tomlinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Command] Raise when using git < 1.8.5
parent
2d4d97be
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
0 deletions
+73
-0
CHANGELOG.md
CHANGELOG.md
+4
-0
command.rb
lib/cocoapods/command.rb
+24
-0
command_spec.rb
spec/unit/command_spec.rb
+45
-0
No files found.
CHANGELOG.md
View file @
cc69ff7a
...
@@ -37,6 +37,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -37,6 +37,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
*
Fixed code signing issue causing lint failure on macOS.
*
Fixed code signing issue causing lint failure on macOS.
[
Paul Cantrell
](
https://github.com/pcantrell
)
[
Paul Cantrell
](
https://github.com/pcantrell
)
[
#5645
](
https://github.com/CocoaPods/CocoaPods/issues/5645
)
[
#5645
](
https://github.com/CocoaPods/CocoaPods/issues/5645
)
*
Raise an exception when using a git version prior to 1.8.5.
[
Danielle Tomlinson
](
https://github.com/dantoml
)
[
#6078
](
https://github.com/CocoaPods/CocoaPods/issues/6078
)
## 1.2.0.beta.1 (2016-10-28)
## 1.2.0.beta.1 (2016-10-28)
...
...
lib/cocoapods/command.rb
View file @
cc69ff7a
...
@@ -45,6 +45,8 @@ module Pod
...
@@ -45,6 +45,8 @@ module Pod
def
self
.
run
(
argv
)
def
self
.
run
(
argv
)
help!
'You cannot run CocoaPods as root.'
if
Process
.
uid
==
0
help!
'You cannot run CocoaPods as root.'
if
Process
.
uid
==
0
verify_minimum_git_version!
verify_xcode_license_approved!
verify_xcode_license_approved!
super
(
argv
)
super
(
argv
)
...
@@ -105,6 +107,28 @@ module Pod
...
@@ -105,6 +107,28 @@ module Pod
private
private
# Returns a new {Gem::Version} based on the systems `git` version.
#
# @return [Gem::Version]
#
def
self
.
git_version
raw_version
=
Executable
.
capture_command
(
'git'
,
[
'--version'
]).
first
match
=
raw_version
.
scan
(
/\d+\.\d+\.\d+/
).
first
Gem
::
Version
.
new
(
match
)
end
# Checks that the git version is at least 1.8.5
#
# @raise If the git version is older than 1.8.5
#
# @return [void]
#
def
self
.
verify_minimum_git_version!
if
git_version
<
Gem
::
Version
.
new
(
'1.8.5'
)
raise
Informative
,
'You need at least git version 1.8.5 to use CocoaPods'
end
end
# Returns a new {Installer} parametrized from the {Config}.
# Returns a new {Installer} parametrized from the {Config}.
#
#
# @return [Installer]
# @return [Installer]
...
...
spec/unit/command_spec.rb
View file @
cc69ff7a
...
@@ -19,5 +19,50 @@ module Pod
...
@@ -19,5 +19,50 @@ module Pod
Command
.
parse
(
%w(init )
).
should
.
be
.
instance_of
Command
::
Init
Command
.
parse
(
%w(init )
).
should
.
be
.
instance_of
Command
::
Init
Command
.
parse
(
%w(env )
).
should
.
be
.
instance_of
Command
::
Env
Command
.
parse
(
%w(env )
).
should
.
be
.
instance_of
Command
::
Env
end
end
describe
'git version validation'
do
valid_git_versions
=
[
Gem
::
Version
.
new
(
'1.8.5'
),
Gem
::
Version
.
new
(
'2.10.2'
),
Gem
::
Version
.
new
(
'2.8.4'
),
]
invalid_git_versions
=
[
Gem
::
Version
.
new
(
'1.7.4'
),
Gem
::
Version
.
new
(
'0.2.9'
),
]
valid_git_versions
.
each
do
|
version
|
it
"does not raise an error for version
#{
version
}
"
do
Command
.
expects
(
:git_version
).
returns
(
version
)
lambda
{
Command
.
verify_minimum_git_version!
}.
should
.
not
.
raise
end
end
invalid_git_versions
.
each
do
|
version
|
it
"raises an error for version
#{
version
}
"
do
Command
.
expects
(
:git_version
).
returns
(
version
)
lambda
{
Command
.
verify_minimum_git_version!
}.
should
.
raise
Informative
end
end
end
describe
'git version extraction'
do
git_versions
=
[
[
'git version 1.2.4'
,
Gem
::
Version
.
new
(
'1.2.4'
)],
[
'git version 1.4.5'
,
Gem
::
Version
.
new
(
'1.4.5'
)],
[
'git version 1.7.4'
,
Gem
::
Version
.
new
(
'1.7.4'
)],
[
'git version 2.10.2'
,
Gem
::
Version
.
new
(
'2.10.2'
)],
[
'git version 2.10.2'
,
Gem
::
Version
.
new
(
'2.10.2'
)],
[
'git version 2.8.4 (Apple Git-73)'
,
Gem
::
Version
.
new
(
'2.8.4'
)],
]
git_versions
.
each
do
|
pair
|
it
"returns the correct version for
#{
pair
[
0
]
}
"
do
Executable
.
expects
(
:capture_command
).
with
(
'git'
,
[
'--version'
]).
returns
([
pair
[
0
]])
Command
.
git_version
.
should
==
pair
[
1
]
end
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