Module: VPM::Runner
- Defined in:
- lib/vpm/runner.rb
Constant Summary collapse
- AT_EXIT_HOOK_BACKTRACE_LINE =
"#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
Class Method Summary collapse
- .autorun ⇒ Object
-
.install_all_plugins ⇒ Object
TODO: Make this part of ‘vpm install`.
- .installed_at_exit? ⇒ Boolean
- .run(args) ⇒ Object
- .run_command(command, args) ⇒ Object
Class Method Details
.autorun ⇒ Object
3 4 5 6 7 |
# File 'lib/vpm/runner.rb', line 3 def self.autorun return if installed_at_exit? at_exit { exit run(ARGV).to_i } @installed_at_exit = true end |
.install_all_plugins ⇒ Object
TODO: Make this part of ‘vpm install`
32 33 34 35 36 37 38 |
# File 'lib/vpm/runner.rb', line 32 def self.install_all_plugins vim_plugins_file = File.join(File.('.'), 'VimPlugins') content = File.read(vim_plugins_file) plugins = ManifestParser.parse(content) plugins.each(&:install) true end |
.installed_at_exit? ⇒ Boolean
10 11 12 |
# File 'lib/vpm/runner.rb', line 10 def self.installed_at_exit? @installed_at_exit ||= false end |
.run(args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vpm/runner.rb', line 14 def self.run(args) command = args[0] # TODO: extract out into CommandLine.run(args) result = false if command.nil? result = install_all_plugins else result = run_command(command, args) end result ? 0 : 1 ensure VPM.plugins.save_to_file if VPM.plugins.changed? end |
.run_command(command, args) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vpm/runner.rb', line 40 def self.run_command(command, args) parser = CommandOptions.parser(command) = parser.parse!(args) plugin_name = args[1] unless plugin_name puts parser.opts_parser exit end type = .delete(:type) plugin = Plugin.new(plugin_name, type, ) plugin.run_command(command) end |