Class: VimEpidemic::Plugin
- Inherits:
-
Object
- Object
- VimEpidemic::Plugin
- Defined in:
- lib/vim-epidemic/plugin.rb
Instance Method Summary collapse
-
#initialize(config, *args, block) ⇒ Plugin
constructor
A new instance of Plugin.
- #install ⇒ Object
- #installed? ⇒ Boolean
- #match?(*args) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(config, *args, block) ⇒ Plugin
Returns a new instance of Plugin.
6 7 8 9 10 11 12 |
# File 'lib/vim-epidemic/plugin.rb', line 6 def initialize config, *args, block @config = config = args.last.kind_of?(Hash) ? args.pop : {} @source = args.shift @type = args.shift || [:type] @block = block end |
Instance Method Details
#install ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vim-epidemic/plugin.rb', line 18 def install FileUtils.mkdir_p @config.bundle_dir if File.exists? dir Dir.chdir dir `git pull` else Dir.chdir @config.bundle_dir `git clone #{complete_source} #{name}` Dir.chdir dir if $? == 0 end call_block if $? == 0 $? == 0 end |
#installed? ⇒ Boolean
36 37 38 |
# File 'lib/vim-epidemic/plugin.rb', line 36 def installed? File.exists? dir end |
#match?(*args) ⇒ Boolean
14 15 16 |
# File 'lib/vim-epidemic/plugin.rb', line 14 def match? *args complete_source(args.first) == complete_source end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/vim-epidemic/plugin.rb', line 32 def to_s "#{name} (#{complete_source})" end |