Class: DInstaller::DBus::Clients::Software
- Includes:
- WithServiceStatus, WithProgress
- Defined in:
- lib/dinstaller/dbus/clients/software.rb
Overview
D-Bus client for software configuration
Instance Attribute Summary
Attributes included from WithProgress
Instance Method Summary collapse
-
#add_resolvables(unique_id, type, resolvables, optional: false) ⇒ Object
Add the given list of resolvables to the packages proposal.
-
#available_products ⇒ Array<Array<String, String>>
Available products for the installation.
-
#finish ⇒ Object
Finishes the software installation.
-
#get_resolvables(unique_id, type, optional: false) ⇒ Array<String>
Returns a list of resolvables.
-
#initialize ⇒ Software
constructor
A new instance of Software.
-
#install ⇒ Object
Performs the packages installation.
-
#on_product_selected(&block) ⇒ Object
Registers a callback to run when the product changes.
-
#probe(&done) ⇒ Object
Starts the probing process.
-
#propose ⇒ Object
Makes the software proposal.
-
#provision_selected?(tag) ⇒ Boolean
Determine whether the given tag are provided by the selected packages.
-
#provisions_selected?(tags) ⇒ Array<Boolean>
Determine whether the given tags are provided by the selected packages.
-
#remove_resolvables(unique_id, type, resolvables, optional: false) ⇒ Object
Remove resolvables from a list.
-
#select_product(name) ⇒ Object
Selects the product to install.
-
#selected_product ⇒ String
Product selected to install.
- #service_name ⇒ String
-
#set_resolvables(unique_id, type, resolvables, optional: false) ⇒ Object
Replace a list of resolvables in the packages proposal.
Methods included from WithProgress
#on_progress_change, #on_progress_finish, #start_progress
Methods included from WithServiceStatus
#on_service_status_change, #service_status, #to_service_status
Methods inherited from Base
Constructor Details
#initialize ⇒ Software
Returns a new instance of Software.
37 38 39 40 41 42 43 44 45 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 37 def initialize super @dbus_object = service["/org/opensuse/DInstaller/Software1"] @dbus_object.introspect @dbus_proposal = service["/org/opensuse/DInstaller/Software/Proposal1"] @dbus_proposal.introspect end |
Instance Method Details
#add_resolvables(unique_id, type, resolvables, optional: false) ⇒ Object
Add the given list of resolvables to the packages proposal
125 126 127 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 125 def add_resolvables(unique_id, type, resolvables, optional: false) dbus_proposal.AddResolvables(unique_id, TYPES.index(type), resolvables, optional) end |
#available_products ⇒ Array<Array<String, String>>
Available products for the installation
55 56 57 58 59 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 55 def available_products dbus_object["org.opensuse.DInstaller.Software1"]["AvailableBaseProducts"].map do |l| l[0..1] end end |
#finish ⇒ Object
Finishes the software installation
96 97 98 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 96 def finish dbus_object.Finish end |
#get_resolvables(unique_id, type, optional: false) ⇒ Array<String>
Returns a list of resolvables
136 137 138 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 136 def get_resolvables(unique_id, type, optional: false) dbus_proposal.GetResolvables(unique_id, TYPES.index(type), optional).first end |
#install ⇒ Object
Performs the packages installation
86 87 88 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 86 def install dbus_object.Install end |
#on_product_selected(&block) ⇒ Object
Signal subscription is done only once. Otherwise, the latest subscription overrides the previous one.
Registers a callback to run when the product changes
168 169 170 171 172 173 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 168 def on_product_selected(&block) on_properties_change(dbus_object) do |_, changes, _| base_product = changes["SelectedBaseProduct"] block.call(base_product) unless base_product.nil? end end |
#probe(&done) ⇒ Object
Starts the probing process
If a block is given, the method returns immediately and the probing is performed in an asynchronous way.
81 82 83 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 81 def probe(&done) dbus_object.Probe(&done) end |
#propose ⇒ Object
Makes the software proposal
91 92 93 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 91 def propose dbus_object.Propose end |
#provision_selected?(tag) ⇒ Boolean
Determine whether the given tag are provided by the selected packages
105 106 107 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 105 def provision_selected?(tag) dbus_object.ProvisionSelected(tag) end |
#provisions_selected?(tags) ⇒ Array<Boolean>
Determine whether the given tags are provided by the selected packages
114 115 116 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 114 def provisions_selected?() dbus_object.ProvisionsSelected() end |
#remove_resolvables(unique_id, type, resolvables, optional: false) ⇒ Object
Remove resolvables from a list
158 159 160 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 158 def remove_resolvables(unique_id, type, resolvables, optional: false) dbus_proposal.RemoveResolvables(unique_id, TYPES.index(type), resolvables, optional) end |
#select_product(name) ⇒ Object
Selects the product to install
71 72 73 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 71 def select_product(name) dbus_object.SelectProduct(name) end |
#selected_product ⇒ String
Product selected to install
64 65 66 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 64 def selected_product dbus_object["org.opensuse.DInstaller.Software1"]["SelectedBaseProduct"] end |
#service_name ⇒ String
48 49 50 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 48 def service_name @service_name ||= "org.opensuse.DInstaller.Software" end |
#set_resolvables(unique_id, type, resolvables, optional: false) ⇒ Object
Replace a list of resolvables in the packages proposal
147 148 149 |
# File 'lib/dinstaller/dbus/clients/software.rb', line 147 def set_resolvables(unique_id, type, resolvables, optional: false) dbus_proposal.SetResolvables(unique_id, TYPES.index(type), resolvables, optional) end |