Class: Pod::SPM::Hook::UpdateCopyResourcesScript

Inherits:
Pod::SPM::Hook show all
Includes:
UpdateScript::Mixin
Defined in:
lib/cocoapods-spm/hooks/post_integrate/21.update_copy_resources_script.rb

Instance Method Summary collapse

Methods included from UpdateScript::Mixin

#update_script

Methods inherited from Pod::SPM::Hook

#aggregate_targets, #config, #initialize, #macro_metadata_for_pod, #perform_settings_update, #pod_name_of_target, #pod_target_subprojects, #pod_targets, #podfile, #pods_project, run_hooks, #sandbox, #user_build_configurations

Methods included from Installer::InstallerMixin

#native_targets, #projects_to_integrate

Methods included from Config::SPMConfigMixin

#local_macro_pod?, #local_macro_pod_dir, #macro_pods, #spm_config

Methods included from Config::PodConfigMixin

#pod_config

Methods included from PathMixn

#prepare_dir

Methods included from Config::ProjectConfigMixin

#project_config

Constructor Details

This class inherits a constructor from Pod::SPM::Hook

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cocoapods-spm/hooks/post_integrate/21.update_copy_resources_script.rb', line 10

def run
  update_script(
    name: :copy_resources_script,
    insert_before: Generator::CopyResourcesScript::RSYNC_CALL,
    content_by_target: lambda do |target|
      input_paths = resource_paths_for(target)
      output_paths = input_paths.map do |p|
        "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/#{File.basename(p)}"
      end
      lines = input_paths.map { |p| "install_resource \"#{p}\"" }
      [lines, input_paths, output_paths]
    end
  )
end