Sha256: 5fcb3a79c19f75ac389b26e077784fd5877ce76c0bd1071717a88e1b3e58dc57

Contents?: true

Size: 958 Bytes

Versions: 35

Compression:

Stored size: 958 Bytes

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 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

35 entries across 35 versions & 3 rubygems

Version Path
librarian-puppet-0.9.10 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.9 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.8 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-maestrodev-0.9.7.5 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-maestrodev-0.9.7.4 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-maestrodev-0.9.7.3 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-maestrodev-0.9.7.2 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-maestrodev-0.9.7.1 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-maestrodev-0.9.7 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.7 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.6 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.5 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.4 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.3 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.2 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.2.pre vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-0.0.24 lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.1 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.9.0 vendor/librarian/lib/librarian/chef/integration/knife.rb
librarian-puppet-0.0.1.pre2 vendor/librarian/lib/librarian/chef/integration/knife.rb