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
6baca709
Commit
6baca709
authored
Apr 17, 2014
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conditionally include `sudo` in suggested update command
Closes
https://github.com/CocoaPods/CocoaPods/issues/2058
parent
c6e5b500
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
sources_manager.rb
lib/cocoapods/sources_manager.rb
+10
-1
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+7
-1
No files found.
lib/cocoapods/sources_manager.rb
View file @
6baca709
...
@@ -205,9 +205,12 @@ module Pod
...
@@ -205,9 +205,12 @@ module Pod
"Update CocoaPods, or checkout the appropriate tag in the repo."
"Update CocoaPods, or checkout the appropriate tag in the repo."
end
end
needs_sudo
=
path_writable?
(
__FILE__
)
if
config
.
new_version_message?
&&
cocoapods_update?
(
versions
)
if
config
.
new_version_message?
&&
cocoapods_update?
(
versions
)
UI
.
puts
"
\n
CocoaPods
#{
versions
[
'last'
]
}
is available.
\n
"
\
UI
.
puts
"
\n
CocoaPods
#{
versions
[
'last'
]
}
is available.
\n
"
\
"To update use: [sudo] gem install cocoapods
\n
"
.
green
"To update use:
#{
needs_sudo
?
'sudo '
:
''
}
"
\
'gem install cocoapods\n'
.
green
end
end
end
end
...
@@ -284,6 +287,12 @@ module Pod
...
@@ -284,6 +287,12 @@ module Pod
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
private
def
path_writable?
(
path
)
Pathname
(
path
).
dirname
.
writable?
end
end
end
end
end
end
end
...
...
spec/unit/sources_manager_spec.rb
View file @
6baca709
...
@@ -63,7 +63,7 @@ module Pod
...
@@ -63,7 +63,7 @@ module Pod
sets
.
all?
{
|
s
|
s
.
class
==
Specification
::
Set
}.
should
.
be
.
true
sets
.
all?
{
|
s
|
s
.
class
==
Specification
::
Set
}.
should
.
be
.
true
sets
.
any?
{
|
s
|
s
.
name
==
'BananaLib'
}.
should
.
be
.
true
sets
.
any?
{
|
s
|
s
.
name
==
'BananaLib'
}.
should
.
be
.
true
end
end
it
"can perform a full text regexp search of the sets"
do
it
"can perform a full text regexp search of the sets"
do
Source
::
Aggregate
.
any_instance
.
stubs
(
:all
).
returns
([
@test_source
])
Source
::
Aggregate
.
any_instance
.
stubs
(
:all
).
returns
([
@test_source
])
sets
=
SourcesManager
.
search_by_name
(
'Ch[aeiou]nky'
,
true
)
sets
=
SourcesManager
.
search_by_name
(
'Ch[aeiou]nky'
,
true
)
...
@@ -146,6 +146,12 @@ module Pod
...
@@ -146,6 +146,12 @@ module Pod
e
.
message
.
should
.
match
/Update CocoaPods/
e
.
message
.
should
.
match
/Update CocoaPods/
end
end
it
'returns whether a path is writable'
do
path
=
'/Users/'
Pathname
.
any_instance
.
stubs
(
:writable?
).
returns
(
true
)
SourcesManager
.
send
(
:path_writable?
,
path
).
should
.
be
.
true
end
it
"returns whether a repository is compatible"
do
it
"returns whether a repository is compatible"
do
SourcesManager
.
stubs
(
:version_information
).
returns
({
'min'
=>
'0.0.1'
})
SourcesManager
.
stubs
(
:version_information
).
returns
({
'min'
=>
'0.0.1'
})
SourcesManager
.
repo_compatible?
(
'stub'
).
should
.
be
.
true
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