Class: VundleCli::Installer
- Inherits:
-
Object
- Object
- VundleCli::Installer
- Defined in:
- lib/vundle_cli/installer.rb
Instance Attribute Summary collapse
-
#force ⇒ Object
readonly
Returns the value of attribute force.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
-
#settings_dir ⇒ Object
readonly
Returns the value of attribute settings_dir.
-
#vimdir ⇒ Object
readonly
Returns the value of attribute vimdir.
-
#vimrc ⇒ Object
readonly
Returns the value of attribute vimrc.
Instance Method Summary collapse
-
#initialize(options, plugin = nil) ⇒ Installer
constructor
A new instance of Installer.
- #install ⇒ Object
Constructor Details
#initialize(options, plugin = nil) ⇒ Installer
Returns a new instance of Installer.
10 11 12 13 14 15 16 17 |
# File 'lib/vundle_cli/installer.rb', line 10 def initialize(, plugin = nil) @options = @vimdir = file_validate(.vimdir, true) @vimrc = file_validate(.vimrc) unless plugin.nil? @plugin = plugin end end |
Instance Attribute Details
#force ⇒ Object (readonly)
Returns the value of attribute force.
8 9 10 |
# File 'lib/vundle_cli/installer.rb', line 8 def force @force end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/vundle_cli/installer.rb', line 8 def @options end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
8 9 10 |
# File 'lib/vundle_cli/installer.rb', line 8 def plugin @plugin end |
#settings_dir ⇒ Object (readonly)
Returns the value of attribute settings_dir.
8 9 10 |
# File 'lib/vundle_cli/installer.rb', line 8 def settings_dir @settings_dir end |
#vimdir ⇒ Object (readonly)
Returns the value of attribute vimdir.
8 9 10 |
# File 'lib/vundle_cli/installer.rb', line 8 def vimdir @vimdir end |
#vimrc ⇒ Object (readonly)
Returns the value of attribute vimrc.
8 9 10 |
# File 'lib/vundle_cli/installer.rb', line 8 def vimrc @vimrc end |
Instance Method Details
#install ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vundle_cli/installer.rb', line 20 def install say "Writing plugin in #{@vimrc}..." tmp = Tempfile.new("vimrc_tmp") open(@vimrc, 'r').each { |l| if l.chomp =~ /vundle#begin/ l << "\nPlugin '#{@plugin}'" end tmp << l } tmp.close FileUtils.mv(tmp.path, @vimrc) say "Waiting for plugin installing complete..." system "vim +PluginInstall +qall" end |