Sha256: 0346017bcc6bd919feb2c0278b1c82b1c42ab23f5682782211d36f031c374a45

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

require 'librarian'
require 'fileutils'

require 'librarian/puppet/extension'
require 'librarian/puppet/version'

require 'librarian/action/install'

module Librarian
  module Puppet
    @@puppet_version = nil

    # Output of puppet --version, typically x.y.z
    # For Puppet Enterprise it contains the PE version too, ie. 3.4.3 (Puppet Enterprise 3.2.1)
    def puppet_version
      return @@puppet_version unless @@puppet_version.nil?

      begin
        @@puppet_version = Librarian::Posix.run!(%W{puppet --version}).strip
      rescue Errno::ENOENT, Librarian::Posix::CommandFailure => error
        msg = "Unable to load puppet. Please install it using native packages for your platform (eg .deb, .rpm, .dmg, etc)."
        msg += "\npuppet --version returned #{error.status}" if error.respond_to? :status
        msg += "\n#{error.message}" unless error.message.nil?
        $stderr.puts msg
        exit 1
      end
      return @@puppet_version
    end

    # Puppet version x.y.z translated as a Gem version
    def puppet_gem_version
      Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))
    end

  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
librarian-puppet-4.0.1 lib/librarian/puppet.rb
librarian-puppet-4.0.0 lib/librarian/puppet.rb
librarian-puppet-3.0.1 lib/librarian/puppet.rb
librarian-puppet-3.0.0 lib/librarian/puppet.rb
librarian-puppet-2.2.3 lib/librarian/puppet.rb
librarian-puppet-pr328-2.2.4 lib/librarian/puppet.rb
librarian-puppet-pr328-2.2.2 lib/librarian/puppet.rb
librarian-puppet-pr328-2.2.1 lib/librarian/puppet.rb
librarian-puppet-pr328-2.2.1pr328 lib/librarian/puppet.rb
librarian-puppet-2.2.1 lib/librarian/puppet.rb
librarian-puppet-2.2.0 lib/librarian/puppet.rb
librarian-puppet-2.1.1 lib/librarian/puppet.rb