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 <<-HELP
REQUIRED SYSTEM TOOLS:
git, curl, unzip, tar, gz
USAGE: #{$0} [command]
init:   install bundle plugin (pathogen)
sample: show sample config file
update: update all bundles
HELP
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 <<-DATA
DONE. Please add to your .vimrc next lines:

  call pathogen#helptags()
  call pathogen#runtime_append_all_bundles()

DATA
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