Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copy resources script for iOS < 6 and OS X < 10.8 #1030

Merged
merged 5 commits into from
May 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides


* Inheriting `inhibit_warnings` per pod is now working * Inheriting `inhibit_warnings` per pod is now working
[#1032](https://github.com/CocoaPods/CocoaPods/issues/1032) [#1032](https://github.com/CocoaPods/CocoaPods/issues/1032)
* Fix copy resources script for iOS < 6 and OS X < 10.8 by removing the `--reference-external-strings-file`
flag. [#1030](https://github.com/CocoaPods/CocoaPods/pull/1030)


## 0.19.1 ## 0.19.1
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.19.0...0.19.1) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.19.0...0.19.1)
Expand Down
5 changes: 3 additions & 2 deletions lib/cocoapods/generator/copy_resources_script.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ class CopyResourcesScript
attr_reader :resources attr_reader :resources


# A list of files relative to the project pods root. # A list of files relative to the project pods root.
def initialize(resources = []) def initialize(resources = [], reference_external_strings_file = false)
@resources = resources @resources = resources
@reference_external_strings_file = reference_external_strings_file
end end


def save_as(pathname) def save_as(pathname)
pathname.open('w') do |script| pathname.open('w') do |script|
script.puts CONTENT script.puts @reference_external_strings_file ? CONTENT : CONTENT.gsub(' --reference-external-strings-file', '')
@resources.each do |resource| @resources.each do |resource|
script.puts "install_resource '#{resource}'" script.puts "install_resource '#{resource}'"
end end
Expand Down
8 changes: 7 additions & 1 deletion lib/cocoapods/installer/target_installer.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ def create_bridge_support_file
end end
end end


ENABLE_EXTERNAL_STRINGS_FILE_FLAG = {
:ios => Version.new('6'),
:osx => Version.new('10.8')
}
# Creates a script that copies the resources to the bundle of the client # Creates a script that copies the resources to the bundle of the client
# target. # target.
# #
Expand All @@ -217,7 +221,9 @@ def create_copy_resources_script
UI.message "- Generating copy resources script at #{UI.path(path)}" do UI.message "- Generating copy resources script at #{UI.path(path)}" do
resources = library.file_accessors.map { |accessor| accessor.resources.flatten.map {|res| project.relativize(res)} }.flatten resources = library.file_accessors.map { |accessor| accessor.resources.flatten.map {|res| project.relativize(res)} }.flatten
resources << bridge_support_file if bridge_support_file resources << bridge_support_file if bridge_support_file
generator = Generator::CopyResourcesScript.new(resources) platform_name = library.platform.name
reference_external_strings_file = library.platform.deployment_target >= ENABLE_EXTERNAL_STRINGS_FILE_FLAG[platform_name]
generator = Generator::CopyResourcesScript.new(resources, reference_external_strings_file)
generator.save_as(path) generator.save_as(path)
add_file_to_support_group(path) add_file_to_support_group(path)
end end
Expand Down