Class: Pod::Generator::PrepareArtifactsScript

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/generator/prepare_artifacts_script.rb

Instance Attribute Summary collapse

Private Helpers collapse

Instance Method Summary collapse

Constructor Details

#initialize(xcframeworks_by_config, sandbox_root, platform) ⇒ PrepareArtifactsScript

Returns a new instance of PrepareArtifactsScript.

Parameters:

  • Hash{String (Hash{String => Array<Pod::Xcode::XCFramework>] xcframeworks_by_config @see #xcframeworks_by_config)

    > Array<Pod::Xcode::XCFramework>] xcframeworks_by_config

    @see #xcframeworks_by_config

  • sandbox_root (Pathname)

    the sandbox root of the installation

  • platform (Platform)

    the platform of the target for which this script will run


28
29
30
31
32
# File 'lib/cocoapods/generator/prepare_artifacts_script.rb', line 28

def initialize(xcframeworks_by_config, sandbox_root, platform)
  @xcframeworks_by_config = xcframeworks_by_config
  @sandbox_root = sandbox_root
  @platform = platform
end

Instance Attribute Details

#platformPlatform (readonly)

Returns the platform of the target for which this script will run.

Returns:

  • (Platform)

    the platform of the target for which this script will run


17
18
19
# File 'lib/cocoapods/generator/prepare_artifacts_script.rb', line 17

def platform
  @platform
end

#sandbox_rootPathname (readonly)

Returns the root directory of the sandbox.

Returns:

  • (Pathname)

    the root directory of the sandbox


13
14
15
# File 'lib/cocoapods/generator/prepare_artifacts_script.rb', line 13

def sandbox_root
  @sandbox_root
end

#xcframeworks_by_configHash{String => Array<Pod::Xcode::XCFramework>} (readonly)

Returns Multiple lists of xcframeworks per configuration.

Returns:


9
10
11
# File 'lib/cocoapods/generator/prepare_artifacts_script.rb', line 9

def xcframeworks_by_config
  @xcframeworks_by_config
end

Class Method Details

.dsym_folder(xcframework_path) ⇒ Array<Pathname>

Returns all found .dSYM paths.

Parameters:

  • xcframework_path (Pathname)

    the base path of the .xcframework bundle

Returns:

  • (Array<Pathname>)

    all found .dSYM paths


248
249
250
251
252
253
# File 'lib/cocoapods/generator/prepare_artifacts_script.rb', line 248

def dsym_folder(xcframework_path)
  basename = File.basename(xcframework_path, '.xcframework')
  dsym_basename = basename + '.dSYMs'
  path = xcframework_path.dirname + dsym_basename
  Pathname.new(path) if File.directory?(path)
end

Instance Method Details

#generateString

Returns The contents of the embed frameworks script.

Returns:

  • (String)

    The contents of the embed frameworks script.


50
51
52
# File 'lib/cocoapods/generator/prepare_artifacts_script.rb', line 50

def generate
  script
end

#save_as(pathname) ⇒ void

This method returns an undefined value.

Saves the resource script to the given pathname.

Parameters:

  • pathname (Pathname)

    The path where the embed frameworks script should be saved.


41
42
43
44
45
46
# File 'lib/cocoapods/generator/prepare_artifacts_script.rb', line 41

def save_as(pathname)
  pathname.open('w') do |file|
    file.puts(script)
  end
  File.chmod(0o755, pathname.to_s)
end