Module: VimBundle::Commands

Extended by:
Commands
Included in:
Commands
Defined in:
lib/vim_bundle/commands.rb,
lib/vim_bundle/commands/help.rb,
lib/vim_bundle/commands/init.rb,
lib/vim_bundle/commands/sample.rb,
lib/vim_bundle/commands/update.rb

Instance Method Summary collapse

Instance Method Details

#helpObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/vim_bundle/commands/help.rb', line 3

def help
  puts "REQUIRED SYSTEM TOOLS:\ngit, curl, unzip, tar, gz\nUSAGE: \#{$0} [command]\ninit:   install bundle plugin (pathogen)\nsample: show sample config file\nupdate: update all bundles\n"
end

#initObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vim_bundle/commands/init.rb', line 7

def init
  pathogen_file = File.join(VimBundle.vim_home, 'autoload', 'pathogen.vim')

  puts "Installing #{pathogen_file} ..."

  FileUtils.mkdir_p(File.dirname(pathogen_file))

  File.open(pathogen_file, "w") { |f| f.write Net::HTTP.get(URI.parse(pathogen_url)) }

  puts "DONE. Please add to your .vimrc next lines:\n\n  call pathogen#helptags()\n  call pathogen#runtime_append_all_bundles()\n\n"
end

#pathogen_urlObject



25
26
27
# File 'lib/vim_bundle/commands/init.rb', line 25

def pathogen_url
  "http://github.com/tpope/vim-pathogen/raw/master/autoload/pathogen.vim"
end

#sampleObject



3
4
5
# File 'lib/vim_bundle/commands/sample.rb', line 3

def sample
  puts File.read(File.join(File.dirname(__FILE__), '..', '..', '..', 'config', 'sample.yml'))
end

#updateObject



6
7
8
9
10
11
12
13
# File 'lib/vim_bundle/commands/update.rb', line 6

def update
  bundles = VimBundle.config['bundles']

  abort("No bundles defined") if blank_value?(bundles)
    
  self.erase_bundles(bundles)
  bundles.each { |bundle| install_bundle(bundle) }
end