vundle-cli 0.0.2

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: c0c255b21dd2c8b70a5c77a0a129376d6d06be8d
4
+ data.tar.gz: 34c4e71f516bb23d9fa95cacfbfd32749c2b03e7
5
+ SHA512:
6
+ metadata.gz: e8bbefd140c69b766b55e75a320031f36163e2c23a0756dda1cd1ec2809161d35370e30a2c8191701c9178fd85f7f4d5c5b359233a40613bad3cb77d1841264c
7
+ data.tar.gz: dfe561aaef0c7456aaf06e1e961ece322ecc4d35dabaca1a54efa7b83a7a1e0dce56f624248c306fbdc56bb46545f1a4d7a27e75dd56c39728cf9e573cd4e4e7
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 vundle.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Bao Pham
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,67 @@
1
+ # Vundle CLI
2
+
3
+ A (tiny) CLI for Vim plugin manager [Vundle](https://github.com/gmarik/Vundle.vim)
4
+
5
+ Available commands:
6
+
7
+ * `rm` remove a bundle
8
+ * `list` list all installed bundles
9
+ * `find` find an installed bundle
10
+
11
+ `rm` will remove the line `Bundle bundle_name` in your `.vimrc` and look
12
+ for a configuration file for this bundle in the specified settings directory,
13
+ then it will ask if you want to remove the file or not.
14
+
15
+ I built this so that it's quicker to uninstall a bundle with my particular
16
+ [vim setup](https://github.com/baopham/vim)
17
+
18
+ ## Installation
19
+
20
+ Add this line to your application's Gemfile:
21
+
22
+ gem 'vundle-cli'
23
+
24
+ And then execute:
25
+
26
+ $ bundle
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install vundle-cli
31
+
32
+ ## Usage
33
+
34
+ **NAME**:
35
+
36
+ vundle
37
+
38
+ **DESCRIPTION**:
39
+
40
+ A (tiny) CLI for Vim plugin manager Vundle
41
+
42
+ **COMMANDS**:
43
+
44
+ find Search for an installed bundle
45
+ help Display global or [command] help documentation
46
+ list List all installed bundles
47
+ rm Remove a bundle
48
+
49
+ **GLOBAL OPTIONS**:
50
+
51
+ -h, --help
52
+ Display help documentation
53
+
54
+ -v, --version
55
+ Display version information
56
+
57
+ -t, --trace
58
+ Display backtrace when an error occurs
59
+
60
+
61
+ ## Contributing
62
+
63
+ 1. Fork it ( http://github.com/baopham/vundle-cli/fork )
64
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
65
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
66
+ 4. Push to the branch (`git push origin my-new-feature`)
67
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/vundle ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'commander/import'
5
+ $:.unshift(File.expand_path('../../lib', __FILE__))
6
+ require 'vundle_cli'
7
+
8
+ program :version, VundleCli::VERSION
9
+ program :description, 'A (tiny) CLI for Vim plugin manager Vundle'
10
+
11
+ command :rm do |c|
12
+ c.syntax = 'vundle rm <bundle> [options]'
13
+ c.summary = 'Remove a bundle'
14
+ c.description = 'Uninstall a bundle.
15
+ This will remove the line `Bundle <bundle>` in your .vimrc
16
+ and will prompt you for confirmation before deleting the bundle\'s config file if found.'
17
+ c.example 'Remove bundle kien/ctrlp.vim', 'vundle rm kien/ctrlp.vim'
18
+ c.option '--vimdir vimdir', 'Vim directory. Default to ~/.vim'
19
+ c.option '--settings settings_dir',
20
+ 'Vim settings directory (where you configure your bundles). Default to ~/.vim/settings'
21
+ c.option '--vimrc vimrc', '.vimrc path. Default to ~/.vimrc'
22
+ c.action do |args, options|
23
+ bundle = args.shift || abort('Bundle argument required.')
24
+ options.default \
25
+ :vimdir => '~/.vim',
26
+ :settings => '~/.vim/settings',
27
+ :vimrc => '~/.vimrc'
28
+ runner = VundleCli::Uninstaller.new(options, bundle)
29
+ runner.rm
30
+ end
31
+ end
32
+
33
+ command :list do |c|
34
+ c.syntax = 'vundle list [options]'
35
+ c.summary = 'List all installed bundles'
36
+ c.description = 'List all installed bundles'
37
+ c.example '', 'vundle list --vimrc ~/.vimrc'
38
+ c.option '--vimrc vimrc', '.vimrc path. Default to ~/.vimrc'
39
+ c.action do |args, options|
40
+ options.default \
41
+ :vimrc => '~/.vimrc'
42
+ finder = VundleCli::Finder.new(options)
43
+ finder.list
44
+ end
45
+ end
46
+
47
+ command :find do |c|
48
+ c.syntax = 'vundle find bundle [options]'
49
+ c.summary = 'Search for an installed bundle'
50
+ c.description = 'Search for an installed bundle'
51
+ c.example 'Find a bundle that has substring `gist`', 'vundle find gist'
52
+ c.option '--vimrc vimrc', '.vimrc path. Default to ~/.vimrc'
53
+ c.action do |args, options|
54
+ bundle = args.shift || abort('Bundle argument required.')
55
+ options.default \
56
+ :vimrc => '~/.vimrc'
57
+ finder = VundleCli::Finder.new(options, bundle)
58
+ finder.find
59
+ end
60
+ end
data/lib/vundle_cli.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "vundle_cli/version"
2
+ require "vundle_cli/uninstaller"
3
+ require "vundle_cli/finder"
4
+ require "vundle_cli/helpers"
@@ -0,0 +1,37 @@
1
+ module VundleCli
2
+ class Finder
3
+
4
+ attr_reader :options
5
+
6
+ attr_reader :vimrc
7
+
8
+ attr_reader :bundle
9
+
10
+ def initialize(options, bundle='')
11
+ @options = options
12
+ @vimrc = Helpers.file_validate(options.vimrc)
13
+ @bundle = bundle
14
+ end
15
+
16
+ def list
17
+ open(@vimrc, 'r').each { |l|
18
+ matches = l.chomp.match(/^Bundle (\S*)/)
19
+ if matches
20
+ puts matches[1].gsub("'", '')
21
+ end
22
+ }
23
+ end
24
+
25
+ def find
26
+ puts "Searching..."
27
+ open(@vimrc, 'r').each { |l|
28
+ matches = l.chomp.match(/^Bundle (\S*)/)
29
+ if matches
30
+ bundle = matches[1].gsub("'", '')
31
+ puts "Found #{bundle}" if bundle.include?(@bundle)
32
+ end
33
+ }
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,62 @@
1
+ require 'tempfile'
2
+
3
+ module VundleCli
4
+
5
+ class Uninstaller
6
+
7
+ attr_reader :options
8
+
9
+ attr_reader :vimdir
10
+
11
+ attr_reader :settings_dir
12
+
13
+ attr_reader :vimrc
14
+
15
+ attr_reader :bundle
16
+
17
+ def initialize(options, bundle)
18
+ @options = options
19
+ @vimdir = Helpers.file_validate(options.vimdir, true)
20
+ @settings_dir = Helpers.file_validate(options.settings, true)
21
+ @vimrc = Helpers.file_validate(options.vimrc)
22
+ @bundle = bundle
23
+ end
24
+
25
+ # 1) Remove the line `Bundle bundle` from .vimrc.
26
+ # 2) Look for a file in the settings directory (provided by option --settings)
27
+ # with name that includes the bundle name. Then ask if the user wants to remove it.
28
+ def rm
29
+ tmp = Tempfile.new("vimrc_tmp")
30
+ open(@vimrc, 'r').each { |l|
31
+ if l.chomp =~ /Bundle .*#{Regexp.quote(@bundle)}.*/
32
+ puts "Found bundle #{@bundle}, removing it from #{@vimrc}..."
33
+ else
34
+ tmp << l
35
+ end
36
+ }
37
+ tmp.close
38
+ FileUtils.mv(tmp.path, @vimrc)
39
+
40
+ puts "Searching for setting file..."
41
+
42
+ # Get the bundle's main name.
43
+ # (the provided @bundle usually looks like baopham/trailertrash.vim,
44
+ # so we trim it down to get "trailertrash" only).
45
+ bundle_name = @bundle
46
+ if @bundle.include?("/")
47
+ bundle_name = @bundle.split("/")[1].sub(/\.vim/, '')
48
+ end
49
+
50
+ Dir.foreach(@settings_dir) do |fname|
51
+ next unless fname.include? bundle_name
52
+ puts "Found #{@settings_dir}/#{fname} setting file. Remove it? (yes/no) "
53
+ input = STDIN.gets.chomp
54
+ if input == 'yes'
55
+ File.delete("#{@settings_dir}/#{fname}")
56
+ puts "File deleted."
57
+ end
58
+ end
59
+ end
60
+
61
+ end
62
+ end
@@ -0,0 +1,3 @@
1
+ module VundleCli
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vundle_cli/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vundle-cli"
8
+ spec.version = VundleCli::VERSION
9
+ spec.authors = ["Bao Pham"]
10
+ spec.email = ["gbaopham@gmail.com"]
11
+ spec.summary = %q{A tiny CLI for Vim plugin manager Vundle}
12
+ spec.description = %q{Available commands: rm, list, find to remove, list and find installed bundles}
13
+ spec.homepage = "https://github.com/baopham/vundle-cli"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
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", "~> 0.8"
23
+ spec.add_development_dependency "commander", "~> 4.2"
24
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vundle-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Bao Pham
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-12 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.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: commander
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.2'
55
+ description: 'Available commands: rm, list, find to remove, list and find installed
56
+ bundles'
57
+ email:
58
+ - gbaopham@gmail.com
59
+ executables:
60
+ - vundle
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/vundle
70
+ - lib/vundle_cli.rb
71
+ - lib/vundle_cli/finder.rb
72
+ - lib/vundle_cli/uninstaller.rb
73
+ - lib/vundle_cli/version.rb
74
+ - vundle-cli.gemspec
75
+ homepage: https://github.com/baopham/vundle-cli
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.2.2
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: A tiny CLI for Vim plugin manager Vundle
99
+ test_files: []