vundle-cli 0.0.7.2 → 0.1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 01025e0b26d62bd9cbf7bab134cba6210a984277
4
- data.tar.gz: 79d2c429f903dc6892e7f81e2cca3d1b7da4ac17
3
+ metadata.gz: 26d9613a6391b8b630de1f146682772c0a9f457d
4
+ data.tar.gz: 8f6b3b9aa03b033fdfffe96a29b59d990d9011db
5
5
  SHA512:
6
- metadata.gz: d28cd35eb912a20ff7a7a02d7750ea63c06865960f68e6a086049cc2faf94d3f2ab2f8866a594520e874ba0101994f9863e86402574ae4da356f38065c885560
7
- data.tar.gz: 394dc475956981bb30c361b4a5cad9720863ec84293e943c91bad85d951c7e2fbd508ef253727f01fbd22364a2d6cbeebf09e50f5c8aa0f64c1d8e25730d755b
6
+ metadata.gz: 9633798b492736ab3c6ddfef17a611a33387f1435987d44ee577bf19165d42aefdfa2ed3b4bb561fa8c232dafd5baf5ef89ba2e739a4a7b23f623aeb27628231
7
+ data.tar.gz: ef6c634db95fbd8bc925a0c6d0103342bb6235306aabf111efa127ac92ee71ae169821bd4aa37c3094db4c2fec73da8673471b636647a9a7c3147833cf0ca085
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
- # Vundle CLI
1
+ # Vundle CLI [![Gem Version](https://badge.fury.io/rb/vundle-cli.svg)](http://badge.fury.io/rb/vundle-cli) [![GitHub version](https://badge.fury.io/gh/baopham%2Fvundle-cli.svg)](http://badge.fury.io/gh/baopham%2Fvundle-cli)
2
2
 
3
3
  A (tiny) CLI for Vim plugin manager [Vundle](https://github.com/gmarik/Vundle.vim)
4
4
 
5
5
  Available commands:
6
6
 
7
- * `rm` remove a plugin
8
- * `list` list all installed plugins
9
- * `find` find an installed plugin
10
- * `clean` clean up unused plugin related files
7
+ * `rm` remove a plugin
8
+ * `list` list all installed plugins
9
+ * `find` find an installed plugin
10
+ * `clean` clean up unused plugin related files
11
+ * `install` install a plugin
11
12
 
12
13
  `rm` will remove the line `Bundle plugin_name` or `Plugin plugin_name` in your `.vimrc`,
13
14
  delete the configuration file for this plugin in the specified settings directory,
@@ -17,6 +18,8 @@ for confirmation unless the `--force` switch is on.
17
18
  I built this so that it's quicker to uninstall a plugin with my particular
18
19
  [vim setup](https://github.com/baopham/vim)
19
20
 
21
+ ![gif](http://baopham.github.io/images/vundlecli.gif)
22
+
20
23
  ## Installation
21
24
 
22
25
  Add this line to your application's Gemfile:
@@ -43,11 +46,12 @@ Or install it yourself as:
43
46
 
44
47
  **COMMANDS**:
45
48
 
46
- clean Clean up unused plugin related files
47
- find Search for an installed plugin
48
- help Display global or [command] help documentation
49
- list List all installed plugins
50
- rm Remove a plugin
49
+ clean Clean up unused plugin related files
50
+ find Search for an installed plugin
51
+ help Display global or [command] help documentation
52
+ install Install a plugin and write to vimrc
53
+ list List all installed plugins
54
+ rm Remove a plugin
51
55
 
52
56
  **GLOBAL OPTIONS**:
53
57
 
@@ -201,6 +205,27 @@ Or install it yourself as:
201
205
  Force delete files without prompt. Disabled by default.
202
206
 
203
207
 
208
+ - - -
209
+ **NAME**:
210
+
211
+ install
212
+
213
+ **SYNOPSIS**:
214
+
215
+ vundle install <plugin> [options]
216
+
217
+ **DESCRIPTION**:
218
+
219
+ Do NOT add quote to plugin name
220
+
221
+ **OPTIONS**:
222
+
223
+ --vimdir vimdir
224
+ Vim directory. Default to ~/.vim.
225
+
226
+ --vimrc vimrc
227
+ .vimrc path. Default to ~/.vimrc.
228
+
204
229
  ## Contributing
205
230
 
206
231
  1. Fork it ( http://github.com/baopham/vundle-cli/fork )
data/bin/vundle CHANGED
@@ -60,7 +60,7 @@ command :find do |c|
60
60
  options.default \
61
61
  :vimrc => '~/.vimrc'
62
62
  finder = VundleCli::Finder.new(options, plugin)
63
- finder.find
63
+ finder.find?
64
64
  end
65
65
  end
66
66
 
@@ -96,3 +96,25 @@ and compare them with the plugins in your vimrc in order to determine which plug
96
96
  say_ok "Done!"
97
97
  end
98
98
  end
99
+
100
+
101
+ command :install do |c|
102
+ c.syntax = 'vundle install <plugin> [options]'
103
+ c.summary = 'Install a plugin and write to vimrc'
104
+ c.description = "Do NOT add quote to plugin name"
105
+ c.option '--vimdir vimdir', 'Vim directory. Default to ~/.vim.'
106
+ c.option '--vimrc vimrc', '.vimrc path. Default to ~/.vimrc.'
107
+ c.action do |args, options|
108
+ plugin = args.shift
109
+ abort('Plugin argument required.') if plugin.nil?
110
+ options.default \
111
+ :vimdir => '~/.vim',
112
+ :vimrc => '~/.vimrc'
113
+ finder = VundleCli::Finder.new(options, plugin)
114
+ unless finder.find?
115
+ installer = VundleCli::Installer.new(options, plugin)
116
+ installer.install
117
+ end
118
+ say_ok "Done!"
119
+ end
120
+ end
@@ -1,4 +1,5 @@
1
1
  require "vundle_cli/version"
2
+ require "vundle_cli/installer"
2
3
  require "vundle_cli/uninstaller"
3
4
  require "vundle_cli/finder"
4
5
  require "vundle_cli/cleaner"
@@ -11,7 +11,7 @@ module VundleCli
11
11
 
12
12
  def get_list
13
13
  plugins = Array.new
14
- open(@vimrc, 'r').each { |l|
14
+ open(@vimrc, 'r').each { |l|
15
15
  matches = l.chomp.match(/^(Bundle|Plugin) (\S*)/)
16
16
  if matches
17
17
  plugins << matches[2].gsub(/[',]/, '')
@@ -25,18 +25,21 @@ module VundleCli
25
25
  say get_list.join("\n")
26
26
  end
27
27
 
28
- def find
28
+ def find?
29
29
  say "Searching..."
30
- open(@vimrc, 'r').each { |l|
30
+ found = false
31
+ open(@vimrc, 'r').each { |l|
31
32
  matches = l.chomp.match(/^(Bundle|Plugin) (\S*)/)
32
33
  if matches
33
34
  plugin = matches[2].gsub(/[',]/, '')
34
35
  if plugin.downcase.include?(@plugin.downcase)
35
36
  say_ok "Found "
36
37
  say plugin
38
+ found = true
37
39
  end
38
40
  end
39
41
  }
42
+ found
40
43
  end
41
44
 
42
45
  end
@@ -0,0 +1,36 @@
1
+ require 'tempfile'
2
+ require 'fileutils'
3
+
4
+ module VundleCli
5
+
6
+ class Installer
7
+
8
+ attr_reader :options, :vimdir, :settings_dir, :vimrc, :force, :plugin
9
+
10
+ def initialize(options, plugin = nil)
11
+ @options = options
12
+ @vimdir = file_validate(options.vimdir, true)
13
+ @vimrc = file_validate(options.vimrc)
14
+ unless plugin.nil?
15
+ @plugin = plugin
16
+ end
17
+ end
18
+
19
+
20
+ def install
21
+
22
+ say "Writing plugin in #{@vimrc}..."
23
+ tmp = Tempfile.new("vimrc_tmp")
24
+ open(@vimrc, 'r').each { |l|
25
+ if l.chomp =~ /vundle#begin/
26
+ l << "\nPlugin '#{@plugin}'"
27
+ end
28
+ tmp << l
29
+ }
30
+ tmp.close
31
+ FileUtils.mv(tmp.path, @vimrc)
32
+ say "Waiting for plugin installing complete..."
33
+ system "vim +PluginInstall +qall"
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module VundleCli
2
- VERSION = "0.0.7.2"
2
+ VERSION = "0.1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vundle-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.2
4
+ version: 0.1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bao Pham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-01 00:00:00.000000000 Z
11
+ date: 2015-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,6 +72,7 @@ files:
72
72
  - lib/vundle_cli/finder.rb
73
73
  - lib/vundle_cli/helper.rb
74
74
  - lib/vundle_cli/import.rb
75
+ - lib/vundle_cli/installer.rb
75
76
  - lib/vundle_cli/uninstaller.rb
76
77
  - lib/vundle_cli/version.rb
77
78
  - test/TODO
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
97
  version: '0'
97
98
  requirements: []
98
99
  rubyforge_project:
99
- rubygems_version: 2.2.2
100
+ rubygems_version: 2.4.7
100
101
  signing_key:
101
102
  specification_version: 4
102
103
  summary: A tiny CLI for Vim plugin manager Vundle