vundle_migrator 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +36 -0
- data/Rakefile +11 -0
- data/bin/vundle_migrator +35 -0
- data/lib/vundle_migrator.rb +88 -0
- data/lib/vundle_migrator/version.rb +3 -0
- data/vundle_migrator.gemspec +25 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a1bf5f73fb83673db5941c4af32aa489771f5ddc
|
4
|
+
data.tar.gz: ee00a9f5b48382aaf365e484796792aa74a909f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4211c09595dbff9a83d3a1befae2e85ca3e951f5479e2239ea377c8b9d14378d0e9c336eee0b5d4c39aad5a1f130a08ff3d383f4fe19c780aef450b7d4a5de54
|
7
|
+
data.tar.gz: 1dc232eaa2f0d5b333d01253565a1bc64f2fb930bd5d9303ed36f6aa9e8b42a23a94046d5474bbfc4340042a7338fbf3b482f88ddbe67ecfba07c885bde7452a
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Travis Yoder
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Vundle Migrator
|
2
|
+
|
3
|
+
Vundle Migrator is a tool that will migrate your current vim setup to use Vundle. It works by creating a `plugins.vim` that contains a list of your existing plugins from your bundle folder. The list will already be formatted in the vundle format: `Plugin "username/repo"`.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
`$ gem install vundle_migrator`
|
8
|
+
|
9
|
+
**Note:** When you have finished using Vundle Migrator, it can be uninstalled with `$ gem uninstall vundle_migrator`
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
`$ ./vundle_migrate vimrc-location [OPTIONS]`
|
14
|
+
|
15
|
+
|Options|Requirement|Default Value|Description|
|
16
|
+
|---|---|---|---|
|
17
|
+
|-l, --vimrc-location|*Required*|None|Used to add a line to your vimrc that sources the final plugins.vim
|
18
|
+
|-b, --bundle-location|*Optional*|`~/.vim/bundle`|Used to build the list of plugins
|
19
|
+
|-d, --destination|*Required*|`~/.vim/vundle/plugins.vim`|Used as the destination of the plugins file.
|
20
|
+
|
21
|
+
#### Other Options
|
22
|
+
|
23
|
+
|Options|Description|
|
24
|
+
|---|---|
|
25
|
+
|-r, --dry-run|Displays the final result of the `plugins.vim` without modifying files.
|
26
|
+
|-h, --help|displays the help page
|
27
|
+
|-v, --version|displays the version
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
Issues and pull requests are welcome! Please try and submit them with a test demonstrating the issue.
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
36
|
+
|
data/Rakefile
ADDED
data/bin/vundle_migrator
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
4
|
+
require "slop"
|
5
|
+
require 'vundle_migrator'
|
6
|
+
require 'vundle_migrator/version'
|
7
|
+
|
8
|
+
opts = Slop.parse do |o|
|
9
|
+
o.banner = "usage: vundle_migrate vimrc-location [OPTIONS]"
|
10
|
+
o.string '-l', '--vimrc-location', 'Required - Used to add a line to your vimrc that sources the final plugins.vim'
|
11
|
+
o.string '-b', '--bundle-location', 'Optional - Used to build the list of plugins. Default: ~/.vim/bundle'
|
12
|
+
o.string '-d', '--destination', 'Optional - Used as the destination of the plugins file. Default: ~/.vim/vundle/plugins.vim'
|
13
|
+
o.bool '-r', '--dry-run', 'displays the results of creating the plugins.vim without modifying files'
|
14
|
+
o.bool '-h', '--help', 'displays this page'
|
15
|
+
o.on '-v', '--version', 'displays the version' do
|
16
|
+
puts VundleMigrator::VERSION
|
17
|
+
exit
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if ARGV.count.zero? || opts.help?
|
22
|
+
puts opts
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
if opts[:vimrc_location].nil?
|
27
|
+
puts "Please provide a vimrc location with the -l flag"
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
|
31
|
+
if opts.dry_run?
|
32
|
+
VundleMigrator.dry_run(opts)
|
33
|
+
else
|
34
|
+
VundleMigrator.migrate(opts)
|
35
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module VundleMigrator
|
2
|
+
def self.migrate(opts)
|
3
|
+
Migrator.new(opts[:vimrc_location], opts[:bundle_location], opts[:vundle_destination]).run
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.dry_run(opts)
|
7
|
+
Migrator.new(opts[:vimrc_location], opts[:bundle_location], opts[:vundle_destination]).dry_run
|
8
|
+
end
|
9
|
+
|
10
|
+
class Migrator
|
11
|
+
attr_reader :plugins
|
12
|
+
|
13
|
+
VIMRC_SOURCE = "\" load vundle plugins\n" \
|
14
|
+
"source ~/.vim/vundle/plugins.vim\n\n"
|
15
|
+
|
16
|
+
PLUGINS_START = "set nocompatible\n" \
|
17
|
+
"filetype off\n" \
|
18
|
+
"set rtp+=~/.vim/bundle/Vundle.vim\n\n" \
|
19
|
+
"call vundle#begin()\n\n"
|
20
|
+
|
21
|
+
PLUGINS_END = "\n\ncall vundle#end()\n\n" \
|
22
|
+
"filetype plugin indent on"
|
23
|
+
|
24
|
+
def initialize(vimrc, source, destination)
|
25
|
+
@vimrc = vimrc
|
26
|
+
@source = source || "#{Dir.home}/.vim/bundle"
|
27
|
+
@destination = destination || "#{Dir.home}/.vim/vundle/plugins.vim"
|
28
|
+
@entries = Dir.entries(@source) - %w(. ..)
|
29
|
+
@plugins = []
|
30
|
+
end
|
31
|
+
|
32
|
+
def run
|
33
|
+
create_plugins_list
|
34
|
+
create_vundle_folder
|
35
|
+
create_plugins_file
|
36
|
+
prepend_vimrc
|
37
|
+
end
|
38
|
+
|
39
|
+
def dry_run
|
40
|
+
create_plugins_list
|
41
|
+
print_file_contents
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_plugins_list
|
45
|
+
@plugins = @entries.map do |plugin_directory|
|
46
|
+
Dir.chdir("#{@source}/#{plugin_directory}") do
|
47
|
+
package = `git remote -v`.match(/com[\/|:](.+)\.git/)[1]
|
48
|
+
"Plugin '#{package}'"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_vundle_folder
|
54
|
+
FileUtils.mkdir_p(File.dirname(@destination))
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_plugins_file
|
58
|
+
File.open(@destination, "w") do |f|
|
59
|
+
f.write(PLUGINS_START)
|
60
|
+
|
61
|
+
@plugins.each do |plugin|
|
62
|
+
f.write(plugin)
|
63
|
+
end
|
64
|
+
|
65
|
+
f.write(PLUGINS_END)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def prepend_vimrc
|
70
|
+
File.rename("#{@vimrc}", "#{@vimrc}.old")
|
71
|
+
|
72
|
+
File.open("#{@vimrc}", 'w') do |f|
|
73
|
+
f.puts VIMRC_SOURCE
|
74
|
+
File.foreach("#{@vimrc}.old") do |l|
|
75
|
+
f.puts l
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
FileUtils.remove("#{@vimrc}.old")
|
80
|
+
end
|
81
|
+
|
82
|
+
def print_file_contents
|
83
|
+
puts PLUGINS_START
|
84
|
+
puts @plugins
|
85
|
+
puts PLUGINS_END
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'vundle_migrator/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "vundle_migrator"
|
7
|
+
spec.version = VundleMigrator::VERSION
|
8
|
+
spec.authors = ["Travis Yoder"]
|
9
|
+
spec.email = ["trayoda@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Vundle Migrator will automatically create a list of plugins from your bundle folder."
|
12
|
+
spec.homepage = "https://github.com/trayo/vundle_migrator"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "bin"
|
17
|
+
spec.executables = ["vundle_migrator"]
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
21
|
+
spec.add_development_dependency "fakefs", "~> 0.8.1"
|
22
|
+
spec.add_development_dependency "minitest", "~> 5.8"
|
23
|
+
spec.add_development_dependency "rake", "~> 11.1"
|
24
|
+
spec.add_development_dependency "slop", "~> 4.3"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vundle_migrator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Travis Yoder
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-26 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.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fakefs
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.1
|
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.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.8'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '11.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '11.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: slop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.3'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- trayoda@gmail.com
|
86
|
+
executables:
|
87
|
+
- vundle_migrator
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/vundle_migrator
|
98
|
+
- lib/vundle_migrator.rb
|
99
|
+
- lib/vundle_migrator/version.rb
|
100
|
+
- vundle_migrator.gemspec
|
101
|
+
homepage: https://github.com/trayo/vundle_migrator
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.5.1
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Vundle Migrator will automatically create a list of plugins from your bundle
|
125
|
+
folder.
|
126
|
+
test_files: []
|