Sha256: 410d6968b36a45d80f3ac1a08e74c322edd9eec6d83f83dd031fff03ff16978d

Contents?: true

Size: 968 Bytes

Versions: 7

Compression:

Stored size: 968 Bytes

Contents

module PodPrebuild
  class CommandExecutor
    def initialize(options)
      @config = options[:config]
      prepare_cache_dir
    end

    def installer
      @installer ||= begin
        pod_config = Pod::Config.instance
        Pod::Installer.new(pod_config.sandbox, pod_config.podfile, pod_config.lockfile)
      end
    end

    def use_local_cache?
      @config.cache_repo.nil?
    end

    def prepare_cache_dir
      FileUtils.mkdir_p(@config.cache_path) if @config.cache_path
    end

    def git(cmd, options = {})
      comps = ["git"]
      comps << "-C" << @config.cache_path unless options[:cache_repo] == false
      comps << cmd
      comps << "&> /dev/null" if options[:ignore_output]
      comps << "|| true" if options[:can_fail]
      cmd = comps.join(" ")
      raise "Fail to run command '#{cmd}'" unless system(cmd)
    end

    def git_clone(cmd, options = {})
      git("clone #{cmd}", options.merge(:cache_repo => false))
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
cocoapods-binary-cache-next-0.1.16 lib/command/executor/base.rb
cocoapods-binary-cache-next-0.1.15 lib/command/executor/base.rb
cocoapods-binary-ht-1.0.0 lib/command/executor/base.rb
cocoapods-binary-cache-0.1.14 lib/command/executor/base.rb
cocoapods-binary-cache-0.1.13 lib/command/executor/base.rb
cocoapods-binary-cache-0.1.12 lib/command/executor/base.rb
cocoapods-binary-cache-0.1.11 lib/command/executor/base.rb