Class: DMG::Pkg
Instance Attribute Summary collapse
-
#mpkg ⇒ Object
readonly
Returns the value of attribute mpkg.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#volume_dir ⇒ Object
readonly
Returns the value of attribute volume_dir.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Pkg
constructor
A new instance of Pkg.
Methods included from OutputHelpers
Constructor Details
#initialize(args) ⇒ Pkg
Returns a new instance of Pkg.
21 22 23 24 25 26 27 |
# File 'lib/dmg/pkg.rb', line 21 def initialize(args) @name = args['name'] @package = args['package'] @url = args['url'] @volume_dir = args['volume_dir'] || @package @mpkg = args['mpkg'] end |
Instance Attribute Details
#mpkg ⇒ Object (readonly)
Returns the value of attribute mpkg.
19 20 21 |
# File 'lib/dmg/pkg.rb', line 19 def mpkg @mpkg end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/dmg/pkg.rb', line 19 def name @name end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
19 20 21 |
# File 'lib/dmg/pkg.rb', line 19 def package @package end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
19 20 21 |
# File 'lib/dmg/pkg.rb', line 19 def url @url end |
#volume_dir ⇒ Object (readonly)
Returns the value of attribute volume_dir.
19 20 21 |
# File 'lib/dmg/pkg.rb', line 19 def volume_dir @volume_dir end |
Class Method Details
.find!(pkg_name) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/dmg/pkg.rb', line 12 def self.find!(pkg_name) pkg = all.select { |pkg| pkg.name == pkg_name }.first raise PackageNotFound, "Can't find a package called '#{pkg_name}'" unless pkg pkg end |
.install(pkg_names) ⇒ Object
7 8 9 10 |
# File 'lib/dmg/pkg.rb', line 7 def self.install(pkg_names) pkgs = pkg_names.map { |pkg_name| find!(pkg_name) } pkgs.each(&:install!) end |
.list ⇒ Object
3 4 5 |
# File 'lib/dmg/pkg.rb', line 3 def self.list all.map(&:name).sort end |