vvm-rb 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/lib/vvm-rb/cli.rb +2 -1
- data/lib/vvm-rb/installer.rb +2 -2
- data/lib/vvm-rb/switcher.rb +2 -2
- data/lib/vvm-rb/uninstaller.rb +3 -3
- data/lib/vvm-rb/validator.rb +8 -5
- data/spec/installer_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/switcher_spec.rb +2 -2
- data/spec/uninstaller_spec.rb +2 -2
- data/spec/validator_spec.rb +24 -2
- 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: 9008c71b828b8a50ec47935b5a5149fca87b17bf
|
4
|
+
data.tar.gz: 0c070f2b2744fd8e2343c6a716a5ad11736a57f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 525d22b4845be4c8021d36ba7da9acd1e3cc341adfad77619d9e5d1d8997475ae753c90d156ecdde657645e17dc00a441f176c8ee4bc46790310d496049c400a
|
7
|
+
data.tar.gz: 894dc2ac1fbb191b4f00ae9ee1f16ed713c52b5930c9d396224c6c0bf31021f45fa5010d428b162c84a25e452bf6326f5281bb1c8813f3d807ad873f08d7c2d5
|
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/vvm-rb/cli.rb
CHANGED
@@ -52,7 +52,8 @@ test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
|
|
52
52
|
Uninstaller.new(version).uninstall
|
53
53
|
end
|
54
54
|
|
55
|
-
before_method(:install, :reinstall, :rebuild, :list) {
|
55
|
+
before_method(:install, :reinstall, :rebuild, :list) { check_hg }
|
56
|
+
before_method(:install, :reinstall, :rebuild, :use, :uninstall) { check_tag }
|
56
57
|
|
57
58
|
private
|
58
59
|
|
data/lib/vvm-rb/installer.rb
CHANGED
@@ -10,7 +10,7 @@ class Installer
|
|
10
10
|
def fetch
|
11
11
|
FileUtils.mkdir_p(get_repos_dir)
|
12
12
|
repos_dir = get_vimorg_dir
|
13
|
-
unless
|
13
|
+
unless File.exists?(repos_dir)
|
14
14
|
system("hg clone #{VIM_URI} #{repos_dir}")
|
15
15
|
end
|
16
16
|
Dir.chdir(repos_dir) { system('hg pull') }
|
@@ -20,7 +20,7 @@ class Installer
|
|
20
20
|
repos_dir = get_vimorg_dir
|
21
21
|
src_dir = get_src_dir
|
22
22
|
FileUtils.mkdir_p(src_dir)
|
23
|
-
unless
|
23
|
+
unless File.exists?(get_src_dir(@version))
|
24
24
|
system("cd #{repos_dir} && hg archive -t tar -r #{@version} -p #{@version} - | (cd #{src_dir} && tar xf -)")
|
25
25
|
end
|
26
26
|
end
|
data/lib/vvm-rb/switcher.rb
CHANGED
@@ -7,12 +7,12 @@ class Switcher
|
|
7
7
|
|
8
8
|
def use
|
9
9
|
current = get_current_dir
|
10
|
-
if
|
10
|
+
if File.exists?(current)
|
11
11
|
FileUtils.rm(current)
|
12
12
|
end
|
13
13
|
unless @version == 'system'
|
14
14
|
vims_dir = get_vims_dir(@version)
|
15
|
-
unless
|
15
|
+
unless File.exists?(vims_dir)
|
16
16
|
abort "#{@version} is not installed."
|
17
17
|
end
|
18
18
|
FileUtils.ln_s(vims_dir, current)
|
data/lib/vvm-rb/uninstaller.rb
CHANGED
@@ -9,16 +9,16 @@ class Uninstaller
|
|
9
9
|
current = get_current_dir
|
10
10
|
vims_dir = get_vims_dir(@version)
|
11
11
|
src_dir = get_src_dir(@version)
|
12
|
-
if
|
12
|
+
if File.exists?(current)
|
13
13
|
target = File.readlink(current)
|
14
14
|
if target == vims_dir
|
15
15
|
abort "#{@version} can not be uninstalled; it is currently used."
|
16
16
|
end
|
17
17
|
end
|
18
|
-
if
|
18
|
+
if File.exists?(src_dir)
|
19
19
|
FileUtils.rm_rf(src_dir)
|
20
20
|
end
|
21
|
-
if
|
21
|
+
if File.exists?(vims_dir)
|
22
22
|
FileUtils.rm_rf(vims_dir)
|
23
23
|
end
|
24
24
|
end
|
data/lib/vvm-rb/validator.rb
CHANGED
@@ -9,20 +9,23 @@ module Validator
|
|
9
9
|
m = instance_method(name)
|
10
10
|
define_method(name) do |*args, &block|
|
11
11
|
yield
|
12
|
-
m.bind(self).(*args, &block)
|
12
|
+
m.bind(self).call(*args, &block)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def validations
|
18
|
-
check_hg
|
19
|
-
end
|
20
|
-
|
21
17
|
def check_hg
|
22
18
|
unless Kernel.system('hg --version > /dev/null')
|
23
19
|
abort 'mercurial is required to install.'
|
24
20
|
end
|
25
21
|
return true
|
26
22
|
end
|
23
|
+
|
24
|
+
def check_tag
|
25
|
+
unless $*[1] =~ /(^start$|^tip$|^v7-.+$|^system$)/
|
26
|
+
abort 'undefined vim version. please run [ vvm-rb list ] and check available versions.'
|
27
|
+
end
|
28
|
+
return true
|
29
|
+
end
|
27
30
|
end
|
28
31
|
end
|
data/spec/installer_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe 'Installer' do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'exists vimorg dir' do
|
21
|
-
expect(
|
21
|
+
expect(File.exists?(get_vimorg_dir)).to be_true
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -28,7 +28,7 @@ describe 'Installer' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'exists src dir' do
|
31
|
-
expect(
|
31
|
+
expect(File.exists?(get_src_dir(@version))).to be_true
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -39,7 +39,7 @@ describe 'Installer' do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'exists vims dir' do
|
42
|
-
expect(
|
42
|
+
expect(File.exists?(get_vims_dir(@version))).to be_true
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -49,7 +49,7 @@ describe 'Installer' do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'exists etc dir' do
|
52
|
-
expect(
|
52
|
+
expect(File.exists?(get_etc_dir)).to be_true
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'exists login file' do
|
data/spec/spec_helper.rb
CHANGED
@@ -22,7 +22,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
22
22
|
RSpec.configure do |config|
|
23
23
|
config.before :suite do
|
24
24
|
cache_dir = get_cache_dir
|
25
|
-
unless
|
25
|
+
unless File.exists?(cache_dir)
|
26
26
|
FileUtils.mkdir_p(cache_dir)
|
27
27
|
%w{ v7-3-969 v7-4 }.each do |v|
|
28
28
|
i = Installer.new(v)
|
data/spec/switcher_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe 'Switcher' do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'delete current' do
|
13
|
-
expect(
|
13
|
+
expect(File.exists?(get_current_dir)).not_to be_true
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -25,7 +25,7 @@ describe 'Switcher' do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'exist current' do
|
28
|
-
expect(
|
28
|
+
expect(File.exists?(@current)).to be_true
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'switch 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(
|
29
|
+
expect(File.exists?(get_src_dir(@version))).not_to be_true
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'delete vims dir' do
|
33
|
-
expect(
|
33
|
+
expect(File.exists?(get_vims_dir(@version))).not_to be_true
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/spec/validator_spec.rb
CHANGED
@@ -2,10 +2,11 @@ require 'spec_helper'
|
|
2
2
|
include Validator
|
3
3
|
|
4
4
|
describe 'Validator' do
|
5
|
-
def dummy_method ; end
|
6
|
-
before_method(:dummy_method) { validations }
|
7
5
|
|
8
6
|
describe 'check_hg' do
|
7
|
+
def dummy_method ; end
|
8
|
+
before_method(:dummy_method) { check_hg }
|
9
|
+
|
9
10
|
context 'hg is installed' do
|
10
11
|
before do
|
11
12
|
Kernel.stub(:system).and_return(true)
|
@@ -26,4 +27,25 @@ describe 'Validator' do
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
30
|
+
|
31
|
+
describe 'check_tag' do
|
32
|
+
def dummy_method ; end
|
33
|
+
before_method(:dummy_method) { check_tag }
|
34
|
+
|
35
|
+
context 'available tag' do
|
36
|
+
before { $*[1] = 'v7-4-050' }
|
37
|
+
|
38
|
+
it 'success to run the method' do
|
39
|
+
expect(dummy_method).to be_nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'hg is not installed' do
|
44
|
+
before { $*[1] = '--enable-rubyinterp' }
|
45
|
+
|
46
|
+
it 'cannot run the method' do
|
47
|
+
expect(proc { dummy_method }).to raise_error
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
29
51
|
end
|
data/vvm-rb.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
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 0.0.
|
5
|
+
# stub: vvm-rb 0.0.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vvm-rb"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.5"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Yuu Shigetani"]
|
13
|
-
s.date = "2013-10-
|
13
|
+
s.date = "2013-10-05"
|
14
14
|
s.description = "vim version manager."
|
15
15
|
s.email = "s2g4t1n2@gmail.com"
|
16
16
|
s.executables = ["vvm-rb"]
|
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: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuu Shigetani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|