-
Notifications
You must be signed in to change notification settings - Fork 340
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
Support On-Demand Resource #622
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,12 @@ def user_target_xcconfig | |
merge_values(attr, value_for_attribute(:xcconfig), value_for_attribute(:user_target_xcconfig)) | ||
end | ||
|
||
# @return [Hash{String=>String}]] hash where the keys are the names of | ||
# the on demand resource and the values are their relative file | ||
# patterns. | ||
# | ||
spec_attr_accessor :on_demand_resources | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we would want this to be a example: s.on_demand_resources = {
'Tag1' => ['file1.png', 'file2.png']
} we also may need to provide a way for Pod authors to specify the category of the tag. The category determines how the resource gets fetched. To quote the docs:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good idea. I will refer to your design for implementation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. implementation f240511 |
||
|
||
# @return [Hash{String => String}] the Info.plist values for the current specification | ||
# | ||
spec_attr_accessor :info_plist | ||
|
@@ -473,6 +479,24 @@ def _prepare_resource_bundles(value) | |
result | ||
end | ||
|
||
# Ensures that the file patterns of the on demand resources are contained in | ||
# an array. | ||
# | ||
# @param [String, Array, Hash] value. | ||
# The value of the attribute as specified by the user. | ||
# | ||
# @return [Hash] the resources. | ||
# | ||
def _prepare_on_demand_resources(value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please add a test for this logic? |
||
result = {} | ||
if value | ||
value.each do |key, patterns| | ||
result[key] = [*patterns].compact | ||
end | ||
end | ||
result | ||
end | ||
|
||
#-----------------------------------------------------------------------# | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1303,6 +1303,26 @@ def dependency=(args) | |
|
||
#------------------# | ||
|
||
# @!method on_demand_resources=(on_demand_resources) | ||
# | ||
# A list of on_demand_resource that should be copied into the target bundle. | ||
# | ||
# @example | ||
# | ||
# s.on_demand_resources = { | ||
# 'Tag1' => ['file1.png', 'file2.png'] | ||
# } | ||
# @param [String, Array<String>] resources | ||
# The on_demand_resources shipped with the Pod. | ||
# | ||
attribute :on_demand_resources, | ||
:types => [String, Array], | ||
:container => Hash, | ||
:file_patterns => true, | ||
:singularize => true | ||
|
||
#------------------# | ||
|
||
# @!method resource_bundles=(*resource_bundles) | ||
# | ||
# This attribute allows to define the name and the file of the resource | ||
|
@@ -1370,6 +1390,7 @@ def dependency=(args) | |
:file_patterns => true, | ||
:singularize => true | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unneeded? |
||
#------------------# | ||
|
||
# @!method exclude_files=(exclude_files) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make this 622 instead of #issue_number