Sha256: fe462bc8449e5631e78a54b85182df5a50718a62f0f641fb85f4fb340eec0c0f

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

require 'cocoapods'
require 'fileutils'

module CocoapodsGitHooks
  Pod::HooksManager.register('cocoapods-show-podpsecs-in-project', :post_install) do |context|
    specs_dir_path = File.expand_path("#{context.sandbox.root}/Podspecs")
    FileUtils.rm_rf specs_dir_path
    FileUtils.mkdir specs_dir_path

    context.umbrella_targets[0].specs.each do |spec|
      spec = spec.parent while spec.parent
      path = "#{specs_dir_path}/#{spec.name}.podpsec.json"
      File.open(path, 'w') { |file| file.write(spec.to_pretty_json) }
    end

    context.pods_project.main_group.new_reference(specs_dir_path)
    context.pods_project.save
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cocoapods-show-podpsecs-in-project-0.1.3 lib/cocoapods_plugin.rb
cocoapods-show-podpsecs-in-project-0.1.2 lib/cocoapods_plugin.rb