Sha256: 0dc71a5c6f608db7a5e354b9b9417caf0a903e033a90580825006ba83f88f7a5

Contents?: true

Size: 746 Bytes

Versions: 8

Compression:

Stored size: 746 Bytes

Contents

module LgPodPlugin

  class LFileManager

    def self.cache_director
      Pathname(File.join(Dir.home, "Library/Caches"))
    end

    # 本地下载路径 ~Library/Caches/LgPodPlugin
    def self.download_director
      cache_path = self.cache_director.join("LgPodPlugin")
      unless cache_path.exist?
        # pp "文件路径不存在"
        cache_path.mkdir(0700)
      end
      cache_path
    end

    # pod缓存工作目录, 根据项目所在路径计算所得 确保唯一
    def self.cache_workspace(root)
      timestamp = "_#{Time.now.to_i}_"
      key = root.to_path + timestamp + "#{(rand * 10000000).to_i}"
      director = Digest::MD5.hexdigest(key)
      return self.download_director.join(director)
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lg_pod_plugin-1.1.3 lib/lg_pod_plugin/file_path.rb
lg_pod_plugin-1.1.2 lib/lg_pod_plugin/file_path.rb
lg_pod_plugin-1.1.1 lib/lg_pod_plugin/file_path.rb
lg_pod_plugin-1.1.0 lib/lg_pod_plugin/file_path.rb
lg_pod_plugin-1.0.10 lib/lg_pod_plugin/file_path.rb
lg_pod_plugin-1.0.8 lib/lg_pod_plugin/file_path.rb
lg_pod_plugin-1.0.7 lib/lg_pod_plugin/file_path.rb
lg_pod_plugin-1.0.6 lib/lg_pod_plugin/file_path.rb