Class: Derelict::Parser::PluginList
- Inherits:
-
Derelict::Parser
- Object
- Derelict::Parser
- Derelict::Parser::PluginList
- Extended by:
- Memoist
- Defined in:
- lib/derelict/parser/plugin_list.rb,
lib/derelict/parser/plugin_list/invalid_format.rb,
lib/derelict/parser/plugin_list/needs_reinstall.rb
Overview
Parses the output of “vagrant plugin list”
Defined Under Namespace
Classes: InvalidFormat, NeedsReinstall
Constant Summary collapse
- PARSE_PLUGIN =
Regexp to parse a plugin line into a plugin name and version
Capture groups:
1. Plugin name, as listed in the output 2. Currently installed version (without surrounding brackets)
%r[ ^([A-Za-z0-9\-_.]+) # Plugin name starts at the start of the line. \ # Version is separated by a space character, \( # surrounded by brackets, ([0-9\-_.]+) # consists of numbers, hyphens, underscore, dot, (, .*)? # optionally followed by a comma space and word \) $ # at the end of the line. ]x
- NEEDS_REINSTALL =
Regexp to determine whether plugins need to be reinstalled
%r[ ^The\splugins\sbelow\swill\snot\sbe\sloaded\suntil\sthey're\s uninstalled\sand\sreinstalled:$ ]x
Instance Attribute Summary
Attributes inherited from Derelict::Parser
Instance Method Summary collapse
-
#description ⇒ Object
Provides a description of this Parser.
-
#needs_reinstall? ⇒ Boolean
Determines if old plugins need to be reinstalled.
-
#plugins ⇒ Object
Retrieves a Set containing all the plugins from the output.
Methods inherited from Derelict::Parser
Methods included from Utils::Logger
Constructor Details
This class inherits a constructor from Derelict::Parser
Instance Method Details
#description ⇒ Object
Provides a description of this Parser
Mainly used for log messages.
46 47 48 |
# File 'lib/derelict/parser/plugin_list.rb', line 46 def description "Derelict::Parser::PluginList instance" end |
#needs_reinstall? ⇒ Boolean
Determines if old plugins need to be reinstalled
39 40 41 |
# File 'lib/derelict/parser/plugin_list.rb', line 39 def needs_reinstall? output =~ NEEDS_REINSTALL end |
#plugins ⇒ Object
Retrieves a Set containing all the plugins from the output
33 34 35 36 |
# File 'lib/derelict/parser/plugin_list.rb', line 33 def plugins raise NeedsReinstall, output if needs_reinstall? plugin_lines.map {|l| parse_line l.match(PARSE_PLUGIN) }.to_set end |