Class: LumiaServer::Plugin
- Inherits:
-
Object
- Object
- LumiaServer::Plugin
- Defined in:
- lib/lumia-server/plugin.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#server_yaml ⇒ Object
readonly
Returns the value of attribute server_yaml.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(data, server_yaml) ⇒ Plugin
constructor
A new instance of Plugin.
- #install ⇒ Object
- #install_mod ⇒ Object
- #needs_update ⇒ Object
Constructor Details
#initialize(data, server_yaml) ⇒ Plugin
Returns a new instance of Plugin.
12 13 14 15 16 17 18 19 20 |
# File 'lib/lumia-server/plugin.rb', line 12 def initialize(data, server_yaml) @data = data @server_yaml = server_yaml @name = data['name'] @version = data['version'] @provider = data.key?('provider') ? Provider.new(@data['provider']) : nil @id = provider.nil? ? version : provider.id end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/lumia-server/plugin.rb', line 4 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/lumia-server/plugin.rb', line 10 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/lumia-server/plugin.rb', line 7 def name @name end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
9 10 11 |
# File 'lib/lumia-server/plugin.rb', line 9 def provider @provider end |
#server_yaml ⇒ Object (readonly)
Returns the value of attribute server_yaml.
5 6 7 |
# File 'lib/lumia-server/plugin.rb', line 5 def server_yaml @server_yaml end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
8 9 10 |
# File 'lib/lumia-server/plugin.rb', line 8 def version @version end |
Instance Method Details
#install ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lumia-server/plugin.rb', line 22 def install unless provider.nil? if needs_update puts "#{name}: updating.." install_mod else puts "#{name}: up-to-date" end end end |
#install_mod ⇒ Object
37 38 39 |
# File 'lib/lumia-server/plugin.rb', line 37 def install_mod provider.install(File.join('build', 'plugins')) end |
#needs_update ⇒ Object
33 34 35 |
# File 'lib/lumia-server/plugin.rb', line 33 def needs_update server_yaml.nil? || server_yaml[name] != id end |