Sha256: 1c3414d9e5b22880cbe360d94fbc9f2b6bbd231f8b3314e38b608036f041f674

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# Copyright 2019 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved.
# Use of this source code is governed by an MIT-style license that can be found in the LICENSE file

module PodPrebuild
  class Output
    def initialize(prebuild_sandbox)
      @sandbox = prebuild_sandbox
    end

    def prebuild_delta_path
      @prebuild_delta_path ||= PodPrebuild.config.prebuild_delta_path
    end

    def delta_dir
      @delta_dir ||= File.dirname(prebuild_delta_path)
    end

    def clean_delta_file
      puts "Clean delta file: #{prebuild_delta_path}"
      FileUtils.rm_rf(prebuild_delta_path)
    end

    def create_dir_if_needed(dir)
      FileUtils.mkdir_p dir unless File.directory?(dir)
    end

    # Input 2 arrays of library names
    def write_delta_file(updated, deleted)
      if updated.empty? && deleted.empty?
        Pod::UI.puts "No changes in prebuild"
        return
      end

      Pod::UI.puts "Write prebuild changes to: #{prebuild_delta_path}"
      create_dir_if_needed(delta_dir)
      changes = PodPrebuild::JSONFile.new(prebuild_delta_path)
      changes["updated"] = updated
      changes["deleted"] = deleted
      changes.save!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-binary-cache-0.1.7 lib/cocoapods-binary-cache/prebuild_output/output.rb