vim_pathogen_plugin_manager 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4eeca1c3773ce8ef61e337b38661e5c831b0ca07
4
+ data.tar.gz: 232e9892c5d6c0f4199a29a72a036b5d84bf5405
5
+ SHA512:
6
+ metadata.gz: aea3a4c5453ae613d9924882a01d0ff85be2343471031492a94c814e57589248b67e57bc0baf569f9f1a719dcd7a3e420e1164da1eba33a69290500af6cd6d79
7
+ data.tar.gz: a077dfe3b11688ffcdfe2150882aacd70f23ddf577313cb2e23c3130ef589e797fdcc1a13c0b25ecb498c696882c7dad44fa190a262fc049dbd77c77a19c0e4f
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vim_pathogen_plugin_manager.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Piotr Wasilewski
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Plugin manager for Vim with Pathogen
2
+ With this Ruby script you can easily install, update and remove Vim plugins in ~/.vim/bundle (Pathogen)
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'vim_pathogen_plugin_manager'
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install vim_pathogen_plugin_manager
17
+
18
+ ## Usage
19
+
20
+ Create file ~/.vim/bundle.list (example in this repository) and put there all plugins you want to install and maintain:
21
+
22
+ # put this file in ~/.vim/ => ~/.vim/bundle.list
23
+ https://github.com/tpope/vim-sensible.git
24
+ https://github.com/scrooloose/nerdcommenter.git
25
+
26
+ Plugins on this list will be installed. Plugins already installed will be updated. If you want to remove a plugin, just delete it from file or comment it out and run remove task.
27
+
28
+ Now you can easily install, update or remove plugins by running:
29
+
30
+ Install:
31
+
32
+ vim_pathogen_plugin_manager -i
33
+
34
+ Update:
35
+
36
+ vim_pathogen_plugin_manager -u
37
+
38
+ Remove:
39
+
40
+ vim_pathogen_plugin_manager -r
41
+
42
+ You can also use file in some other location with additional -p parameter:
43
+
44
+ vim_pathogen_plugin_manager -i -p /some/other/location/bundle.list
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it ( http://github.com/<my-github-username>/vim_pathogen_plugin_manager/fork )
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # require 'colorize'
4
+ # require 'optparse'
5
+ # require 'uri'
6
+ # require 'fileutils'
7
+ require 'vim_pathogen_plugin_manager'
8
+
9
+ # initnial check if Git version is sane enough
10
+ VimPathogenPluginManager::check_git_version
11
+
12
+ manager = VimPathogenPluginManager::Manager.new
13
+
14
+ if manager.parse_options
15
+ manager.run
16
+ end
data/bundle.list ADDED
@@ -0,0 +1,3 @@
1
+ # put this file in ~/.vim/ => ~/.vim/bundle.list
2
+ https://github.com/tpope/vim-sensible.git
3
+ https://github.com/scrooloose/nerdcommenter.git
@@ -0,0 +1,170 @@
1
+ require "vim_pathogen_plugin_manager/version"
2
+ require 'optparse'
3
+ require 'colorize'
4
+
5
+ module VimPathogenPluginManager
6
+
7
+ class Manager
8
+
9
+ def initialize
10
+ # getting Home dir + vim budles dir
11
+ @dir = Dir.open Dir.home + "/.vim/bundle/"
12
+ @bundle_list = Dir.home + "/.vim/bundle.list"
13
+ end
14
+
15
+ def parse_options
16
+ @options = {}
17
+
18
+ @opts = OptionParser.new
19
+
20
+ @opts.banner = "Usage: plugin_manager.rb [options]"
21
+
22
+ @opts.on("-u", "--update", "Update all Vim plugins") do |u|
23
+ @options[:action] = "u"
24
+ end
25
+
26
+ @opts.on("-i", "--install", "Install Vim plugins from list [bundle.list]") do |i|
27
+ @options[:action] = "i"
28
+ end
29
+
30
+ @opts.on("-r", "--remove", "Remove Vim plugins not on the list [bundle.list]") do |r|
31
+ @options[:action] = "r"
32
+ end
33
+
34
+ @opts.on("-p", "--path [path_to_file]", "Path to [bundle.list]") do |p|
35
+ @options[:path] = p
36
+ end
37
+
38
+ @opts.on_tail("-h", "--help", "Show this message") do
39
+ puts @opts
40
+ exit
41
+ end
42
+
43
+ @opts.on_tail("--version", "Show version") do
44
+ puts VimPathogenPluginManager::VERSION
45
+ exit
46
+ end
47
+
48
+ @opts.on_tail("--usage", "Show usage example") do
49
+ puts "Example usage (install plugins)".colorize(:yellow) + " vim_pathogen_plugin_manager -i -p /home/user/custom_bundle.list".colorize(:light_blue)
50
+ exit
51
+ end
52
+
53
+ begin
54
+ @opts.parse!(ARGV)
55
+ rescue OptionParser::InvalidOption => e
56
+ puts e
57
+ puts @opts
58
+ end
59
+ end
60
+
61
+ def run
62
+ valid_option = true
63
+
64
+ if @options[:path] then
65
+ @bundle_list = @options[:path]
66
+ end
67
+
68
+ case @options[:action]
69
+ when "u"
70
+ update
71
+ when "i"
72
+ install
73
+ when "r"
74
+ remove
75
+ else
76
+ puts @opts
77
+ valid_option = false
78
+ end
79
+
80
+ if valid_option then
81
+ print "done :)\n".colorize(:light_magenta)
82
+ end
83
+ end
84
+
85
+ private
86
+
87
+ def update
88
+ print "Updating all plugins...\n".colorize(:yellow)
89
+
90
+ # listing each plugin dir
91
+ @dir.each do |file|
92
+ # ignoring . and ..
93
+ unless ['.', ".."].include?(file) then
94
+ cur_dir = @dir.path + file
95
+ print "Updating: ".colorize(:light_blue) + "#{cur_dir}\n".colorize(:green)
96
+ system "git -C #{cur_dir} pull"
97
+ end
98
+ end
99
+ end
100
+
101
+ def install
102
+ print "Installing all plugins from bundle.list...\n".colorize(:yellow)
103
+
104
+ File.open @bundle_list do |file|
105
+ while link = file.gets
106
+ unless link.length <= 1 or link.strip.match(/^#.*/) then
107
+
108
+ # getting last part of URL -> dir name without .git suffix
109
+ last_part = URI(link).path.split('/').last.split('.')
110
+
111
+ #removing the .git part
112
+ last_part.pop
113
+
114
+ # joining together remaining pieces to get i.e. ctrlp.vim.git
115
+ cur_dir = @dir.path + last_part.join(".")
116
+
117
+ # only for plugins not yet installed
118
+ unless File.exist? cur_dir then
119
+ print "Getting: ".colorize(:light_blue) + "#{link.strip}".colorize(:green) + " into ".colorize(:light_blue) + cur_dir.colorize(:light_cyan) + "\n"
120
+ system("git clone #{link.strip} #{cur_dir}")
121
+ else
122
+ print "Plugin: ".colorize(:light_blue) + "#{link.strip}".colorize(:green) + " already installed.\n".colorize(:light_cyan)
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
128
+
129
+ def remove
130
+ print "Removing plugins not on the list...\n".colorize(:yellow)
131
+
132
+ plugins = [".", ".."]
133
+
134
+ # getting bundle.list
135
+ File.open @bundle_list do |file|
136
+ while link = file.gets
137
+ unless link.length <= 1 or link.strip.match(/^#.*/) then
138
+ # getting last part of URL -> dir name without .git suffix
139
+ last_part = URI(link).path.split('/').last.split('.')
140
+
141
+ #removing the .git part
142
+ last_part.pop
143
+
144
+ # joining together remaining pieces to get i.e. ctrlp.vim.git
145
+ plugins.push(last_part.join("."))
146
+ end
147
+ end
148
+ end
149
+
150
+ #listing each plugin dir
151
+ @dir.each do |file|
152
+ #ignoring all plugins on the list
153
+ unless plugins.include?(file) then
154
+ cur_dir = @dir.path + file
155
+ print "Removing: ".colorize(:light_red) + "#{cur_dir}\n".colorize(:green)
156
+ FileUtils.rm_rf cur_dir
157
+ end
158
+ end
159
+ end
160
+ end
161
+
162
+ def self.check_git_version
163
+ git_version = `git --version`
164
+ git_version = git_version.gsub(/git version /, '').split(".")
165
+ unless (git_version[0].to_i >= 1 and git_version[1].to_i >= 8 and git_version[2].to_i >= 5) then
166
+ puts "You need git version 1.8.5.x or greater.".colorize(:red)
167
+ end
168
+ end
169
+
170
+ end
@@ -0,0 +1,3 @@
1
+ module VimPathogenPluginManager
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vim_pathogen_plugin_manager/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vim_pathogen_plugin_manager"
8
+ spec.version = VimPathogenPluginManager::VERSION
9
+ spec.authors = ["Piotr Wasilewski"]
10
+ spec.email = ["piotr.m.wasilewski@gmail.com"]
11
+ spec.summary = %q{Vim plugin manager for Pathogen.}
12
+ spec.description = %q{Plugin manager for Pathogen. Vundle has one, now Pathogen does too.}
13
+ spec.homepage = "https://github.com/wasilak/vim_pathogen_plugin_manager"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ['vim_pathogen_plugin_manager']
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "colorize"
24
+ spec.add_dependency "fileutils"
25
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vim_pathogen_plugin_manager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Wasilewski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colorize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fileutils
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Plugin manager for Pathogen. Vundle has one, now Pathogen does too.
70
+ email:
71
+ - piotr.m.wasilewski@gmail.com
72
+ executables:
73
+ - vim_pathogen_plugin_manager
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/vim_pathogen_plugin_manager
83
+ - bundle.list
84
+ - lib/vim_pathogen_plugin_manager.rb
85
+ - lib/vim_pathogen_plugin_manager/version.rb
86
+ - vim_pathogen_plugin_manager.gemspec
87
+ homepage: https://github.com/wasilak/vim_pathogen_plugin_manager
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.2.1
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: Vim plugin manager for Pathogen.
111
+ test_files: []