Sha256: 71d661f486842b667f00eac8a0f977661c35856d0aadbc1a512db06cd1721443

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

Pod::HooksManager.register('cocoapods-rome', :post_install) do |installer_context|
  sandbox_root = Pathname(installer_context.sandbox_root)
  sandbox = Pod::Sandbox.new(sandbox_root)

  build_dir = sandbox_root.parent + 'build'
  destination = sandbox_root.parent + 'Rome'

  Pod::UI.puts 'Building frameworks'

  build_dir.rmtree if build_dir.directory?
  Dir.chdir(sandbox.project_path.dirname) do
    targets = installer_context.umbrella_targets.select { |t| t.specs.any? }.map(&:cocoapods_target_label)
    targets.each do |target|
      Pod::Executable.execute_command 'xcodebuild', %(-project #{sandbox.project_path.basename} -scheme #{target} -configuration Release), true
    end
  end

  raise Pod::Informative 'The build directory was not found in the expected location.' unless build_dir.directory?

  frameworks = Pathname.glob(build_dir + 'Release*/Pods*/*.framework')
  frameworks_by_target = frameworks.group_by { |f| f.to_s =~ %r{build/Release[^/]*/Pods-?([^/]*)/} && destination + $1 }

  Pod::UI.puts "Built #{frameworks.count} #{'frameworks'.pluralize(frameworks.count)}"
  Pod::UI.puts "Copying frameworks to `#{destination.relative_path_from Pathname.pwd}`"

  destination.rmtree if destination.directory?
  frameworks_by_target.each do |dest, frameworks|
    FileUtils.mkdir_p dest
    FileUtils.cp_r frameworks, dest, :remove_destination => true
  end
  build_dir.rmtree if build_dir.directory?
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cocoapods-rome-0.0.3 lib/cocoapods-rome/post_install.rb
cocoapods-rome-0.0.2 lib/cocoapods-rome/post_install.rb