vim-bundler 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +14 -4
- data/Gemfile.lock +56 -8
- data/GuardFile +16 -0
- data/VERSION +1 -1
- data/bin/vbundle +0 -0
- data/lib/vim-bundler.rb +3 -0
- data/lib/vim-bundler/actions.rb +8 -10
- data/lib/vim-bundler/cli.rb +5 -1
- data/lib/vim-bundler/dsl.rb +4 -0
- data/lib/vim-bundler/git.rb +23 -36
- data/lib/vim-bundler/installer.rb +41 -20
- data/lib/vim-bundler/local.rb +7 -31
- data/lib/vim-bundler/lock.rb +71 -0
- data/lib/vim-bundler/vim_org.rb +11 -17
- data/spec/lib/vim-bundler/git_spec.rb +91 -0
- data/spec/lib/vim-bundler/local_spec.rb +40 -0
- data/spec/lib/vim-bundler/vim_org_spec.rb +58 -0
- data/spec/spec_helper.rb +63 -0
- data/vim-bundler.gemspec +17 -13
- metadata +27 -23
- data/test/helper.rb +0 -18
- data/test/test_vim-bundler.rb +0 -7
data/Gemfile
CHANGED
@@ -3,12 +3,22 @@ source "http://rubygems.org"
|
|
3
3
|
# Example:
|
4
4
|
gem "activesupport", ">= 3.1.0.beta1"
|
5
5
|
gem "thor", ">= 0.14.6"
|
6
|
+
gem 'awesome_print'
|
6
7
|
|
7
8
|
# Add dependencies to develop your gem here.
|
8
9
|
# Include everything needed to run rake, tests, features, etc.
|
9
10
|
group :development do
|
10
|
-
gem "
|
11
|
-
gem "
|
12
|
-
gem "
|
13
|
-
|
11
|
+
gem "bundler"
|
12
|
+
gem "jeweler"
|
13
|
+
gem "rcov"
|
14
|
+
end
|
15
|
+
group :rspec, :cucumber do
|
16
|
+
gem 'rspec'
|
17
|
+
gem 'cucumber'
|
18
|
+
gem 'spork'
|
19
|
+
gem 'guard-spork'
|
20
|
+
gem 'guard-rspec'
|
21
|
+
gem 'guard-cucumber'
|
22
|
+
gem 'rr'
|
23
|
+
gem 'rb-readline'
|
14
24
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,57 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (3.
|
4
|
+
activesupport (3.2.3)
|
5
|
+
i18n (~> 0.6)
|
5
6
|
multi_json (~> 1.0)
|
7
|
+
awesome_print (1.0.2)
|
8
|
+
builder (3.0.0)
|
9
|
+
cucumber (1.1.9)
|
10
|
+
builder (>= 2.1.2)
|
11
|
+
diff-lcs (>= 1.1.2)
|
12
|
+
gherkin (~> 2.9.0)
|
13
|
+
json (>= 1.4.6)
|
14
|
+
term-ansicolor (>= 1.0.6)
|
15
|
+
diff-lcs (1.1.3)
|
16
|
+
ffi (1.0.11)
|
17
|
+
gherkin (2.9.3)
|
18
|
+
json (>= 1.4.6)
|
6
19
|
git (1.2.5)
|
7
|
-
|
20
|
+
guard (1.0.1)
|
21
|
+
ffi (>= 0.5.0)
|
22
|
+
thor (~> 0.14.6)
|
23
|
+
guard-cucumber (0.7.5)
|
24
|
+
cucumber (>= 0.10)
|
25
|
+
guard (>= 0.8.3)
|
26
|
+
guard-rspec (0.7.0)
|
27
|
+
guard (>= 0.10.0)
|
28
|
+
guard-spork (0.7.0)
|
29
|
+
guard (>= 0.10.0)
|
30
|
+
spork (>= 0.8.4)
|
31
|
+
i18n (0.6.0)
|
32
|
+
jeweler (1.8.3)
|
8
33
|
bundler (~> 1.0)
|
9
34
|
git (>= 1.2.5)
|
10
35
|
rake
|
11
|
-
|
12
|
-
|
36
|
+
rdoc
|
37
|
+
json (1.6.6)
|
38
|
+
multi_json (1.3.2)
|
39
|
+
rake (0.9.2.2)
|
40
|
+
rb-readline (0.4.2)
|
13
41
|
rcov (0.9.9)
|
14
|
-
|
42
|
+
rdoc (3.12)
|
43
|
+
json (~> 1.4)
|
44
|
+
rr (1.0.4)
|
45
|
+
rspec (2.9.0)
|
46
|
+
rspec-core (~> 2.9.0)
|
47
|
+
rspec-expectations (~> 2.9.0)
|
48
|
+
rspec-mocks (~> 2.9.0)
|
49
|
+
rspec-core (2.9.0)
|
50
|
+
rspec-expectations (2.9.1)
|
51
|
+
diff-lcs (~> 1.1.3)
|
52
|
+
rspec-mocks (2.9.0)
|
53
|
+
spork (0.9.0)
|
54
|
+
term-ansicolor (1.0.7)
|
15
55
|
thor (0.14.6)
|
16
56
|
|
17
57
|
PLATFORMS
|
@@ -19,8 +59,16 @@ PLATFORMS
|
|
19
59
|
|
20
60
|
DEPENDENCIES
|
21
61
|
activesupport (>= 3.1.0.beta1)
|
22
|
-
|
23
|
-
|
62
|
+
awesome_print
|
63
|
+
bundler
|
64
|
+
cucumber
|
65
|
+
guard-cucumber
|
66
|
+
guard-rspec
|
67
|
+
guard-spork
|
68
|
+
jeweler
|
69
|
+
rb-readline
|
24
70
|
rcov
|
25
|
-
|
71
|
+
rr
|
72
|
+
rspec
|
73
|
+
spork
|
26
74
|
thor (>= 0.14.6)
|
data/GuardFile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'spork', :cucumber_env => { 'RACK_ENV' => 'cucumber' }, :rspec_env => { 'RACK_ENV' => 'rspec' } do
|
5
|
+
watch('config/boot.rb')
|
6
|
+
watch('config/config.rb')
|
7
|
+
watch('spec/spec_helper.rb')
|
8
|
+
watch('Gemfile')
|
9
|
+
watch('Gemfile.lock')
|
10
|
+
watch('features/support/env.rb')
|
11
|
+
end
|
12
|
+
guard 'rspec' do
|
13
|
+
watch('spec/spec_helper.rb') { "spec" }
|
14
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
15
|
+
watch(%r{^spec/(.+)_spec\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
16
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/vbundle
CHANGED
File without changes
|
data/lib/vim-bundler.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
module VimBundler
|
2
|
+
autoload :CLI, 'vim-bundler/cli'
|
2
3
|
autoload :DSL, 'vim-bundler/dsl'
|
3
4
|
autoload :Installer, 'vim-bundler/installer'
|
4
5
|
autoload :Git, 'vim-bundler/git'
|
@@ -6,6 +7,7 @@ module VimBundler
|
|
6
7
|
autoload :Local, 'vim-bundler/local'
|
7
8
|
autoload :UI, 'vim-bundler/ui'
|
8
9
|
autoload :Actions, 'vim-bundler/actions'
|
10
|
+
autoload :Lock, 'vim-bundler/lock'
|
9
11
|
|
10
12
|
class << self
|
11
13
|
attr_accessor :ui
|
@@ -16,4 +18,5 @@ module VimBundler
|
|
16
18
|
include Git
|
17
19
|
include VimOrg
|
18
20
|
include Local
|
21
|
+
include Lock
|
19
22
|
end
|
data/lib/vim-bundler/actions.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
module VimBundler
|
2
2
|
module Actions
|
3
|
-
def clean
|
4
|
-
|
5
|
-
|
6
|
-
FileUtils.rm_rf(dir)
|
7
|
-
VimBundler.ui.info "#{bundle.name} removed"
|
3
|
+
def clean
|
4
|
+
if Dir.exists?(@dir)
|
5
|
+
FileUtils.rm_rf(@dir)
|
8
6
|
else
|
9
|
-
|
7
|
+
raise "not found"
|
10
8
|
end
|
11
9
|
end
|
12
|
-
def post_action
|
13
|
-
return true if bundle.block.nil?
|
10
|
+
def post_action
|
11
|
+
return true if @bundle.block.nil?
|
14
12
|
cur_dir = FileUtils.pwd
|
15
|
-
FileUtils.cd(dir)
|
13
|
+
FileUtils.cd(@dir)
|
16
14
|
begin
|
17
|
-
bundle.block.call
|
15
|
+
@bundle.block.call
|
18
16
|
rescue
|
19
17
|
FileUtils.cd(cur_dir)
|
20
18
|
return false
|
data/lib/vim-bundler/cli.rb
CHANGED
@@ -44,9 +44,13 @@ module VimBundler
|
|
44
44
|
end
|
45
45
|
desc 'list', 'List all installed bundles'
|
46
46
|
def list
|
47
|
-
definition[:bundles].
|
47
|
+
definition[:bundles].each_value { |bundle| VimBundler.ui.info prepare_name(bundle) }
|
48
48
|
end
|
49
|
+
default_task :install
|
49
50
|
private
|
51
|
+
def prepare_name(bundle)
|
52
|
+
bundle.name
|
53
|
+
end
|
50
54
|
def definition
|
51
55
|
file = File.join(FileUtils.pwd, VimBundler.default_bundles_file)
|
52
56
|
unless File.exists? file
|
data/lib/vim-bundler/dsl.rb
CHANGED
data/lib/vim-bundler/git.rb
CHANGED
@@ -5,54 +5,41 @@ module VimBundler
|
|
5
5
|
module Installer
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
include VimBundler::Actions
|
8
|
-
def git_install
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
return
|
13
|
-
end
|
14
|
-
if @opts[:use_git_submodules]
|
15
|
-
`#{@opts[:git_bin]} submodule add #{bundle.git} #{dir} 2>&1`
|
16
|
-
else
|
17
|
-
`#{@opts[:git_bin]} clone #{bundle.git} #{dir} 2>&1`
|
18
|
-
end
|
19
|
-
if $?.to_i == 0 && post_action(dir, bundle)
|
20
|
-
VimBundler.ui.info "#{bundle.name} installed"
|
8
|
+
def git_install
|
9
|
+
if @bundle.opts[:use_git_submodules]
|
10
|
+
`#{@opts[:git_bin]} submodule add #{@bundle.git} #{@dir} 2>&1`
|
11
|
+
raise "unable to add submodule" unless $?.to_i == 0
|
21
12
|
else
|
22
|
-
|
13
|
+
`#{@bundle.opts[:git_bin]} clone #{@bundle.git} #{@dir} 2>&1`
|
14
|
+
raise "unable to clone" unless $?.to_i == 0
|
23
15
|
end
|
24
16
|
end
|
25
|
-
def git_update
|
26
|
-
dir
|
27
|
-
unless
|
28
|
-
VimBundler.ui.warn "#{bundle.name} not found"
|
29
|
-
return
|
30
|
-
end
|
31
|
-
`cd #{dir} && #{@opts[:git_bin]} pull #{bundle.git} 2>&1 && cd - `
|
32
|
-
if $?.to_i == 0 && post_action(dir, bundle)
|
33
|
-
VimBundler.ui.info "#{bundle.name} updated"
|
34
|
-
else
|
35
|
-
VimBundler.ui.warn "#{bundle.name} not updated"
|
36
|
-
end
|
17
|
+
def git_update
|
18
|
+
`cd #{@dir} && #{@bundle.opts[:git_bin]} pull #{@bundle.git} 2>&1 && cd - `
|
19
|
+
raise "unable to pull" unless $?.to_i == 0
|
37
20
|
end
|
38
|
-
def git_clean
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
21
|
+
def git_clean
|
22
|
+
begin
|
23
|
+
clean
|
24
|
+
rescue StandardError => e
|
25
|
+
raise e
|
26
|
+
ensure
|
27
|
+
if @bundle.opts[:git_bin]
|
28
|
+
clean_config_file('.gitmodules')
|
29
|
+
clean_config_file('.git/config')
|
30
|
+
lines = File.readlines('.gitmodules')
|
31
|
+
`#{@bundle.opts[:git_bin]} rm --cached #{@dir}`
|
32
|
+
end
|
46
33
|
end
|
47
34
|
end
|
48
35
|
private
|
49
|
-
def clean_config_file(path
|
36
|
+
def clean_config_file(path)
|
50
37
|
temp = []
|
51
38
|
delete = false
|
52
39
|
file = File.open(path, 'r') do |f|
|
53
40
|
while (line = f.gets)
|
54
41
|
delete = false if line.include?('[submodule')
|
55
|
-
delete = true if line.include?(bundle.name) && line.include?('[submodule')
|
42
|
+
delete = true if line.include?(@bundle.name) && line.include?('[submodule')
|
56
43
|
temp << line unless delete
|
57
44
|
end
|
58
45
|
end
|
@@ -12,31 +12,52 @@ module VimBundler
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
define_actions :install, :update, :clean
|
15
|
-
def initialize(opts)
|
16
|
-
@opts
|
15
|
+
def initialize(opts, bundle, type)
|
16
|
+
@opts = opts
|
17
|
+
@bundle = bundle
|
18
|
+
@type = type
|
19
|
+
@dir = File.join(@opts[:bundles_dir], @bundle.name)
|
17
20
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
set_callback :install, :before, :check_installed
|
22
|
+
set_callback :update, :before, :check_dir
|
23
|
+
set_callback :process, :after, :final_message
|
24
|
+
set_callback :all, :after, :all_final_message
|
25
|
+
def final_message
|
26
|
+
VimBundler.ui.info "#{@bundle.name} #{@type}ed"
|
27
|
+
end
|
28
|
+
def check_installed
|
29
|
+
if Dir.exists?(@dir)
|
30
|
+
raise "already installed"
|
24
31
|
end
|
25
32
|
end
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
def check_dir
|
34
|
+
unless Dir.exists?(@dir)
|
35
|
+
raise "not found"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
def process
|
39
|
+
begin
|
40
|
+
run_callbacks :process do
|
41
|
+
run_callbacks @type do
|
42
|
+
send("#{@bundle.type.to_s}_#{@type}")
|
35
43
|
end
|
44
|
+
end
|
45
|
+
rescue StandardError => e
|
46
|
+
VimBundler.ui.warn "#{@bundle.name} #{e.message}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
def self.process_all(definitions, type, name = nil)
|
50
|
+
FileUtils.mkdir_p(definitions[:opts][:bundles_dir])
|
51
|
+
unless name.nil?
|
52
|
+
bundle = definitions[:bundles][name]
|
53
|
+
if(bundle.nil?)
|
54
|
+
VimBundler.ui.warn "bundle #{name} not exists"
|
36
55
|
else
|
37
|
-
definitions[:
|
38
|
-
|
39
|
-
|
56
|
+
new(definitions[:opts], bundle, type).process
|
57
|
+
end
|
58
|
+
else
|
59
|
+
definitions[:bundles].each do |k, bundle|
|
60
|
+
new(definitions[:opts], bundle, type).process
|
40
61
|
end
|
41
62
|
end
|
42
63
|
VimBundler.ui.confirm "all bundles processed"
|
data/lib/vim-bundler/local.rb
CHANGED
@@ -5,39 +5,15 @@ module VimBundler
|
|
5
5
|
module Installer
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
include VimBundler::Actions
|
8
|
-
def local_install
|
9
|
-
|
10
|
-
|
11
|
-
VimBundler.ui.info "#{bundle.name} already installed"
|
12
|
-
return
|
13
|
-
end
|
14
|
-
`ln -s #{bundle.local} #{dir}`
|
15
|
-
if $?.to_i == 0 && post_action(dir, bundle)
|
16
|
-
VimBundler.ui.info "#{bundle.name} installed"
|
17
|
-
else
|
18
|
-
VimBundler.ui.warn "#{bundle.name} not installed"
|
19
|
-
end
|
8
|
+
def local_install
|
9
|
+
`ln -s #{@bundle.local} #{@dir}`
|
10
|
+
raise "unable to make symlink" unless $?.to_i == 0
|
20
11
|
end
|
21
|
-
def local_update
|
22
|
-
dir = File.join(@opts[:bundles_dir], bundle.name)
|
23
|
-
unless Dir.exists?(dir)
|
24
|
-
VimBundler.ui.warn "#{bundle.name} not found"
|
25
|
-
return
|
26
|
-
end
|
27
|
-
if post_action(dir, bundle)
|
28
|
-
VimBundler.ui.info "#{bundle.name} updated"
|
29
|
-
else
|
30
|
-
VimBundler.ui.warn "#{bundle.name} not updated"
|
31
|
-
end
|
12
|
+
def local_update
|
32
13
|
end
|
33
|
-
def local_clean
|
34
|
-
|
35
|
-
|
36
|
-
`unlink #{dir}`
|
37
|
-
VimBundler.ui.info "#{bundle.name} removed"
|
38
|
-
else
|
39
|
-
VimBundler.ui.warn "#{bundle.name} not found"
|
40
|
-
end
|
14
|
+
def local_clean
|
15
|
+
`unlink #{@dir}`
|
16
|
+
raise "unable to make unlink" unless $?.to_i == 0
|
41
17
|
end
|
42
18
|
end
|
43
19
|
module DSL
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'active_support/concern'
|
3
|
+
require 'yaml'
|
4
|
+
module VimBundler
|
5
|
+
module Lock
|
6
|
+
def self.default_lock_file
|
7
|
+
file = File.join(FileUtils.pwd, VimBundler.default_bundles_file) + ".lock"
|
8
|
+
end
|
9
|
+
def self.merge_lock!(definitions)
|
10
|
+
data = {}
|
11
|
+
file = VimBundler::Lock.default_lock_file
|
12
|
+
data = YAML.load_file(file) if File.exists?(file)
|
13
|
+
data.each do |k, v|
|
14
|
+
v[:name] = k
|
15
|
+
v[:block] = nil
|
16
|
+
v[:installed] = true
|
17
|
+
bundle = OpenStruct.new(v)
|
18
|
+
bundle.define_singleton_method :opts do
|
19
|
+
v[:opts]
|
20
|
+
end
|
21
|
+
data[k] = bundle
|
22
|
+
end
|
23
|
+
definitions[:bundles].merge! data
|
24
|
+
definitions
|
25
|
+
end
|
26
|
+
extend ActiveSupport::Concern
|
27
|
+
module Installer
|
28
|
+
extend ActiveSupport::Concern
|
29
|
+
def write_to_lock
|
30
|
+
file = VimBundler::Lock.default_lock_file
|
31
|
+
data = {}
|
32
|
+
data = YAML.load_file(file) if File.exists?(file)
|
33
|
+
hash = @bundle.marshal_dump
|
34
|
+
hash[:opts] = @bundle.opts
|
35
|
+
data[hash[:name].to_s] = hash.select { |k, v| not [:name, :block].include? k }
|
36
|
+
File.open(file, 'w') { |f| f.write(data.to_yaml) }
|
37
|
+
end
|
38
|
+
def remove_from_lock
|
39
|
+
file = VimBundler::Lock.default_lock_file
|
40
|
+
data = {}
|
41
|
+
data = YAML.load_file(file) if File.exists?(file)
|
42
|
+
data.delete(@bundle.name.to_s)
|
43
|
+
File.open(file, 'w') { |f| f.write(data.to_yaml) }
|
44
|
+
end
|
45
|
+
included do
|
46
|
+
set_callback :install, :after, :write_to_lock
|
47
|
+
set_callback :clean, :after, :remove_from_lock
|
48
|
+
YAML::ENGINE.yamler = 'syck'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
module CLI
|
52
|
+
extend ActiveSupport::Concern
|
53
|
+
private
|
54
|
+
def definition_with_lock
|
55
|
+
VimBundler::Lock.merge_lock!(definition_without_lock)
|
56
|
+
end
|
57
|
+
def prepare_name_with_lock(bundle)
|
58
|
+
suffix = bundle.installed.nil? ? " (not installed)" : ""
|
59
|
+
bundle.name + suffix
|
60
|
+
end
|
61
|
+
included do
|
62
|
+
alias_method_chain :definition, :lock
|
63
|
+
alias_method_chain :prepare_name, :lock
|
64
|
+
end
|
65
|
+
end
|
66
|
+
included do
|
67
|
+
VimBundler::Installer.send(:include, VimBundler::Lock::Installer)
|
68
|
+
VimBundler::CLI.send(:include, VimBundler::Lock::CLI)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/vim-bundler/vim_org.rb
CHANGED
@@ -6,14 +6,9 @@ module VimBundler
|
|
6
6
|
module Installer
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
include VimBundler::Actions
|
9
|
-
def vim_org_install
|
10
|
-
|
11
|
-
|
12
|
-
VimBundler.ui.info "#{bundle.name} already installed"
|
13
|
-
return
|
14
|
-
end
|
15
|
-
FileUtils.mkdir_p(dir)
|
16
|
-
f = open("http://www.vim.org/scripts/download_script.php?src_id=#{bundle.vim_script_id}")
|
9
|
+
def vim_org_install
|
10
|
+
FileUtils.mkdir_p(@dir)
|
11
|
+
f = open("http://www.vim.org/scripts/download_script.php?src_id=#{@bundle.vim_script_id}")
|
17
12
|
local_file = f.meta["content-disposition"].gsub(/attachment; filename=/,"")
|
18
13
|
|
19
14
|
# if local_file.end_with? 'tar.gz'
|
@@ -23,20 +18,19 @@ module VimBundler
|
|
23
18
|
# `tar xvfz #{data.path}`
|
24
19
|
# end
|
25
20
|
if local_file.end_with? 'vim'
|
26
|
-
as = bundle.respond_to?(:as) ? bundle.as.to_s : 'plugin'
|
27
|
-
FileUtils.mkdir_p(File.join(dir, as))
|
28
|
-
data = open(File.join(dir, as, local_file), 'w')
|
21
|
+
as = @bundle.respond_to?(:as) ? @bundle.as.to_s : 'plugin'
|
22
|
+
FileUtils.mkdir_p(File.join(@dir, as))
|
23
|
+
data = open(File.join(@dir, as, local_file), 'w')
|
29
24
|
data.write f.read
|
30
25
|
data.close
|
31
26
|
end
|
32
|
-
VimBundler.ui.info "#{bundle.name} installed"
|
33
27
|
end
|
34
|
-
def vim_org_update
|
35
|
-
clean
|
36
|
-
vim_org_install
|
28
|
+
def vim_org_update
|
29
|
+
clean
|
30
|
+
vim_org_install
|
37
31
|
end
|
38
|
-
def vim_org_clean
|
39
|
-
clean
|
32
|
+
def vim_org_clean
|
33
|
+
clean
|
40
34
|
end
|
41
35
|
end
|
42
36
|
module DSL
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
describe VimBundler::Git::Installer do
|
3
|
+
context "when don't use submodule" do
|
4
|
+
before :each do
|
5
|
+
`rm -rf bundle`
|
6
|
+
`rm -rf vim_bundles.lock`
|
7
|
+
end
|
8
|
+
let :dsl do
|
9
|
+
dsl = VimBundler::DSL.new
|
10
|
+
end
|
11
|
+
let :definitions do
|
12
|
+
dsl.bundle "snipmate", :git => "git://github.com/msanders/snipmate.vim.git"
|
13
|
+
dsl.to_definition
|
14
|
+
end
|
15
|
+
context "when #install" do
|
16
|
+
before do
|
17
|
+
VimBundler::Installer.process_all definitions, :install
|
18
|
+
end
|
19
|
+
it "loads bundle from git repo" do
|
20
|
+
`git status bundle/snipmate`.should ~ /branch\smaster/
|
21
|
+
end
|
22
|
+
end
|
23
|
+
context "when #update" do
|
24
|
+
before do
|
25
|
+
VimBundler::Installer.process_all definitions, :install
|
26
|
+
VimBundler::Installer.process_all definitions, :update
|
27
|
+
end
|
28
|
+
it "updates git repo" do
|
29
|
+
pending "don't know how to check update"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
context "when #clean" do
|
33
|
+
before do
|
34
|
+
VimBundler::Installer.process_all definitions, :install
|
35
|
+
VimBundler::Installer.process_all definitions, :clean
|
36
|
+
end
|
37
|
+
it "deletes bundle folder" do
|
38
|
+
File.exists?("bundle/snipmate").should_not be_true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
context "when use submodule" do
|
43
|
+
before :each do
|
44
|
+
`rm -rf bundle`
|
45
|
+
`rm -rf vim_bundles.lock`
|
46
|
+
`rm -rf .gitmodules`
|
47
|
+
`git rm --cached bundle/snipmate`
|
48
|
+
end
|
49
|
+
let :dsl do
|
50
|
+
dsl = VimBundler::DSL.new
|
51
|
+
dsl.use_git_submodules true
|
52
|
+
dsl
|
53
|
+
end
|
54
|
+
let :definitions do
|
55
|
+
dsl.bundle "snipmate", :git => "git://github.com/msanders/snipmate.vim.git"
|
56
|
+
dsl.to_definition
|
57
|
+
end
|
58
|
+
context "when #install" do
|
59
|
+
before do
|
60
|
+
VimBundler::Installer.process_all definitions, :install
|
61
|
+
end
|
62
|
+
it "adds new submodule" do
|
63
|
+
string = File.open('.gitmodules', 'rb') { |file| file.read }
|
64
|
+
string.should ~ /snipmate/
|
65
|
+
end
|
66
|
+
end
|
67
|
+
context "when #update" do
|
68
|
+
before do
|
69
|
+
VimBundler::Installer.process_all definitions, :install
|
70
|
+
VimBundler::Installer.process_all definitions, :update
|
71
|
+
end
|
72
|
+
it "updates submodule" do
|
73
|
+
pending "don't know how to check update"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
context "when #clean" do
|
77
|
+
before do
|
78
|
+
VimBundler::Installer.process_all definitions, :install
|
79
|
+
VimBundler::Installer.process_all definitions, :clean
|
80
|
+
end
|
81
|
+
it "deletes bundle folder" do
|
82
|
+
File.exists?("bundle/snipmate").should_not be_true
|
83
|
+
end
|
84
|
+
it "removes submodule" do
|
85
|
+
string = File.open('.gitmodules', 'rb') { |file| file.read }
|
86
|
+
string.should_not ~ /snipmate/
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
describe VimBundler::Local::Installer do
|
3
|
+
before :each do
|
4
|
+
`rm -rf bundle`
|
5
|
+
`rm -rf vim_bundles.lock`
|
6
|
+
end
|
7
|
+
let :dsl do
|
8
|
+
dsl = VimBundler::DSL.new
|
9
|
+
end
|
10
|
+
let :definitions do
|
11
|
+
dsl.bundle 'spec', :local => "spec"
|
12
|
+
dsl.to_definition
|
13
|
+
end
|
14
|
+
context "when #install" do
|
15
|
+
before do
|
16
|
+
VimBundler::Installer.process_all definitions, :install
|
17
|
+
end
|
18
|
+
it "creates symlink" do
|
19
|
+
`ls -al bundle/spec`.should ~ /-> spec/
|
20
|
+
end
|
21
|
+
end
|
22
|
+
context "when #update" do
|
23
|
+
before do
|
24
|
+
VimBundler::Installer.process_all definitions, :install
|
25
|
+
VimBundler::Installer.process_all definitions, :update
|
26
|
+
end
|
27
|
+
it "does nothing" do
|
28
|
+
`ls -al bundle/spec`.should ~ /-> spec/
|
29
|
+
end
|
30
|
+
end
|
31
|
+
context "when #clean" do
|
32
|
+
before do
|
33
|
+
VimBundler::Installer.process_all definitions, :install
|
34
|
+
VimBundler::Installer.process_all definitions, :clean
|
35
|
+
end
|
36
|
+
it "unlinks folder" do
|
37
|
+
`ls -al bundle/spec 2>/dev/null`.should be_empty
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
describe VimBundler::VimOrg::Installer do
|
3
|
+
before :each do
|
4
|
+
`rm -rf bundle`
|
5
|
+
`rm -rf vim_bundles.lock`
|
6
|
+
end
|
7
|
+
let :dsl do
|
8
|
+
dsl = VimBundler::DSL.new
|
9
|
+
end
|
10
|
+
let :definitions do
|
11
|
+
dsl.bundle 'indexed-search', :vim_script_id => 7062
|
12
|
+
dsl.to_definition
|
13
|
+
end
|
14
|
+
context "when #install" do
|
15
|
+
before do
|
16
|
+
VimBundler::Installer.process_all definitions, :install
|
17
|
+
end
|
18
|
+
it "loads bundle vim.org" do
|
19
|
+
File.exists?("bundle/indexed-search").should be_true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
context "when #update" do
|
23
|
+
before do
|
24
|
+
VimBundler::Installer.process_all definitions, :install
|
25
|
+
VimBundler::Installer.process_all definitions, :update
|
26
|
+
end
|
27
|
+
it "updates bundle" do
|
28
|
+
pending "don't know how to check update"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
context "when #clean" do
|
32
|
+
before do
|
33
|
+
VimBundler::Installer.process_all definitions, :install
|
34
|
+
VimBundler::Installer.process_all definitions, :clean
|
35
|
+
end
|
36
|
+
it "deletes bundle folder" do
|
37
|
+
File.exists?("bundle/indexed-search").should_not be_true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
context "when use as option" do
|
41
|
+
let :dsl do
|
42
|
+
dsl = VimBundler::DSL.new
|
43
|
+
end
|
44
|
+
let :definitions do
|
45
|
+
dsl.bundle 'vrackets', :vim_script_id => 16753, :as => :plugin
|
46
|
+
dsl.to_definition
|
47
|
+
end
|
48
|
+
context "when #install" do
|
49
|
+
before do
|
50
|
+
VimBundler::Installer.process_all definitions, :install
|
51
|
+
end
|
52
|
+
it "loads bundle vim.org" do
|
53
|
+
File.exists?("bundle/vrackets/plugin").should be_true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spork'
|
3
|
+
require 'rr'
|
4
|
+
|
5
|
+
|
6
|
+
Spork.prefork do
|
7
|
+
RUBY_HEAP_MIN_SLOTS=500000
|
8
|
+
RUBY_HEAP_SLOTS_INCREMENT=500000
|
9
|
+
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
|
10
|
+
RUBY_GC_MALLOC_LIMIT=100000000
|
11
|
+
RUBY_HEAP_FREE_MIN=500000
|
12
|
+
# require "rails/application"
|
13
|
+
# Spork.trap_method(Rails::Application, :reload_routes!)
|
14
|
+
# require 'rails/mongoid'
|
15
|
+
# Spork.trap_class_method(Rails::Mongoid, :load_models)
|
16
|
+
ENV['RACK_ENV'] ||= "rspec"
|
17
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/vim-bundler")
|
18
|
+
# require File.expand_path("../../config/environment", __FILE__)
|
19
|
+
# require 'rspec/rails'
|
20
|
+
|
21
|
+
# # Requires supporting ruby files with custom matchers and macros, etc,
|
22
|
+
# # in spec/support/ and its subdirectories.
|
23
|
+
# Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
config.backtrace_clean_patterns = [
|
27
|
+
/\/lib\d*\/ruby\//,
|
28
|
+
/bin\//,
|
29
|
+
#/gems/,
|
30
|
+
/spec\/spec_helper\.rb/,
|
31
|
+
/lib\/rspec\/(core|expectations|matchers|mocks)/
|
32
|
+
]
|
33
|
+
# == Mock Framework
|
34
|
+
#
|
35
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
36
|
+
#
|
37
|
+
# config.mock_with :mocha
|
38
|
+
# config.mock_with :flexmock
|
39
|
+
config.mock_with :rr
|
40
|
+
# config.mock_with :rspec
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
45
|
+
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
46
|
+
|
47
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
48
|
+
# examples within a transaction, remove the following line or assign false
|
49
|
+
# instead of true.
|
50
|
+
# config.use_transactional_fixtures = true
|
51
|
+
# require 'database_cleaner'
|
52
|
+
#
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
Spork.each_run do
|
58
|
+
RSpec.configure do |config|
|
59
|
+
config.before(:each) do
|
60
|
+
VimBundler.ui = VimBundler::UI.new(stub!.say.subject)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/vim-bundler.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{vim-bundler}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Pavel Tatarsky}]
|
12
|
-
s.date = %q{2012-04-
|
12
|
+
s.date = %q{2012-04-25}
|
13
13
|
s.description = %q{This gem provides a simple way to manage your vim bundles (aka plugins).
|
14
14
|
If you are familiar with ruby gem bundler - you are familar with vim-bundler.}
|
15
15
|
s.email = %q{fazzzenda@mail.ru}
|
@@ -22,6 +22,7 @@ If you are familiar with ruby gem bundler - you are familar with vim-bundler.}
|
|
22
22
|
".document",
|
23
23
|
"Gemfile",
|
24
24
|
"Gemfile.lock",
|
25
|
+
"GuardFile",
|
25
26
|
"LICENSE.txt",
|
26
27
|
"README.rdoc",
|
27
28
|
"Rakefile",
|
@@ -34,10 +35,13 @@ If you are familiar with ruby gem bundler - you are familar with vim-bundler.}
|
|
34
35
|
"lib/vim-bundler/git.rb",
|
35
36
|
"lib/vim-bundler/installer.rb",
|
36
37
|
"lib/vim-bundler/local.rb",
|
38
|
+
"lib/vim-bundler/lock.rb",
|
37
39
|
"lib/vim-bundler/ui.rb",
|
38
40
|
"lib/vim-bundler/vim_org.rb",
|
39
|
-
"
|
40
|
-
"
|
41
|
+
"spec/lib/vim-bundler/git_spec.rb",
|
42
|
+
"spec/lib/vim-bundler/local_spec.rb",
|
43
|
+
"spec/lib/vim-bundler/vim_org_spec.rb",
|
44
|
+
"spec/spec_helper.rb",
|
41
45
|
"vim-bundler.gemspec"
|
42
46
|
]
|
43
47
|
s.homepage = %q{http://github.com/vintikzzz/vim-bundler}
|
@@ -52,24 +56,24 @@ If you are familiar with ruby gem bundler - you are familar with vim-bundler.}
|
|
52
56
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
57
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.1.0.beta1"])
|
54
58
|
s.add_runtime_dependency(%q<thor>, [">= 0.14.6"])
|
55
|
-
s.
|
56
|
-
s.add_development_dependency(%q<bundler>, ["
|
57
|
-
s.add_development_dependency(%q<jeweler>, ["
|
59
|
+
s.add_runtime_dependency(%q<awesome_print>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
58
62
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
59
63
|
else
|
60
64
|
s.add_dependency(%q<activesupport>, [">= 3.1.0.beta1"])
|
61
65
|
s.add_dependency(%q<thor>, [">= 0.14.6"])
|
62
|
-
s.add_dependency(%q<
|
63
|
-
s.add_dependency(%q<bundler>, ["
|
64
|
-
s.add_dependency(%q<jeweler>, ["
|
66
|
+
s.add_dependency(%q<awesome_print>, [">= 0"])
|
67
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
68
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
65
69
|
s.add_dependency(%q<rcov>, [">= 0"])
|
66
70
|
end
|
67
71
|
else
|
68
72
|
s.add_dependency(%q<activesupport>, [">= 3.1.0.beta1"])
|
69
73
|
s.add_dependency(%q<thor>, [">= 0.14.6"])
|
70
|
-
s.add_dependency(%q<
|
71
|
-
s.add_dependency(%q<bundler>, ["
|
72
|
-
s.add_dependency(%q<jeweler>, ["
|
74
|
+
s.add_dependency(%q<awesome_print>, [">= 0"])
|
75
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
76
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
73
77
|
s.add_dependency(%q<rcov>, [">= 0"])
|
74
78
|
end
|
75
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vim-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70228374993600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0.beta1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70228374993600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70228377060360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,43 +32,43 @@ dependencies:
|
|
32
32
|
version: 0.14.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70228377060360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: awesome_print
|
38
|
+
requirement: &70228377059600 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '0'
|
44
|
-
type: :
|
44
|
+
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70228377059600
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70228377058920 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70228377058920
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jeweler
|
60
|
-
requirement: &
|
60
|
+
requirement: &70228377058160 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
|
-
- -
|
63
|
+
- - ! '>='
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70228377058160
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rcov
|
71
|
-
requirement: &
|
71
|
+
requirement: &70228377057480 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70228377057480
|
80
80
|
description: ! 'This gem provides a simple way to manage your vim bundles (aka plugins).
|
81
81
|
|
82
82
|
If you are familiar with ruby gem bundler - you are familar with vim-bundler.'
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- .document
|
92
92
|
- Gemfile
|
93
93
|
- Gemfile.lock
|
94
|
+
- GuardFile
|
94
95
|
- LICENSE.txt
|
95
96
|
- README.rdoc
|
96
97
|
- Rakefile
|
@@ -103,10 +104,13 @@ files:
|
|
103
104
|
- lib/vim-bundler/git.rb
|
104
105
|
- lib/vim-bundler/installer.rb
|
105
106
|
- lib/vim-bundler/local.rb
|
107
|
+
- lib/vim-bundler/lock.rb
|
106
108
|
- lib/vim-bundler/ui.rb
|
107
109
|
- lib/vim-bundler/vim_org.rb
|
108
|
-
-
|
109
|
-
-
|
110
|
+
- spec/lib/vim-bundler/git_spec.rb
|
111
|
+
- spec/lib/vim-bundler/local_spec.rb
|
112
|
+
- spec/lib/vim-bundler/vim_org_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
110
114
|
- vim-bundler.gemspec
|
111
115
|
homepage: http://github.com/vintikzzz/vim-bundler
|
112
116
|
licenses:
|
@@ -123,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
127
|
version: '0'
|
124
128
|
segments:
|
125
129
|
- 0
|
126
|
-
hash: -
|
130
|
+
hash: -2008285335090375143
|
127
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
132
|
none: false
|
129
133
|
requirements:
|
data/test/helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
require 'shoulda'
|
12
|
-
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
-
require 'vim-bundler'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|