Sha256: 787a4fee3045883a767f4e5bae67bd84e547278b24854de5d0611db7d3753f30
Contents?: true
Size: 1.05 KB
Versions: 23
Compression:
Stored size: 1.05 KB
Contents
require 'autobuild/environment' module Autoproj module Ops def self.cached_env_path(root_dir) File.join(root_dir, '.autoproj', 'env.yml') end def self.load_cached_env(root_dir) path = cached_env_path(root_dir) if File.file?(path) env = YAML.load(File.read(path)) Autobuild::Environment::ExportedEnvironment.new( env['set'], env['unset'], env['update']) end end def self.save_cached_env(root_dir, env) env = env.exported_environment path = cached_env_path(root_dir) existing = begin YAML.load(File.read(path)) rescue Exception end env = Hash['set' => env.set, 'unset' => env.unset, 'update' => env.update] if env != existing Ops.atomic_write(path) do |io| io.write YAML.dump(env) end true end end end end
Version data entries
23 entries across 23 versions & 1 rubygems