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
724af1c0
Commit
724af1c0
authored
Apr 21, 2015
by
Mason Glidden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically lock Pod source files after installing (#1154)
parent
6b7aeade
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
CHANGELOG.md
CHANGELOG.md
+3
-0
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+20
-0
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+15
-0
No files found.
CHANGELOG.md
View file @
724af1c0
...
@@ -13,6 +13,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -13,6 +13,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Samuel Giddins
](
https://github.com/segiddins
)
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#3433
](
https://github.com/CocoaPods/CocoaPods/issues/3433
)
[
#3433
](
https://github.com/CocoaPods/CocoaPods/issues/3433
)
*
Automatically lock Pod source files after installing.
[
Mason Glidden
](
https://github.com/mglidden
)
[
#1154
](
https://github.com/CocoaPods/CocoaPods/issues/1154
)
## 0.37.0.beta.1
## 0.37.0.beta.1
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
724af1c0
...
@@ -44,6 +44,7 @@ module Pod
...
@@ -44,6 +44,7 @@ module Pod
def
install!
def
install!
download_source
unless
predownloaded?
||
local?
download_source
unless
predownloaded?
||
local?
run_prepare_command
run_prepare_command
lock_files!
end
end
# Cleans the installations if appropriate.
# Cleans the installations if appropriate.
...
@@ -89,6 +90,25 @@ module Pod
...
@@ -89,6 +90,25 @@ module Pod
)
)
end
end
# Locks all of the files in this pod (source, license, etc). This will
# cause Xcode to warn you if you try to accidently edit one of the files.
#
# @return [void]
#
def
lock_files!
if
local?
return
end
# We don't want to lock diretories, as that forces you to override
# those permissions if you decide to delete the Pods folder.
Dir
.
glob
(
root
+
'**/*'
).
each
do
|
file
|
unless
File
.
directory?
(
file
)
File
.
chmod
(
0444
,
file
)
end
end
end
extend
Executable
extend
Executable
executable
:bash
executable
:bash
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
724af1c0
...
@@ -132,6 +132,21 @@ module Pod
...
@@ -132,6 +132,21 @@ module Pod
end
end
#--------------------------------------#
#--------------------------------------#
describe
'Locking'
do
it
'locks the source files for each Pod'
do
File
.
expects
(
:chmod
).
at_least_once
@installer
.
install!
end
it
"doesn't lock local pods"
do
@installer
.
stubs
(
:local?
).
returns
(
true
)
File
.
expects
(
:chmod
).
never
@installer
.
install!
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