infect 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.
- data/.gitignore +18 -0
- data/CONTRIBUTING.md +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/bin/infect +6 -0
- data/infect.gemspec +19 -0
- data/lib/infect-org.rb +47 -0
- data/lib/infect.rb +29 -0
- data/lib/infect/command.rb +44 -0
- data/lib/infect/command/bundle.rb +43 -0
- data/lib/infect/version.rb +3 -0
- metadata +60 -0
data/.gitignore
ADDED
data/CONTRIBUTING.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Christopher Sexton
|
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,32 @@
|
|
1
|
+
# Infect
|
2
|
+
|
3
|
+
Asset Pipeline for Vim and Pathogen
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install infect
|
8
|
+
|
9
|
+
## Objective
|
10
|
+
|
11
|
+
The point of Infect it to make it easy to manage your vim config. You should be able to check in yoru `.vimrc` into source control and use that one file to easily install any plugins you need.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Infect reads your `.vimrc` file and looks for magic comments. It uses those to install pathogen style vim bundles.
|
16
|
+
|
17
|
+
" Include bundle:
|
18
|
+
"=bundle tpope/vim-pathogen
|
19
|
+
"=bundle tpope/vim-sensible
|
20
|
+
"=bundle csexton/trailertrash.vim
|
21
|
+
|
22
|
+
A minimal vimrc to use with infect would look like this:
|
23
|
+
|
24
|
+
" vim bundles:
|
25
|
+
"=bundle tpope/vim-pathogen
|
26
|
+
"=bundle tpope/vim-sensible
|
27
|
+
source ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim
|
28
|
+
execute pathogen#infect()
|
29
|
+
syntax on
|
30
|
+
filetype plugin indent on
|
31
|
+
|
32
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/infect
ADDED
data/infect.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'infect/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "infect"
|
8
|
+
gem.version = Infect::VERSION
|
9
|
+
gem.authors = ["Christopher Sexton"]
|
10
|
+
gem.email = ["csexton@gmail.com"]
|
11
|
+
gem.description = %q{Bundle manager for pathogen.vim}
|
12
|
+
gem.summary = %q{Asset Pipeline for Pathogen, install vim bundles based on comments in your vimrc}
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
data/lib/infect-org.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Infect
|
4
|
+
#
|
5
|
+
# Asset Pipeline for Pathogen and Vim
|
6
|
+
#
|
7
|
+
require 'open-uri'
|
8
|
+
require 'fileutils'
|
9
|
+
|
10
|
+
class String
|
11
|
+
def colorize(code); "\e[#{code}m#{self}\e[0m"; end
|
12
|
+
def red; colorize(31); end
|
13
|
+
def green; colorize(32); end
|
14
|
+
def yellow; colorize(33); end
|
15
|
+
end
|
16
|
+
|
17
|
+
unless Dir.respond_to?(:home)
|
18
|
+
class Dir
|
19
|
+
class << self
|
20
|
+
define_method :home do
|
21
|
+
ENV['HOME']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
module Infect
|
29
|
+
def self.run
|
30
|
+
commands = []
|
31
|
+
|
32
|
+
File.open( "#{ENV['HOME']}/.vimrc" ).each do |line|
|
33
|
+
if line =~ /^"=/
|
34
|
+
command, *args = line.split
|
35
|
+
commands << Command.build(command.gsub('"=', ''), args)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
commands.compact.each do |command|
|
40
|
+
command.call
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
if __FILE__ == $0
|
46
|
+
Infect.run
|
47
|
+
end
|
data/lib/infect.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'fileutils'
|
3
|
+
lib = File.expand_path('..', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'infect/version'
|
6
|
+
require 'infect/command'
|
7
|
+
require 'infect/command/bundle'
|
8
|
+
|
9
|
+
module Infect
|
10
|
+
# Globals be global
|
11
|
+
VIMHOME = ENV['VIM'] || "#{ENV['HOME']}/.vim"
|
12
|
+
VIMRC = ENV['MYVIMRC'] || "#{ENV['HOME']}/.vimrc"
|
13
|
+
|
14
|
+
|
15
|
+
def self.run
|
16
|
+
commands = []
|
17
|
+
|
18
|
+
File.open( VIMRC ).each do |line|
|
19
|
+
if line =~ /^"=/
|
20
|
+
command, *args = line.split
|
21
|
+
commands << Command.build(command.gsub('"=', ''), args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
commands.compact.each do |command|
|
26
|
+
command.call
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Infect
|
2
|
+
class Command
|
3
|
+
def self.build(command, args)
|
4
|
+
case command.to_sym
|
5
|
+
when :bundle
|
6
|
+
Bundle.new(args)
|
7
|
+
else
|
8
|
+
puts "WARNING: #{command} is not a valid command, ignorning"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def mkdir(path)
|
15
|
+
FileUtils.mkdir_p(File.expand_path(path))
|
16
|
+
end
|
17
|
+
def chdir(path)
|
18
|
+
Dir.chdir(path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def download(url, path)
|
22
|
+
File.open(File.expand_path(path), "w") do |file|
|
23
|
+
open(url) do |read_file|
|
24
|
+
file.write(read_file.read)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def colorize(code, str)
|
30
|
+
"\e[#{code}m#{str}\e[0m"
|
31
|
+
end
|
32
|
+
#def red(str); colorize(31, str); end
|
33
|
+
#def green(str); colorize(32, str); end
|
34
|
+
#def yellow(str); colorize(33, str); end
|
35
|
+
|
36
|
+
def notice(str)
|
37
|
+
puts colorize(32, str)
|
38
|
+
end
|
39
|
+
def error(str)
|
40
|
+
puts colorize(31, str)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Infect
|
2
|
+
class Command
|
3
|
+
class Bundle < Command
|
4
|
+
attr_reader :bundle, :name, :location
|
5
|
+
def initialize(args)
|
6
|
+
@bundle = args[0]
|
7
|
+
@name = File.basename(bundle)
|
8
|
+
@location = File.expand_path("~/.vim/bundle/#{name}")
|
9
|
+
end
|
10
|
+
|
11
|
+
def url
|
12
|
+
"git@github.com:#{bundle}.git"
|
13
|
+
end
|
14
|
+
|
15
|
+
def install
|
16
|
+
notice "Installing #{name}... "
|
17
|
+
mkdir "~/.vim/bundle"
|
18
|
+
chdir "#{VIMHOME}/bundle"
|
19
|
+
git "clone '#{url}'"
|
20
|
+
end
|
21
|
+
|
22
|
+
def update
|
23
|
+
notice "Updating #{name}... "
|
24
|
+
chdir @location
|
25
|
+
git "pull"
|
26
|
+
end
|
27
|
+
|
28
|
+
def call
|
29
|
+
if File.exists? @location
|
30
|
+
update
|
31
|
+
else
|
32
|
+
install
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def git(args)
|
39
|
+
`git #{args}`
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: infect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Christopher Sexton
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-14 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Bundle manager for pathogen.vim
|
15
|
+
email:
|
16
|
+
- csexton@gmail.com
|
17
|
+
executables:
|
18
|
+
- infect
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- CONTRIBUTING.md
|
24
|
+
- Gemfile
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- bin/infect
|
29
|
+
- infect.gemspec
|
30
|
+
- lib/infect-org.rb
|
31
|
+
- lib/infect.rb
|
32
|
+
- lib/infect/command.rb
|
33
|
+
- lib/infect/command/bundle.rb
|
34
|
+
- lib/infect/version.rb
|
35
|
+
homepage: ''
|
36
|
+
licenses: []
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
none: false
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
none: false
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.8.24
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Asset Pipeline for Pathogen, install vim bundles based on comments in your
|
59
|
+
vimrc
|
60
|
+
test_files: []
|