vim-bundle 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +28 -0
- data/Rakefile +18 -0
- data/bin/vim-bundle +7 -0
- data/config/sample.yml +51 -0
- data/lib/vim_bundle.rb +4 -0
- data/lib/vim_bundle/cli.rb +12 -0
- data/lib/vim_bundle/commands.rb +11 -0
- data/lib/vim_bundle/commands/help.rb +15 -0
- data/lib/vim_bundle/commands/init.rb +29 -0
- data/lib/vim_bundle/commands/sample.rb +7 -0
- data/lib/vim_bundle/commands/update.rb +89 -0
- data/lib/vim_bundle/methods.rb +27 -0
- metadata +78 -0
data/README
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
= Description =
|
2
|
+
|
3
|
+
VIM bundle management
|
4
|
+
|
5
|
+
= Requirements =
|
6
|
+
|
7
|
+
* System utils: git curl tar gzip unzip
|
8
|
+
|
9
|
+
= Usage =
|
10
|
+
|
11
|
+
* Install sample config:
|
12
|
+
|
13
|
+
$vim-bundle sample > vim/bundle.yml
|
14
|
+
|
15
|
+
* Edit config .vim/bundle.yml
|
16
|
+
|
17
|
+
* Init bundle:
|
18
|
+
$ vim-bundle init
|
19
|
+
|
20
|
+
* Update bundle:
|
21
|
+
$ vim-bundle update
|
22
|
+
|
23
|
+
|
24
|
+
= References =
|
25
|
+
|
26
|
+
* http://www.vim.org/scripts/script.php?script_id=2332
|
27
|
+
* http://tammersaleh.com/posts/the-modern-vim-config-with-pathogen
|
28
|
+
* http://github.com/hariton/pathogenized
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rake/gempackagetask'
|
2
|
+
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = "vim-bundle"
|
5
|
+
s.version = `git tag -l v*`.sort.last.delete("v")
|
6
|
+
s.summary = "VIM bundle managment (with pathogen)"
|
7
|
+
s.homepage = "http://github.com/ayanko/vim-bundle"
|
8
|
+
s.email = "andriy.yanko@gmail.com"
|
9
|
+
s.authors = ["Andriy Yanko"]
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.executables = %w(vim-bundle)
|
12
|
+
s.has_rdoc = true
|
13
|
+
end
|
14
|
+
|
15
|
+
Rake::GemPackageTask.new(spec) do |p|
|
16
|
+
p.gem_spec = spec
|
17
|
+
end
|
18
|
+
|
data/bin/vim-bundle
ADDED
data/config/sample.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
bundles:
|
3
|
+
|
4
|
+
- dir: IndentAnything
|
5
|
+
url: http://www.vim.org/scripts/download_script.php?src_id=10228
|
6
|
+
type: tgz
|
7
|
+
|
8
|
+
- dir: JavascriptIndent
|
9
|
+
subdir: indent
|
10
|
+
type: vim
|
11
|
+
url: http://www.vim.org/scripts/download_script.php?src_id=11838
|
12
|
+
|
13
|
+
- dir: BlockComment
|
14
|
+
type: vim
|
15
|
+
subdir: plugin
|
16
|
+
url: http://www.vim.org/scripts/download_script.php?src_id=1387
|
17
|
+
|
18
|
+
- dir: nginx
|
19
|
+
type: vim
|
20
|
+
subdir: syntax
|
21
|
+
url: http://www.vim.org/scripts/download_script.php?src_id=12990
|
22
|
+
|
23
|
+
- dir: haproxy
|
24
|
+
type: vim
|
25
|
+
subdir: syntax
|
26
|
+
url: http://www.vim.org/scripts/download_script.php?src_id=6924
|
27
|
+
|
28
|
+
- dir: jquery
|
29
|
+
type: vim
|
30
|
+
subdir: syntax
|
31
|
+
url: http://www.vim.org/scripts/download_script.php?src_id=12276
|
32
|
+
|
33
|
+
- url: git://github.com/mattn/gist-vim.git
|
34
|
+
- url: git://github.com/astashov/vim-ruby-debugger.git
|
35
|
+
- url: git://github.com/msanders/snipmate.vim.git
|
36
|
+
- url: git://github.com/scrooloose/nerdtree.git
|
37
|
+
- url: git://github.com/timcharper/textile.vim.git
|
38
|
+
- url: git://github.com/tpope/vim-cucumber.git
|
39
|
+
- url: git://github.com/tpope/vim-fugitive.git
|
40
|
+
- url: git://github.com/tpope/vim-git.git
|
41
|
+
- url: git://github.com/tpope/vim-haml.git
|
42
|
+
- url: git://github.com/tpope/vim-markdown.git
|
43
|
+
- url: git://github.com/tpope/vim-rails.git
|
44
|
+
- url: git://github.com/tpope/vim-repeat.git
|
45
|
+
- url: git://github.com/tpope/vim-surround.git
|
46
|
+
- url: git://github.com/tpope/vim-vividchalk.git
|
47
|
+
- url: git://github.com/tsaleh/vim-align.git
|
48
|
+
- url: git://github.com/tsaleh/vim-shoulda.git
|
49
|
+
- url: git://github.com/tsaleh/vim-supertab.git
|
50
|
+
- url: git://github.com/tsaleh/vim-tcomment.git
|
51
|
+
- url: git://github.com/vim-ruby/vim-ruby.git
|
data/lib/vim_bundle.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module VimBundle
|
2
|
+
module Commands
|
3
|
+
def help
|
4
|
+
puts <<-HELP
|
5
|
+
REQUIRED SYSTEM TOOLS:
|
6
|
+
git, curl, unzip, tar, gz
|
7
|
+
USAGE: #{$0} [command]
|
8
|
+
init: install bundle plugin (pathogen)
|
9
|
+
sample: show sample config file
|
10
|
+
update: update all bundles
|
11
|
+
HELP
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module VimBundle
|
5
|
+
module Commands
|
6
|
+
|
7
|
+
def init
|
8
|
+
pathogen_file = File.join(VimBundle.vim_home, 'autoload', 'pathogen.vim')
|
9
|
+
|
10
|
+
puts "Installing #{pathogen_file} ..."
|
11
|
+
|
12
|
+
FileUtils.mkdir_p(File.dirname(pathogen_file))
|
13
|
+
|
14
|
+
File.open(pathogen_file, "w") { |f| f.write Net::HTTP.get(URI.parse(pathogen_url)) }
|
15
|
+
|
16
|
+
puts <<-DATA
|
17
|
+
DONE. Please add to your .vimrc next lines:
|
18
|
+
|
19
|
+
call pathogen#helptags()
|
20
|
+
call pathogen#runtime_append_all_bundles()
|
21
|
+
|
22
|
+
DATA
|
23
|
+
end
|
24
|
+
|
25
|
+
def pathogen_url
|
26
|
+
"http://github.com/tpope/vim-pathogen/raw/master/autoload/pathogen.vim"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module VimBundle
|
5
|
+
module Commands
|
6
|
+
def update
|
7
|
+
bundles = VimBundle.config['bundles']
|
8
|
+
|
9
|
+
abort("No bundles defined") if blank_value?(bundles)
|
10
|
+
|
11
|
+
self.erase_bundles(bundles)
|
12
|
+
bundles.each { |bundle| install_bundle(bundle) }
|
13
|
+
end
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
def erase_bundles(bundles)
|
18
|
+
puts "Erasing all bundles in #{VimBundle.dir} ..."
|
19
|
+
|
20
|
+
FileUtils.rm_rf(VimBundle.dir)
|
21
|
+
FileUtils.mkdir_p(VimBundle.dir)
|
22
|
+
end
|
23
|
+
|
24
|
+
def install_bundle(bundle)
|
25
|
+
complete_bundle_options(bundle)
|
26
|
+
validate_bundle(bundle)
|
27
|
+
|
28
|
+
puts "Updating bundle #{bundle['dir']} ..."
|
29
|
+
|
30
|
+
method = "install_#{bundle['type']}_bundle"
|
31
|
+
|
32
|
+
self.respond_to?(method) ?
|
33
|
+
self.send(method, bundle) :
|
34
|
+
abort("Unsupported #{bundle['type'].inspect} file type")
|
35
|
+
end
|
36
|
+
|
37
|
+
def install_git_bundle(bundle)
|
38
|
+
dir = self.create_bundle_dir(bundle)
|
39
|
+
system("git clone -q #{bundle['url']} #{dir}") || abort("Failed")
|
40
|
+
FileUtils.rm_rf(File.join(dir, '.git'))
|
41
|
+
end
|
42
|
+
|
43
|
+
def install_tgz_bundle(bundle)
|
44
|
+
dir = self.create_bundle_dir(bundle)
|
45
|
+
system("curl -s #{bundle['url']} | tar xz -C #{dir}") || abort("Failed")
|
46
|
+
end
|
47
|
+
|
48
|
+
def install_zip_bundle(bundle)
|
49
|
+
dir = self.create_bundle_dir(bundle)
|
50
|
+
archive_path = File.join(dir, 'bundle.zip')
|
51
|
+
system("curl -s #{bundle['url']} -o #{archive_path}") || abort("Failed")
|
52
|
+
system("unzip -q -d #{dir} #{archive_path}") || abort("Failed")
|
53
|
+
FileUtils.rm_rf(archive_path)
|
54
|
+
end
|
55
|
+
|
56
|
+
def install_vim_bundle(bundle)
|
57
|
+
abort("bundle subdir is not specified") if self.blank_value?(bundle['subdir'])
|
58
|
+
|
59
|
+
filepath = File.join(VimBundle.dir, bundle['dir'], bundle['subdir'], bundle['dir'] + ".vim")
|
60
|
+
|
61
|
+
FileUtils.mkdir_p(File.dirname(filepath))
|
62
|
+
File.open(filepath, 'w') { |f| f << Net::HTTP.get(URI.parse(bundle['url'])) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def complete_bundle_options(bundle)
|
66
|
+
if bundle['url'] =~ /^git:\/\//
|
67
|
+
bundle['type'] ||= 'git'
|
68
|
+
bundle['dir'] ||= File.basename(bundle['url'], '.git')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def validate_bundle(bundle)
|
73
|
+
%w(dir url type).each do |key|
|
74
|
+
abort("bundle #{key} is not specified") if self.blank_value?(bundle[key])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def blank_value?(value)
|
79
|
+
value.nil? || value.empty?
|
80
|
+
end
|
81
|
+
|
82
|
+
def create_bundle_dir(bundle)
|
83
|
+
dir = File.join(VimBundle.dir, bundle['dir'])
|
84
|
+
FileUtils.mkdir_p(dir)
|
85
|
+
dir
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module VimBundle
|
4
|
+
module Methods
|
5
|
+
def vim_home
|
6
|
+
File.join(ENV['HOME'], '.vim')
|
7
|
+
end
|
8
|
+
|
9
|
+
def dir
|
10
|
+
File.join(self.vim_home, 'bundle')
|
11
|
+
end
|
12
|
+
|
13
|
+
def default_config_file
|
14
|
+
File.join(self.vim_home, 'bundle.yml')
|
15
|
+
end
|
16
|
+
|
17
|
+
def config
|
18
|
+
@config ||= YAML.load_file(default_config_file)
|
19
|
+
end
|
20
|
+
|
21
|
+
def commands
|
22
|
+
@commands ||= []
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
extend Methods
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vim-bundle
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Andriy Yanko
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-06-16 00:00:00 +03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: andriy.yanko@gmail.com
|
24
|
+
executables:
|
25
|
+
- vim-bundle
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- README
|
32
|
+
- Rakefile
|
33
|
+
- bin/vim-bundle
|
34
|
+
- config/sample.yml
|
35
|
+
- lib/vim_bundle.rb
|
36
|
+
- lib/vim_bundle/cli.rb
|
37
|
+
- lib/vim_bundle/commands.rb
|
38
|
+
- lib/vim_bundle/commands/help.rb
|
39
|
+
- lib/vim_bundle/commands/init.rb
|
40
|
+
- lib/vim_bundle/commands/sample.rb
|
41
|
+
- lib/vim_bundle/commands/update.rb
|
42
|
+
- lib/vim_bundle/methods.rb
|
43
|
+
has_rdoc: true
|
44
|
+
homepage: http://github.com/ayanko/vim-bundle
|
45
|
+
licenses: []
|
46
|
+
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
hash: 3
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.3.7
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: VIM bundle managment (with pathogen)
|
77
|
+
test_files: []
|
78
|
+
|