Sha256: 099781a5b66167cee40bff09de328d612360f26e6a33e6fc996ac510d053351d
Contents?: true
Size: 1.01 KB
Versions: 9
Compression:
Stored size: 1.01 KB
Contents
require 'pathname' require 'securerandom' require 'highline' require 'librarian' require 'librarian/action/install' require 'librarian/chef' module Librarian module Chef class Environment def install_path @install_path ||= begin has_home = ENV["HOME"] && File.directory?(ENV["HOME"]) tmp_dir = Pathname.new(has_home ? "~/.librarian/tmp" : "/tmp/librarian").expand_path enclosing = tmp_dir.join("chef/integration/knife/install") enclosing.mkpath unless enclosing.exist? dir = enclosing.join(SecureRandom.hex(16)) dir.mkpath at_exit { dir.rmtree } dir end end end def environment @environment ||= environment_class.new end def install_path environment.install_path end hl = HighLine.new begin Action::Install.new(environment).run rescue Error => e message = hl.color(e.message, HighLine::RED) hl.say(message) Process.exit!(1) end end end
Version data entries
9 entries across 9 versions & 3 rubygems