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
625c79bc
Commit
625c79bc
authored
Jan 06, 2016
by
Boris Bügling
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4735 from sirlantis/fix-needs-sudo-check
[SourcesManager] Fix wrong sudo recommendation
🌈
parents
e28e4c1c
a5dd848a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
CHANGELOG.md
CHANGELOG.md
+9
-0
sources_manager.rb
lib/cocoapods/sources_manager.rb
+7
-3
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+10
-0
No files found.
CHANGELOG.md
View file @
625c79bc
...
...
@@ -4,6 +4,15 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
To install release candidates run
`[sudo] gem install cocoapods --pre`
## Master
##### Enhancements
##### Bug Fixes
*
Fix suggestion of sudo when it actually isn't needed
[
Marcel Jackwerth
](
https://github.com/sirlantis
)
## 1.0.0.beta.2 (2016-01-05)
##### Enhancements
...
...
lib/cocoapods/sources_manager.rb
View file @
625c79bc
...
...
@@ -366,12 +366,10 @@ module Pod
'Update CocoaPods, or checkout the appropriate tag in the repo.'
end
needs_sudo
=
path_writable?
(
__FILE__
)
if
config
.
new_version_message?
&&
cocoapods_update?
(
versions
)
last
=
versions
[
'last'
]
rc
=
Gem
::
Version
.
new
(
last
).
prerelease?
install_message
=
needs_sudo
?
'sudo '
:
''
install_message
=
needs_sudo
?
?
'sudo '
:
''
install_message
<<
'gem install cocoapods'
install_message
<<
' --pre'
if
rc
message
=
[
...
...
@@ -487,6 +485,12 @@ module Pod
Pathname
(
path
).
dirname
.
writable?
end
# @return [Bool] Whether `gem install` probably needs `sudo` to succeed.
#
def
needs_sudo?
!
path_writable?
(
__FILE__
)
end
# @return [Source] The git source with the given name. If no git source
# with given name is found it raises.
#
...
...
spec/unit/sources_manager_spec.rb
View file @
625c79bc
...
...
@@ -390,6 +390,16 @@ module Pod
SourcesManager
.
send
(
:path_writable?
,
path
).
should
.
be
.
true
end
it
'knows when sudo is needed'
do
SourcesManager
.
stubs
(
:path_writable?
).
returns
(
false
)
SourcesManager
.
send
(
:needs_sudo?
).
should
.
be
.
true
end
it
'knows when sudo is not needed'
do
SourcesManager
.
stubs
(
:path_writable?
).
returns
(
true
)
SourcesManager
.
send
(
:needs_sudo?
).
should
.
be
.
false
end
it
'returns whether a repository is compatible'
do
SourcesManager
.
stubs
(
:version_information
).
returns
(
'min'
=>
'0.0.1'
)
SourcesManager
.
repo_compatible?
(
'stub'
).
should
.
be
.
true
...
...
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