Module: Bootlace::Package
Instance Attribute Summary collapse
-
#noop ⇒ Object
readonly
Returns the value of attribute noop.
Instance Method Summary collapse
- #install_package_from_hash(hash) ⇒ Object
- #install_package_from_string(s) ⇒ Object
- #noop! ⇒ Object
- #package(arg) ⇒ Object
Methods included from Logger
Methods included from OS
Instance Attribute Details
#noop ⇒ Object (readonly)
Returns the value of attribute noop.
9 10 11 |
# File 'lib/bootlace/package.rb', line 9 def noop @noop end |
Instance Method Details
#install_package_from_hash(hash) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/bootlace/package.rb', line 37 def install_package_from_hash(hash) unless package_installed? hash[os] if noop logger.info("Would have installed package '#{hash[os]}' via #{package_manager}") else logger.info("Installing package '#{hash[os]}' via #{package_manager}") install_package hash[os] end else logger.info("Package '#{hash[os]}' already installed; skipping") end end |
#install_package_from_string(s) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bootlace/package.rb', line 24 def install_package_from_string(s) unless package_installed? s if noop logger.info("Would have installed package '#{s}' via #{package_manager}") else logger.info("Installing package '#{s}' via #{package_manager}") install_package s end else logger.info("Package '#{s}' already installed; skipping") end end |
#noop! ⇒ Object
11 12 13 |
# File 'lib/bootlace/package.rb', line 11 def noop! @noop = true end |
#package(arg) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/bootlace/package.rb', line 15 def package(arg) case arg.class.name when "String" install_package_from_string arg when "Hash" install_package_from_hash arg end end |