vvm-rb 1.0.1 → 1.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 +4 -4
- data/.rubocop.yml +0 -10
- data/LICENSE.txt +1 -1
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/vvm/accessor.rb +15 -15
- data/lib/vvm/cli.rb +1 -1
- data/lib/vvm/installer.rb +22 -22
- data/lib/vvm/switcher.rb +4 -4
- data/lib/vvm/uninstaller.rb +13 -11
- data/lib/vvm/validator.rb +19 -21
- data/lib/vvm/version.rb +11 -11
- data/spec/accessor_spec.rb +8 -8
- data/spec/installer_spec.rb +9 -9
- data/spec/spec_helper.rb +13 -15
- data/spec/switcher_spec.rb +3 -3
- data/spec/uninstaller_spec.rb +2 -2
- data/spec/validator_spec.rb +22 -22
- data/vvm-rb.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bba3392e7f281fb636004666b1c110d89014ca58
|
4
|
+
data.tar.gz: aa6477c0d76bf18bce8a2bfb514f2718176ba94d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a258fead91045475538d0fbbbb8b68df0c518ae54fdf328564a7a4bfc9bec3eb16dd969deaa7e9dafbd756bc522184646ab8b75480eea3b162e37889cbc9d490
|
7
|
+
data.tar.gz: c4c4de8775c78c12730b077e79c67395ac1bf120c67ef0d65fe7e76274e0a8e9ec16be14261077aa12965633795a9e49529b2b2f79db09baf7f613a99982c5a3
|
data/.rubocop.yml
CHANGED
@@ -11,17 +11,7 @@ AllCops:
|
|
11
11
|
- vvm-rb.gemspec
|
12
12
|
LineLength:
|
13
13
|
Max: 90
|
14
|
-
MethodLength:
|
15
|
-
Max: 30
|
16
|
-
RedundantReturn:
|
17
|
-
Enabled: false
|
18
14
|
Documentation:
|
19
15
|
Enabled: false
|
20
16
|
SpecialGlobalVars:
|
21
17
|
Enabled: false
|
22
|
-
AccessorMethodName:
|
23
|
-
Enabled: false
|
24
|
-
PredicateName:
|
25
|
-
Enabled: false
|
26
|
-
FileName:
|
27
|
-
Enabled: false
|
data/LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/vvm/accessor.rb
CHANGED
@@ -2,36 +2,36 @@ module Vvm
|
|
2
2
|
module Accessor
|
3
3
|
module_function
|
4
4
|
|
5
|
-
def
|
5
|
+
def dot_dir
|
6
6
|
File.expand_path(ENV['VVMROOT'] || '~/.vvm-rb')
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
File.join(
|
9
|
+
def etc_dir
|
10
|
+
File.join(dot_dir, 'etc')
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
File.join(
|
13
|
+
def repos_dir
|
14
|
+
File.join(dot_dir, 'repos')
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
File.join(
|
17
|
+
def src_dir(version = '')
|
18
|
+
File.join(dot_dir, 'src', version)
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
File.join(
|
21
|
+
def vims_dir(version = '')
|
22
|
+
File.join(dot_dir, 'vims', version)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
File.join(
|
25
|
+
def vimorg_dir
|
26
|
+
File.join(repos_dir, 'vimorg')
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
30
|
-
File.join(
|
29
|
+
def login_file
|
30
|
+
File.join(etc_dir, 'login')
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
File.join(
|
33
|
+
def current_dir
|
34
|
+
File.join(vims_dir, 'current')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/lib/vvm/cli.rb
CHANGED
@@ -70,7 +70,7 @@ module Vvm
|
|
70
70
|
def invoke_command(command, *args)
|
71
71
|
validate_before_invoke(command.name)
|
72
72
|
Installer.pull if %w(install list).include?(command.name)
|
73
|
-
Installer.fetch unless File.exist?(
|
73
|
+
Installer.fetch unless File.exist?(vimorg_dir)
|
74
74
|
super
|
75
75
|
end
|
76
76
|
end
|
data/lib/vvm/installer.rb
CHANGED
@@ -10,59 +10,59 @@ module Vvm
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.fetch
|
13
|
-
FileUtils.mkdir_p(
|
14
|
-
|
15
|
-
system("hg -q clone #{VIM_URI} #{
|
13
|
+
FileUtils.mkdir_p(repos_dir)
|
14
|
+
repo = vimorg_dir
|
15
|
+
system("hg -q clone #{VIM_URI} #{repo}") unless File.exist?(repo)
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.pull
|
19
|
-
Dir.chdir(
|
19
|
+
Dir.chdir(vimorg_dir) { system('hg -q pull') }
|
20
20
|
end
|
21
21
|
|
22
22
|
def checkout
|
23
|
-
|
24
|
-
FileUtils.mkdir_p(
|
25
|
-
return if File.exist?(
|
23
|
+
src = src_dir
|
24
|
+
FileUtils.mkdir_p(src)
|
25
|
+
return if File.exist?(src_dir(@version))
|
26
26
|
archive = "hg archive -t tar -r #{@version} -p #{@version} -"
|
27
|
-
expand = "(cd #{
|
28
|
-
Dir.chdir
|
27
|
+
expand = "(cd #{src} && tar xf -)"
|
28
|
+
Dir.chdir vimorg_dir do
|
29
29
|
system("#{archive} | #{expand} #{@silent}")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
def configure
|
34
|
-
|
35
|
-
|
36
|
-
default
|
37
|
-
Dir.chdir
|
34
|
+
vims = vims_dir(@version)
|
35
|
+
src = src_dir(@version)
|
36
|
+
default = "--prefix=#{vims}"
|
37
|
+
Dir.chdir src do
|
38
38
|
system("./configure #{default} #{@conf.join(' ')} #{@silent}")
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
def make_clean
|
43
|
-
|
44
|
-
Dir.chdir
|
43
|
+
src = src_dir(@version)
|
44
|
+
Dir.chdir src do
|
45
45
|
system("make clean #{@silent}")
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
def make_install
|
50
|
-
|
51
|
-
Dir.chdir
|
50
|
+
src = src_dir(@version)
|
51
|
+
Dir.chdir src do
|
52
52
|
system("make all install #{@silent}")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
def self.cp_etc
|
57
|
-
current_login =
|
57
|
+
current_login = login_file
|
58
58
|
path = File.join(File.dirname(__FILE__), '..', '..', 'etc', 'login')
|
59
59
|
login = File.expand_path(path)
|
60
60
|
if !File.exist?(current_login)
|
61
|
-
|
62
|
-
FileUtils.mkdir_p(
|
63
|
-
FileUtils.cp(login,
|
61
|
+
etc = etc_dir
|
62
|
+
FileUtils.mkdir_p(etc)
|
63
|
+
FileUtils.cp(login, etc)
|
64
64
|
elsif !FileUtils.compare_file(login, current_login)
|
65
|
-
FileUtils.cp(login,
|
65
|
+
FileUtils.cp(login, etc_dir)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
data/lib/vvm/switcher.rb
CHANGED
@@ -7,12 +7,12 @@ module Vvm
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def use
|
10
|
-
current =
|
10
|
+
current = current_dir
|
11
11
|
FileUtils.rm(current) if File.exist?(current)
|
12
12
|
return if @version == 'system'
|
13
|
-
|
14
|
-
abort "#{@version} is not installed." unless File.exist?(
|
15
|
-
FileUtils.ln_s(
|
13
|
+
vims = vims_dir(@version)
|
14
|
+
abort "#{@version} is not installed." unless File.exist?(vims)
|
15
|
+
FileUtils.ln_s(vims, current)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/vvm/uninstaller.rb
CHANGED
@@ -7,17 +7,19 @@ module Vvm
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def uninstall
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
if File.exist?(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
abort "#{@version} can not be uninstalled; It is currently used." if used?
|
11
|
+
vims = vims_dir(@version)
|
12
|
+
src = src_dir(@version)
|
13
|
+
FileUtils.rm_rf(src) if File.exist?(src)
|
14
|
+
FileUtils.rm_rf(vims) if File.exist?(vims)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def used?
|
20
|
+
current = current_dir
|
21
|
+
return false unless File.exist?(current)
|
22
|
+
File.readlink(current) == vims_dir(@version)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
data/lib/vvm/validator.rb
CHANGED
@@ -6,48 +6,46 @@ module Vvm
|
|
6
6
|
|
7
7
|
def validate_before_invoke(command)
|
8
8
|
new_version? if command == 'install'
|
9
|
-
|
9
|
+
installed_version? if %w(reinstall rebuild use uninstall).include?(command)
|
10
10
|
version? if %w(install rebuild use uninstall).include?(command)
|
11
|
-
|
11
|
+
hg? if %w(install reinstall rebuild list).include?(command)
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def hg?
|
15
15
|
abort 'mercurial is required to install.' unless find_executable('hg')
|
16
|
-
|
16
|
+
true
|
17
17
|
end
|
18
18
|
|
19
19
|
def version?
|
20
|
-
if
|
21
|
-
|
22
|
-
end
|
23
|
-
return true
|
20
|
+
abort 'undefined vim version. please run [ vvm list ].' if version.nil?
|
21
|
+
true
|
24
22
|
end
|
25
23
|
|
26
|
-
def new_version?(
|
27
|
-
abort "#{
|
28
|
-
|
24
|
+
def new_version?(ver = version)
|
25
|
+
abort "#{ver} is already installed." if version_include?(ver)
|
26
|
+
true
|
29
27
|
end
|
30
28
|
|
31
|
-
def
|
32
|
-
abort "#{
|
33
|
-
|
29
|
+
def installed_version?(ver = version)
|
30
|
+
abort "#{ver} is not installed." unless version_include?(ver)
|
31
|
+
true
|
34
32
|
end
|
35
33
|
|
36
34
|
private
|
37
35
|
|
38
|
-
def
|
36
|
+
def version
|
39
37
|
version_regex = /\Av7-.+\z|\A(\d\.\d(a|b){0,1}(\.\d+){0,1})\z/
|
40
38
|
regex = /(\Astart\z|\Atip\z|\Asystem\z|\Alatest\z|#{version_regex})/
|
41
|
-
|
42
|
-
|
39
|
+
ver = $*.find { |v| v =~ regex }
|
40
|
+
Version.format(ver)
|
43
41
|
end
|
44
42
|
|
45
|
-
def version_include?(
|
46
|
-
|
43
|
+
def version_include?(ver)
|
44
|
+
Version.versions.include?(ver) || use_system?(ver)
|
47
45
|
end
|
48
46
|
|
49
|
-
def use_system?(
|
50
|
-
|
47
|
+
def use_system?(ver)
|
48
|
+
ver == 'system' && $*.include?('use')
|
51
49
|
end
|
52
50
|
end
|
53
51
|
end
|
data/lib/vvm/version.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
module Vvm
|
2
2
|
class Version
|
3
3
|
def self.list
|
4
|
-
Dir.chdir(
|
4
|
+
Dir.chdir(vimorg_dir) do
|
5
5
|
list = `hg tags`.split.reverse
|
6
6
|
return list.values_at(* list.each_index.select(&:odd?))
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.versions
|
11
|
-
output
|
12
|
-
|
13
|
-
return output unless File.exist?(
|
14
|
-
Dir.glob(File.join(
|
11
|
+
output = []
|
12
|
+
vims = vims_dir
|
13
|
+
return output unless File.exist?(vims)
|
14
|
+
Dir.glob(File.join(vims, 'v*')).sort.each do |d|
|
15
15
|
output << File.basename(d)
|
16
16
|
end
|
17
|
-
|
17
|
+
output
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.latest
|
21
|
-
|
21
|
+
list.select { |v| v =~ /\Av7-.+\z/ }.last
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.current
|
25
|
-
|
26
|
-
|
25
|
+
d = current_dir
|
26
|
+
File.exist?(d) ? File.basename(File.readlink(d)) : 'system'
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.convert(version)
|
30
|
-
|
30
|
+
"v#{version.gsub(/\./, '-')}"
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.format(version)
|
@@ -37,7 +37,7 @@ module Vvm
|
|
37
37
|
when /\A(\d\.\d(a|b){0,1}(\.\d+){0,1})\z/
|
38
38
|
version = convert(version)
|
39
39
|
end
|
40
|
-
|
40
|
+
version
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
data/spec/accessor_spec.rb
CHANGED
@@ -2,31 +2,31 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'Accessor' do
|
4
4
|
it 'can access vvm-rb home directory' do
|
5
|
-
expect(File.exist?(
|
5
|
+
expect(File.exist?(dot_dir)).to be_truthy
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'can access etc directory' do
|
9
|
-
expect(File.exist?(
|
9
|
+
expect(File.exist?(etc_dir)).to be_truthy
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'can access repos directory' do
|
13
|
-
expect(File.exist?(
|
13
|
+
expect(File.exist?(repos_dir)).to be_truthy
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'can access src directory' do
|
17
|
-
expect(File.exist?(
|
17
|
+
expect(File.exist?(src_dir)).to be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'can access vims directory' do
|
21
|
-
expect(File.exist?(
|
21
|
+
expect(File.exist?(vims_dir)).to be_truthy
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'can access vimorg directory' do
|
25
|
-
expect(File.exist?(
|
25
|
+
expect(File.exist?(vimorg_dir)).to be_truthy
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'can access login file' do
|
29
|
-
expect(File.exist?(
|
29
|
+
expect(File.exist?(login_file)).to be_truthy
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'of current directory' do
|
@@ -34,7 +34,7 @@ describe 'Accessor' do
|
|
34
34
|
after { Vvm::Switcher.new('system').use }
|
35
35
|
|
36
36
|
it 'can access current directory' do
|
37
|
-
expect(File.exist?(
|
37
|
+
expect(File.exist?(current_dir)).to be_truthy
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
data/spec/installer_spec.rb
CHANGED
@@ -7,8 +7,8 @@ describe 'Installer', disable_cache: true do
|
|
7
7
|
@installer = Vvm::Installer.new(@version, [], true)
|
8
8
|
end
|
9
9
|
|
10
|
-
let(:version_src_dir) {
|
11
|
-
let(:version_vims_dir) {
|
10
|
+
let(:version_src_dir) { src_dir(@version) }
|
11
|
+
let(:version_vims_dir) { vims_dir(@version) }
|
12
12
|
let(:vim) { File.join(version_vims_dir, 'bin', 'vim') }
|
13
13
|
|
14
14
|
describe 'install' do
|
@@ -16,7 +16,7 @@ describe 'Installer', disable_cache: true do
|
|
16
16
|
before(:all) { Vvm::Installer.fetch }
|
17
17
|
|
18
18
|
it 'exists vimorg dir' do
|
19
|
-
expect(File.exist?(
|
19
|
+
expect(File.exist?(vimorg_dir)).to be_truthy
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'success to clone' do
|
@@ -24,13 +24,13 @@ describe 'Installer', disable_cache: true do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'exists configure file' do
|
27
|
-
expect(File.exist?(File.join(
|
27
|
+
expect(File.exist?(File.join(vimorg_dir, 'configure'))).to be_truthy
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
context 'pull', clean: true, vimorg: true do
|
32
32
|
before :all do
|
33
|
-
Dir.chdir(
|
33
|
+
Dir.chdir(vimorg_dir) { system('hg rollback') }
|
34
34
|
Vvm::Installer.pull
|
35
35
|
end
|
36
36
|
|
@@ -39,7 +39,7 @@ describe 'Installer', disable_cache: true do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'vim is uptodate' do
|
42
|
-
Dir.chdir(
|
42
|
+
Dir.chdir(vimorg_dir) do
|
43
43
|
expect(`export LANG=en_US.UTF-8;hg pull`).to match(/no changes found/)
|
44
44
|
end
|
45
45
|
end
|
@@ -84,11 +84,11 @@ describe 'Installer', disable_cache: true do
|
|
84
84
|
before(:all) { Vvm::Installer.cp_etc }
|
85
85
|
|
86
86
|
it 'exists etc dir' do
|
87
|
-
expect(File.exist?(
|
87
|
+
expect(File.exist?(etc_dir)).to be_truthy
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'exists login file' do
|
91
|
-
expect(File.exist?(
|
91
|
+
expect(File.exist?(login_file)).to be_truthy
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -100,7 +100,7 @@ describe 'Installer', disable_cache: true do
|
|
100
100
|
it 'exists login file' do
|
101
101
|
path = File.join(File.dirname(__FILE__), '..', 'etc', 'login')
|
102
102
|
login = File.expand_path(path)
|
103
|
-
expect(FileUtils).to receive(:cp).with(login,
|
103
|
+
expect(FileUtils).to receive(:cp).with(login, etc_dir)
|
104
104
|
Vvm::Installer.cp_etc
|
105
105
|
end
|
106
106
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -22,10 +22,10 @@ VERSION1, VERSION2 = 'v7-4-083', 'v7-4-103'
|
|
22
22
|
|
23
23
|
RSpec.configure do |config|
|
24
24
|
config.before :suite do
|
25
|
-
|
26
|
-
unless File.exist?(
|
27
|
-
ENV['VVMROOT'] =
|
28
|
-
FileUtils.mkdir_p(
|
25
|
+
cache = cache_dir
|
26
|
+
unless File.exist?(cache)
|
27
|
+
ENV['VVMROOT'] = cache
|
28
|
+
FileUtils.mkdir_p(cache)
|
29
29
|
Vvm::Installer.fetch
|
30
30
|
[VERSION1, VERSION2].each do |v|
|
31
31
|
i = Vvm::Installer.new(v, [], true)
|
@@ -39,9 +39,7 @@ RSpec.configure do |config|
|
|
39
39
|
|
40
40
|
config.before :all do
|
41
41
|
@tmp = Dir.mktmpdir
|
42
|
-
unless self.class.metadata[:disable_cache]
|
43
|
-
FileUtils.cp_r(get_cache_dir, @tmp)
|
44
|
-
end
|
42
|
+
FileUtils.cp_r(cache_dir, @tmp) unless self.class.metadata[:disable_cache]
|
45
43
|
ENV['VVMROOT'] = File.expand_path(File.join(@tmp, '.vvm_cache'))
|
46
44
|
ENV['VVMOPT'] = nil
|
47
45
|
end
|
@@ -55,24 +53,24 @@ RSpec.configure do |config|
|
|
55
53
|
config.before(:all, src: true) { cp_src_dir }
|
56
54
|
end
|
57
55
|
|
58
|
-
def
|
56
|
+
def cache_dir
|
59
57
|
File.expand_path(File.join(File.dirname(__FILE__), '..', '.vvm_cache'))
|
60
58
|
end
|
61
59
|
|
62
60
|
def remove_directories
|
63
|
-
[
|
61
|
+
[src_dir, vimorg_dir, vims_dir, etc_dir].each do |dir|
|
64
62
|
FileUtils.rm_rf(dir) if File.exist?(dir)
|
65
63
|
end
|
66
64
|
end
|
67
65
|
|
68
66
|
def cp_vimorg_dir
|
69
|
-
return if File.exist?(
|
70
|
-
FileUtils.mkdir_p(
|
71
|
-
FileUtils.cp_r(File.join(
|
67
|
+
return if File.exist?(vimorg_dir)
|
68
|
+
FileUtils.mkdir_p(repos_dir)
|
69
|
+
FileUtils.cp_r(File.join(cache_dir, 'repos', 'vimorg'), repos_dir)
|
72
70
|
end
|
73
71
|
|
74
72
|
def cp_src_dir
|
75
|
-
return if File.exist?(
|
76
|
-
FileUtils.mkdir_p(
|
77
|
-
FileUtils.cp_r(File.join(
|
73
|
+
return if File.exist?(src_dir(@version))
|
74
|
+
FileUtils.mkdir_p(src_dir)
|
75
|
+
FileUtils.cp_r(File.join(cache_dir, 'src', @version), src_dir)
|
78
76
|
end
|
data/spec/switcher_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe 'Switcher' do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'delete current' do
|
11
|
-
expect(File.exist?(
|
11
|
+
expect(File.exist?(current_dir)).not_to be_truthy
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -16,8 +16,8 @@ describe 'Switcher' do
|
|
16
16
|
before :all do
|
17
17
|
version = VERSION1
|
18
18
|
Vvm::Switcher.new(version).use
|
19
|
-
@vims_dir =
|
20
|
-
@current =
|
19
|
+
@vims_dir = vims_dir(version)
|
20
|
+
@current = current_dir
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'exist current' do
|
data/spec/uninstaller_spec.rb
CHANGED
@@ -26,11 +26,11 @@ describe 'Uninstaller' do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'delete src dir' do
|
29
|
-
expect(File.exist?(
|
29
|
+
expect(File.exist?(src_dir(@version))).not_to be_truthy
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'delete vims dir' do
|
33
|
-
expect(File.exist?(
|
33
|
+
expect(File.exist?(vims_dir(@version))).not_to be_truthy
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/spec/validator_spec.rb
CHANGED
@@ -8,9 +8,9 @@ describe 'Validator' do
|
|
8
8
|
describe 'validate_before_invoke' do
|
9
9
|
before do
|
10
10
|
allow(Vvm::Validator).to receive(:new_version?).and_return(true)
|
11
|
-
allow(Vvm::Validator).to receive(:
|
11
|
+
allow(Vvm::Validator).to receive(:installed_version?).and_return(true)
|
12
12
|
allow(Vvm::Validator).to receive(:version?).and_return(true)
|
13
|
-
allow(Vvm::Validator).to receive(:
|
13
|
+
allow(Vvm::Validator).to receive(:hg?).and_return(true)
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'install' do
|
@@ -24,22 +24,22 @@ describe 'Validator' do
|
|
24
24
|
Vvm::Validator.validate_before_invoke('install')
|
25
25
|
end
|
26
26
|
|
27
|
-
it '
|
28
|
-
expect(Vvm::Validator).to receive(:
|
27
|
+
it 'hg?' do
|
28
|
+
expect(Vvm::Validator).to receive(:hg?).with(no_args)
|
29
29
|
Vvm::Validator.validate_before_invoke('install')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
context 'reinstall' do
|
34
|
-
it '
|
35
|
-
expect(Vvm::Validator).to receive(:
|
34
|
+
it 'hg?' do
|
35
|
+
expect(Vvm::Validator).to receive(:hg?).with(no_args)
|
36
36
|
Vvm::Validator.validate_before_invoke('reinstall')
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
context 'rebuild' do
|
41
|
-
it '
|
42
|
-
expect(Vvm::Validator).to receive(:
|
41
|
+
it 'installed_version?' do
|
42
|
+
expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
|
43
43
|
Vvm::Validator.validate_before_invoke('rebuild')
|
44
44
|
end
|
45
45
|
|
@@ -48,15 +48,15 @@ describe 'Validator' do
|
|
48
48
|
Vvm::Validator.validate_before_invoke('rebuild')
|
49
49
|
end
|
50
50
|
|
51
|
-
it '
|
52
|
-
expect(Vvm::Validator).to receive(:
|
51
|
+
it 'hg?' do
|
52
|
+
expect(Vvm::Validator).to receive(:hg?).with(no_args)
|
53
53
|
Vvm::Validator.validate_before_invoke('rebuild')
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
context 'use' do
|
58
|
-
it '
|
59
|
-
expect(Vvm::Validator).to receive(:
|
58
|
+
it 'installed_version?' do
|
59
|
+
expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
|
60
60
|
Vvm::Validator.validate_before_invoke('use')
|
61
61
|
end
|
62
62
|
|
@@ -67,15 +67,15 @@ describe 'Validator' do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
context 'list' do
|
70
|
-
it '
|
71
|
-
expect(Vvm::Validator).to receive(:
|
70
|
+
it 'hg?' do
|
71
|
+
expect(Vvm::Validator).to receive(:hg?).with(no_args)
|
72
72
|
Vvm::Validator.validate_before_invoke('list')
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
context 'uninstall' do
|
77
|
-
it '
|
78
|
-
expect(Vvm::Validator).to receive(:
|
77
|
+
it 'installed_version?' do
|
78
|
+
expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
|
79
79
|
Vvm::Validator.validate_before_invoke('uninstall')
|
80
80
|
end
|
81
81
|
|
@@ -86,12 +86,12 @@ describe 'Validator' do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
describe '
|
89
|
+
describe 'hg?' do
|
90
90
|
context 'hg is installed' do
|
91
91
|
before { allow(Vvm::Validator).to receive(:find_executable).and_return(true) }
|
92
92
|
|
93
93
|
it 'success to run the method' do
|
94
|
-
expect(Vvm::Validator.
|
94
|
+
expect(Vvm::Validator.hg?).to be_truthy
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -99,7 +99,7 @@ describe 'Validator' do
|
|
99
99
|
before { allow(Vvm::Validator).to receive(:find_executable).and_return(false) }
|
100
100
|
|
101
101
|
it 'cannot run the method' do
|
102
|
-
expect(proc { Vvm::Validator.
|
102
|
+
expect(proc { Vvm::Validator.hg? }).to raise_error
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -146,16 +146,16 @@ describe 'Validator' do
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
describe '
|
149
|
+
describe 'installed_version?' do
|
150
150
|
context 'version is installed' do
|
151
151
|
it 'success to run the method' do
|
152
|
-
expect(
|
152
|
+
expect(installed_version?(VERSION1)).to be_truthy
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
156
|
context 'version is not installed' do
|
157
157
|
it 'cannot run the method' do
|
158
|
-
expect(proc {
|
158
|
+
expect(proc { installed_version?(NEW_VERSION) }).to raise_error
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
data/vvm-rb.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: vvm-rb 1.0.
|
5
|
+
# stub: vvm-rb 1.0.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vvm-rb"
|
9
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Yuu Shigetani"]
|
14
|
-
s.date = "2015-02-
|
14
|
+
s.date = "2015-02-21"
|
15
15
|
s.description = "vim version manager."
|
16
16
|
s.email = "s2g4t1n2@gmail.com"
|
17
17
|
s.executables = ["vvm"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vvm-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuu Shigetani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|