Commit e238edee authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #3640 from mglidden/mglidden-only-lock-source

parents b259fa7c fdfcf455
......@@ -24,10 +24,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Jonathan MacMillan](https://github.com/perotinus)
* Only link public headers in the sandbox for Pods that are not being built
into dynamic frameworks, when integrating Pods as frameworks
into dynamic frameworks, when integrating Pods as frameworks.
[#3867](https://github.com/CocoaPods/CocoaPods/issues/3867)
[Jonathan MacMillan](https://github.com/perotinus)
* Don't lock resource files, only source files.
[Mason Glidden](https://github.com/mglidden).
[#3557](https://github.com/CocoaPods/CocoaPods/issues/3557)
## 0.38.0
##### Enhancements
......
......@@ -346,7 +346,10 @@ module Pod
def lock_pod_sources
return unless config.lock_pod_source?
return unless @pod_installers
@pod_installers.each(&:lock_files!)
@pod_installers.each do |installer|
pod_target = pod_targets.find { |target| target.pod_name == installer.name }
installer.lock_files!(pod_target.file_accessors)
end
end
# Determines if the dependencies need to be built as dynamic frameworks or
......
......@@ -33,6 +33,12 @@ module Pod
"<#{self.class} sandbox=#{sandbox.root} pod=#{root_spec.name}"
end
# @return [String] The name of the pod this installer is installing.
#
def name
root_spec.name
end
#-----------------------------------------------------------------------#
public
......@@ -66,8 +72,16 @@ module Pod
#
# @return [void]
#
def lock_files!
lock_installation unless local?
def lock_files!(file_accessors)
return if local?
file_accessors.each do |file_accessor|
file_accessor.source_files.each do |source_file|
next unless source_file.exist?
new_permissions = source_file.stat.mode & ~0222
source_file.chmod(new_permissions)
end
end
end
# @return [Hash] @see Downloader#checkout_options
......@@ -102,24 +116,6 @@ module Pod
)
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_installation
# 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|
if File.file?(file)
# Only remove write permission, since some pods (like Crashlytics)
# have executable files.
new_permissions = File.stat(file).mode & ~0222
File.chmod(new_permissions, file)
end
end
end
# Removes all the files not needed for the installation according to the
# specs by platform.
#
......
......@@ -132,23 +132,6 @@ module Pod
end
#--------------------------------------#
describe 'Locking' do
it 'locks the source files for each Pod' do
File.expects(:chmod).at_least_once
@installer.install!
@installer.lock_files!
end
it "doesn't lock local pods" do
@installer.stubs(:local?).returns(true)
File.expects(:chmod).never
@installer.install!
@installer.lock_files!
end
end
#--------------------------------------#
end
#-------------------------------------------------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment