Sha256: 47751a92a9cfa0dc5ffac5d8395d2bec646fbe90aebd9ae19c5034b747563e3b
Contents?: true
Size: 839 Bytes
Versions: 3
Compression:
Stored size: 839 Bytes
Contents
module Berkshelf::Vagrant module Action # @author Jamie Winsor <reset@riotgames.com> class LoadShelf include Berkshelf::Vagrant::EnvHelpers def initialize(app, env) @app = app end def call(env) shelf = load_shelf if shelf.nil? shelf = cache_shelf(Berkshelf::Vagrant.mkshelf) end env[:berkshelf].shelf = shelf @app.call(env) end # @param [String] path # # @return [String] def cache_shelf(path) FileUtils.mkdir_p(File.dirname(path)) File.open(cache_file, 'w+') do |f| f.write(path) end path end # @return [String, nil] def load_shelf return nil unless File.exist?(cache_file) File.read(cache_file).chomp end end end end
Version data entries
3 entries across 3 versions & 1 rubygems