vvm-rb 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c6de49e7509ecb572267660fdd61c11810fbd5c
4
- data.tar.gz: f1b2cc3256b02ed495dbe48bc8f4861a923ee188
3
+ metadata.gz: bba3392e7f281fb636004666b1c110d89014ca58
4
+ data.tar.gz: aa6477c0d76bf18bce8a2bfb514f2718176ba94d
5
5
  SHA512:
6
- metadata.gz: 9752390df48dd241a47824cb5d01704b4852f8649b465047cd159f013a110c23e938af04a1c0ca96ca2946d897268da7c859e7bc8e4383e88c7881a6213e0108
7
- data.tar.gz: f9f83ba5b0cbe2da4d1ab96d1a9e6c01acadafcfd4245d07b8e198cba362dc9c2e8389969a2d2148655a021293f2320268617f8a74d672b7f9c49378208ef1e4
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Yuu Shigetani
1
+ Copyright (c) 2013-2015 Yuu Shigetani
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -72,6 +72,6 @@ after use command, you have to reload shell:
72
72
 
73
73
  == Copyright
74
74
 
75
- Copyright (c) 2013 Yuu Shigetani. See LICENSE.txt for
75
+ Copyright (c) 2013-2015 Yuu Shigetani. See LICENSE.txt for
76
76
  further details.
77
77
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
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 get_dot_dir
5
+ def dot_dir
6
6
  File.expand_path(ENV['VVMROOT'] || '~/.vvm-rb')
7
7
  end
8
8
 
9
- def get_etc_dir
10
- File.join(get_dot_dir, 'etc')
9
+ def etc_dir
10
+ File.join(dot_dir, 'etc')
11
11
  end
12
12
 
13
- def get_repos_dir
14
- File.join(get_dot_dir, 'repos')
13
+ def repos_dir
14
+ File.join(dot_dir, 'repos')
15
15
  end
16
16
 
17
- def get_src_dir(version = '')
18
- File.join(get_dot_dir, 'src', version)
17
+ def src_dir(version = '')
18
+ File.join(dot_dir, 'src', version)
19
19
  end
20
20
 
21
- def get_vims_dir(version = '')
22
- File.join(get_dot_dir, 'vims', version)
21
+ def vims_dir(version = '')
22
+ File.join(dot_dir, 'vims', version)
23
23
  end
24
24
 
25
- def get_vimorg_dir
26
- File.join(get_repos_dir, 'vimorg')
25
+ def vimorg_dir
26
+ File.join(repos_dir, 'vimorg')
27
27
  end
28
28
 
29
- def get_login_file
30
- File.join(get_etc_dir, 'login')
29
+ def login_file
30
+ File.join(etc_dir, 'login')
31
31
  end
32
32
 
33
- def get_current_dir
34
- File.join(get_vims_dir, 'current')
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?(get_vimorg_dir)
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(get_repos_dir)
14
- repos_dir = get_vimorg_dir
15
- system("hg -q clone #{VIM_URI} #{repos_dir}") unless File.exist?(repos_dir)
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(get_vimorg_dir) { system('hg -q pull') }
19
+ Dir.chdir(vimorg_dir) { system('hg -q pull') }
20
20
  end
21
21
 
22
22
  def checkout
23
- src_dir = get_src_dir
24
- FileUtils.mkdir_p(src_dir)
25
- return if File.exist?(get_src_dir(@version))
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 #{src_dir} && tar xf -)"
28
- Dir.chdir get_vimorg_dir do
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
- vims_dir = get_vims_dir(@version)
35
- src_dir = get_src_dir(@version)
36
- default = "--prefix=#{vims_dir}"
37
- Dir.chdir src_dir do
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
- src_dir = get_src_dir(@version)
44
- Dir.chdir src_dir do
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
- src_dir = get_src_dir(@version)
51
- Dir.chdir src_dir do
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 = get_login_file
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
- etc_dir = get_etc_dir
62
- FileUtils.mkdir_p(etc_dir)
63
- FileUtils.cp(login, etc_dir)
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, get_etc_dir)
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 = get_current_dir
10
+ current = current_dir
11
11
  FileUtils.rm(current) if File.exist?(current)
12
12
  return if @version == 'system'
13
- vims_dir = get_vims_dir(@version)
14
- abort "#{@version} is not installed." unless File.exist?(vims_dir)
15
- FileUtils.ln_s(vims_dir, current)
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
@@ -7,17 +7,19 @@ module Vvm
7
7
  end
8
8
 
9
9
  def uninstall
10
- current = get_current_dir
11
- vims_dir = get_vims_dir(@version)
12
- src_dir = get_src_dir(@version)
13
- if File.exist?(current)
14
- target = File.readlink(current)
15
- if target == vims_dir
16
- abort "#{@version} can not be uninstalled; it is currently used."
17
- end
18
- end
19
- FileUtils.rm_rf(src_dir) if File.exist?(src_dir)
20
- FileUtils.rm_rf(vims_dir) if File.exist?(vims_dir)
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
- has_version? if %w(reinstall rebuild use uninstall).include?(command)
9
+ installed_version? if %w(reinstall rebuild use uninstall).include?(command)
10
10
  version? if %w(install rebuild use uninstall).include?(command)
11
- has_hg? if %w(install reinstall rebuild list).include?(command)
11
+ hg? if %w(install reinstall rebuild list).include?(command)
12
12
  end
13
13
 
14
- def has_hg?
14
+ def hg?
15
15
  abort 'mercurial is required to install.' unless find_executable('hg')
16
- return true
16
+ true
17
17
  end
18
18
 
19
19
  def version?
20
- if get_version.nil?
21
- abort 'undefined vim version. please run [ vvm list ].'
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?(version = get_version)
27
- abort "#{version} is already installed." if version_include?(version)
28
- return true
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 has_version?(version = get_version)
32
- abort "#{version} is not installed." unless version_include?(version)
33
- return true
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 get_version
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
- version = $*.find { |v| v =~ regex }
42
- return Version.format(version)
39
+ ver = $*.find { |v| v =~ regex }
40
+ Version.format(ver)
43
41
  end
44
42
 
45
- def version_include?(version)
46
- return Version.versions.include?(version) || use_system?(version)
43
+ def version_include?(ver)
44
+ Version.versions.include?(ver) || use_system?(ver)
47
45
  end
48
46
 
49
- def use_system?(version)
50
- return version == 'system' && $*.include?('use')
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(get_vimorg_dir) do
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
- vims_dir = get_vims_dir
13
- return output unless File.exist?(vims_dir)
14
- Dir.glob(File.join(vims_dir, 'v*')).sort.each do |d|
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
- return output
17
+ output
18
18
  end
19
19
 
20
20
  def self.latest
21
- return list.select { |v| v =~ /\Av7-.+\z/ }.last
21
+ list.select { |v| v =~ /\Av7-.+\z/ }.last
22
22
  end
23
23
 
24
24
  def self.current
25
- c = get_current_dir
26
- return File.exist?(c) ? File.basename(File.readlink(c)) : 'system'
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
- return "v#{version.gsub(/\./, '-')}"
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
- return version
40
+ version
41
41
  end
42
42
  end
43
43
  end
@@ -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?(get_dot_dir)).to be_truthy
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?(get_etc_dir)).to be_truthy
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?(get_repos_dir)).to be_truthy
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?(get_src_dir)).to be_truthy
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?(get_vims_dir)).to be_truthy
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?(get_vimorg_dir)).to be_truthy
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?(get_login_file)).to be_truthy
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?(get_current_dir)).to be_truthy
37
+ expect(File.exist?(current_dir)).to be_truthy
38
38
  end
39
39
  end
40
40
  end
@@ -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) { get_src_dir(@version) }
11
- let(:version_vims_dir) { get_vims_dir(@version) }
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?(get_vimorg_dir)).to be_truthy
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(get_vimorg_dir, 'configure'))).to be_truthy
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(get_vimorg_dir) { system('hg rollback') }
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(get_vimorg_dir) do
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?(get_etc_dir)).to be_truthy
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?(get_login_file)).to be_truthy
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, get_etc_dir)
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
- cache_dir = get_cache_dir
26
- unless File.exist?(cache_dir)
27
- ENV['VVMROOT'] = cache_dir
28
- FileUtils.mkdir_p(cache_dir)
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 get_cache_dir
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
- [get_src_dir, get_vims_dir, get_vims_dir, get_etc_dir].each do |dir|
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?(get_vimorg_dir)
70
- FileUtils.mkdir_p(get_repos_dir)
71
- FileUtils.cp_r(File.join(get_cache_dir, 'repos', 'vimorg'), get_repos_dir)
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?(get_src_dir(@version))
76
- FileUtils.mkdir_p(get_src_dir)
77
- FileUtils.cp_r(File.join(get_cache_dir, 'src', @version), get_src_dir)
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
@@ -8,7 +8,7 @@ describe 'Switcher' do
8
8
  end
9
9
 
10
10
  it 'delete current' do
11
- expect(File.exist?(get_current_dir)).not_to be_truthy
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 = get_vims_dir(version)
20
- @current = get_current_dir
19
+ @vims_dir = vims_dir(version)
20
+ @current = current_dir
21
21
  end
22
22
 
23
23
  it 'exist current' do
@@ -26,11 +26,11 @@ describe 'Uninstaller' do
26
26
  end
27
27
 
28
28
  it 'delete src dir' do
29
- expect(File.exist?(get_src_dir(@version))).not_to be_truthy
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?(get_vims_dir(@version))).not_to be_truthy
33
+ expect(File.exist?(vims_dir(@version))).not_to be_truthy
34
34
  end
35
35
  end
36
36
  end
@@ -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(:has_version?).and_return(true)
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(:has_hg?).and_return(true)
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 'has_hg?' do
28
- expect(Vvm::Validator).to receive(:has_hg?).with(no_args)
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 'has_hg?' do
35
- expect(Vvm::Validator).to receive(:has_hg?).with(no_args)
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 'has_version?' do
42
- expect(Vvm::Validator).to receive(:has_version?).with(no_args)
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 'has_hg?' do
52
- expect(Vvm::Validator).to receive(:has_hg?).with(no_args)
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 'has_version?' do
59
- expect(Vvm::Validator).to receive(:has_version?).with(no_args)
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 'has_hg?' do
71
- expect(Vvm::Validator).to receive(:has_hg?).with(no_args)
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 'has_version?' do
78
- expect(Vvm::Validator).to receive(:has_version?).with(no_args)
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 'has_hg?' do
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.has_hg?).to be_truthy
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.has_hg? }).to raise_error
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 'has_version?' do
149
+ describe 'installed_version?' do
150
150
  context 'version is installed' do
151
151
  it 'success to run the method' do
152
- expect(has_version?(VERSION1)).to be_truthy
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 { has_version?(NEW_VERSION) }).to raise_error
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.1 ruby lib
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.1"
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-20"
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.1
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-20 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor