Sha256: dac8c18e7b59e549b39c4efdc8c95e266b0cb03ba3eaf4113bf7743b977f420f

Contents?: true

Size: 1.19 KB

Versions: 28

Compression:

Stored size: 1.19 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
      Pod::UI.message "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

    def write_delta_file(options)
      updated = options[:updated]
      deleted = options[:deleted]

      if updated.empty? && deleted.empty?
        Pod::UI.puts "No changes in prebuild"
        return
      end

      Pod::UI.message "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

28 entries across 28 versions & 3 rubygems

Version Path
cocoapods-binary-artifactory-cache-0.0.1 lib/cocoapods-binary-artifactory-cache/prebuild_output/output.rb
cocoapods-binary-cache-0.1.14 lib/cocoapods-binary-cache/prebuild_output/output.rb
cocoapods-binary-cache-0.1.13 lib/cocoapods-binary-cache/prebuild_output/output.rb
cocoapods-binary-cache-0.1.12 lib/cocoapods-binary-cache/prebuild_output/output.rb
cocoapods-binary-cache-0.1.11 lib/cocoapods-binary-cache/prebuild_output/output.rb
cocoapods-binary-cache-0.1.10 lib/cocoapods-binary-cache/prebuild_output/output.rb
cocoapods-binary-cache-0.1.9 lib/cocoapods-binary-cache/prebuild_output/output.rb
cocoapods-binary-cache-0.1.8 lib/cocoapods-binary-cache/prebuild_output/output.rb