Class: LoomExt::CoreMods::Package
- Inherits:
-
Loom::Mods::Module
- Object
- Loom::Mods::Module
- LoomExt::CoreMods::Package
- Defined in:
- lib/loomext/coremods/package/adapter.rb,
lib/loomext/coremods/package/package.rb
Defined Under Namespace
Modules: Actions Classes: AptAdapter, DnfAdapter, DpkgAdapter, GemAdapter, PkgAdapter, RpmAdapter
Constant Summary collapse
- UnsupportedPackageManager =
Class.new Loom::Mods::ModActionError
Instance Attribute Summary collapse
-
#pkg_adapter ⇒ Object
readonly
Returns the value of attribute pkg_adapter.
Attributes inherited from Loom::Mods::Module
#action_proxy, #loom, #loom_config, #mods, #shell
Instance Method Summary collapse
Methods inherited from Loom::Mods::Module
action_proxy, bind_action, #execute, import_actions, #initialize, register_mod, required_commands
Constructor Details
This class inherits a constructor from Loom::Mods::Module
Instance Attribute Details
#pkg_adapter ⇒ Object (readonly)
Returns the value of attribute pkg_adapter.
9 10 11 |
# File 'lib/loomext/coremods/package/package.rb', line 9 def pkg_adapter @pkg_adapter end |
Instance Method Details
#default_adapter ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/loomext/coremods/package/package.rb', line 35 def default_adapter if loom.test :which, "dnf" DnfAdapter.new loom elsif loom.test :which, "rpm" RpmAdapter.new loom elsif loom.test :which, "apt" AptAdapter.new loom elsif loom.test :which, "dpkg" DpkgAdapter.new loom else raise UnsupportedPackageManager end end |
#get(adapter) ⇒ Object Also known as: []
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/loomext/coremods/package/package.rb', line 17 def get(adapter) case adapter.to_sym when :dnf DnfAdapter.new loom when :rpm RpmAdapter.new loom when :apt AptAdapter.new loom when :dpkg DpkgAdapter.new loom when :gem GemAdapter.new loom else raise UnsupportedPackageManager, adapter end end |
#init_action ⇒ Object
13 14 15 |
# File 'lib/loomext/coremods/package/package.rb', line 13 def init_action @pkg_adapter = default_adapter end |