Sha256: b3d42f950c47bbee4db03cf33cf774a30072ba692fcc4f210048f39b5e85f1ee

Contents?: true

Size: 832 Bytes

Versions: 16

Compression:

Stored size: 832 Bytes

Contents

require 'itamae'

module Itamae
  module Resource
    class Package < Base
      define_attribute :action, default: :install
      define_attribute :name, type: String, default_name: true
      define_attribute :version, type: String

      def set_current_attributes
        installed = run_specinfra(:check_package_is_installed, name)
        @current_attributes[:installed?] = installed

        if installed
          @current_attributes[:version] = run_specinfra(:get_package_version, name).stdout.strip
        end

        if action == :install
          @attributes[:installed?] = true
        end
      end

      def install_action
        unless run_specinfra(:check_package_is_installed, name, version)
          run_specinfra(:install_package, name, version)
          updated!
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
itamae-1.0.0.beta27 lib/itamae/resource/package.rb
itamae-1.0.0.beta26 lib/itamae/resource/package.rb
itamae-1.0.0.beta25 lib/itamae/resource/package.rb
itamae-1.0.0.beta24 lib/itamae/resource/package.rb
itamae-1.0.0.beta23 lib/itamae/resource/package.rb
itamae-1.0.0.beta22 lib/itamae/resource/package.rb
itamae-1.0.0.beta21 lib/itamae/resource/package.rb
itamae-1.0.0.beta20 lib/itamae/resource/package.rb
itamae-1.0.0.beta19 lib/itamae/resource/package.rb
itamae-1.0.0.beta18 lib/itamae/resource/package.rb
itamae-1.0.0.beta17 lib/itamae/resource/package.rb
itamae-1.0.0.beta16 lib/itamae/resource/package.rb
itamae-1.0.0.beta15 lib/itamae/resource/package.rb
itamae-1.0.0.beta14 lib/itamae/resource/package.rb
itamae-1.0.0.beta13 lib/itamae/resource/package.rb
itamae-1.0.0.beta12 lib/itamae/resource/package.rb