Class: VagrantPlugins::Multiplug::Dependency
- Inherits:
-
Object
- Object
- VagrantPlugins::Multiplug::Dependency
- Defined in:
- lib/vagrant_plugins/multiplug/config.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(name, version = nil) ⇒ Dependency
constructor
A new instance of Dependency.
- #installed? ⇒ Boolean
-
#options ⇒ String
Command-line options for ‘vagrant plugin install NAME`.
Constructor Details
#initialize(name, version = nil) ⇒ Dependency
Returns a new instance of Dependency.
18 19 20 21 |
# File 'lib/vagrant_plugins/multiplug/config.rb', line 18 def initialize(name, version = nil) @name = name @version = version end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/vagrant_plugins/multiplug/config.rb', line 16 def name @name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
16 17 18 |
# File 'lib/vagrant_plugins/multiplug/config.rb', line 16 def version @version end |
Instance Method Details
#installed? ⇒ Boolean
Note:
::Vagrant.has_plugin?(@name, @version) cannot be used because it looks up from caches
24 25 26 27 28 29 30 31 32 |
# File 'lib/vagrant_plugins/multiplug/config.rb', line 24 def installed? `vagrant plugin list`.each_line.any? do |line| if @version line == "#{@name} (#{@version})\n" else line.start_with?("#{@name} (") end end end |
#options ⇒ String
Returns Command-line options for ‘vagrant plugin install NAME`.
35 36 37 38 39 |
# File 'lib/vagrant_plugins/multiplug/config.rb', line 35 def if @version "--plugin-version #{@version}" end end |