vvm-rb 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: becb8223dd0d3d9a2f5522445d5d7ab4130002a3
4
- data.tar.gz: f65f0a6e6ed7092c36961bcc3884f244d92c6db3
3
+ metadata.gz: ea02a5123a931b4f1dbb13b7e38664cc64063e44
4
+ data.tar.gz: 27a8e9503eb972e2876fe6168e3b378b101a1138
5
5
  SHA512:
6
- metadata.gz: cad93deb752cd8ab2b9ec2fe6ab242fc77feb3cdde85eab5ce86a56a72a5da70b0ea244fdcea662936f2013eab11b26fba71d76dcb5390244c66fcab01103eaa
7
- data.tar.gz: f9f1e1344cbbab1fd422779b63ef6287043b0e3ee94e7f42d4d506d36a6d7931c85c3cb6bbfe304194a7b0eabd3a9d9bfacbe91a5e0885c149c855e88bae7b27
6
+ metadata.gz: d0d6253f91e8804c84b8d9c9d747e925a9d09d82ec267537af5198e9735f7c20ea24cbef2bc2d783016c4e6bce9b25b0b90c0890f6bf0cfc29bf50936974e4e1
7
+ data.tar.gz: 07a6d880bd4445b11c08371aedb8ebeca258e0fa73870583429cf3a259f21df5040a63daf3cba71ef55898e7fe62b9e8dca28c3b58c87ee011a57dd696bbfdf8
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+ repo_token: JXdUC0No2jFLktGfjwVfInePFNnFKEnYb
data/.travis.yml ADDED
@@ -0,0 +1 @@
1
+ language: ruby
data/Gemfile CHANGED
@@ -9,4 +9,5 @@ group :development do
9
9
  gem 'bundler'
10
10
  gem 'jeweler'
11
11
  gem 'simplecov'
12
+ gem 'coveralls', :require => false
12
13
  end
data/README.rdoc CHANGED
@@ -1,17 +1,34 @@
1
1
  = vvm-rb
2
2
 
3
+ {<img src="https://badge.fury.io/rb/vvm-rb.png" alt="Gem Version" />}[http://badge.fury.io/rb/vvm-rb]
4
+ {<img src="https://gemnasium.com/calorie/vvm-rb.png" alt="Dependency Status" />}[https://gemnasium.com/calorie/vvm-rb]
5
+ {<img src="https://travis-ci.org/calorie/vvm-rb.png" />}[https://travis-ci.org/calorie/vvm-rb]
6
+ {<img src="https://coveralls.io/repos/calorie/vvm-rb/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/calorie/vvm-rb]
7
+ {<img src="https://codeclimate.com/github/calorie/vvm-rb.png" />}[https://codeclimate.com/github/calorie/vvm-rb]
8
+
9
+
3
10
  vim version manager : fork from https://github.com/kana/vim-version-manager
4
11
 
5
12
  == Install
6
13
 
7
- $ rake build
8
- $ rake install
14
+ $ gem install vvm-rb
15
+
16
+ or
17
+
18
+ $ git clone https://github.com/calorie/vvm-rb.git
19
+ $ cd vvm-rb
20
+ $ bundle install --path vendor/bundle
21
+ $ bundle exec rake build
22
+ $ bundle exec rake install
9
23
 
10
24
  == Usage
11
25
  please add the following line into your ~/.bash_login etc:
12
26
 
13
- test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
27
+ test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
28
+
29
+ commands
14
30
 
31
+ $ vvm-rb help
15
32
  $ vvm-rb install v7-4
16
33
  $ vvm-rb install v7-4-035
17
34
  $ vvm-rb reinstall v7-4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/bin/vvm-rb CHANGED
@@ -1,8 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
- require 'vvm-rb/cli'
5
- require 'vvm-rb/constants'
3
+ begin
4
+ require 'vvm-rb'
5
+ require 'vvm-rb/cli'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'vvm-rb'
9
+ require 'vvm-rb/cli'
10
+ end
6
11
 
12
+ include VvmRb
7
13
  Cli.source_root(File.dirname(__FILE__) + '/..')
8
14
  Cli.start
@@ -0,0 +1,41 @@
1
+ module Accesser
2
+ attr_writer :dot_dir
3
+
4
+ module_function
5
+
6
+ def get_dot_dir
7
+ return File.expand_path(@dot_dir || '~/.vvm-rb')
8
+ end
9
+
10
+ def get_etc_dir
11
+ return File.join(get_dot_dir, 'etc')
12
+ end
13
+
14
+ def get_repos_dir
15
+ return File.join(get_dot_dir, 'repos')
16
+ end
17
+
18
+ def get_src_dir(version = '')
19
+ return File.join(get_dot_dir, 'src', version)
20
+ end
21
+
22
+ def get_vims_dir(version = '')
23
+ return File.join(get_dot_dir, 'vims', version)
24
+ end
25
+
26
+ def get_vimorg_dir
27
+ return File.join(get_repos_dir, 'vimorg')
28
+ end
29
+
30
+ def get_login_file
31
+ return File.join(get_etc_dir, 'login')
32
+ end
33
+
34
+ def get_current_dir
35
+ return File.join(get_vims_dir, 'current')
36
+ end
37
+
38
+ def get_cache_dir
39
+ return File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '.vvm_cache'))
40
+ end
41
+ end
data/lib/vvm-rb/cli.rb CHANGED
@@ -1,41 +1,74 @@
1
1
  require 'thor'
2
- require 'vvm-rb/validator'
3
- require 'vvm-rb/installer'
4
- require 'vvm-rb/uninstaller'
5
- require 'vvm-rb/switcher'
6
2
 
7
3
  class Cli < Thor
8
4
  include Thor::Actions
5
+ include Validator
9
6
 
10
7
  desc 'install [TAG] [options]', 'Install a specific version of Vim'
11
8
  def install(version, *conf)
12
- installer = Installer.new(version, conf)
13
- installer.install
9
+ installer(version, conf)
10
+
11
+ print "\e[32m"
12
+ puts <<-EOS
13
+
14
+ Vim is successfully installed. For daily use,
15
+ please add the following line into your ~/.bash_login etc:
16
+
17
+ test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
18
+
19
+ EOS
20
+ print "\e[0m"
14
21
  end
15
22
 
16
23
  desc 'reinstall [TAG] [options]', 'Reinstall a specific version of Vim'
17
24
  def reinstall(version, *conf)
18
- uninstaller = Uninstaller.new(version)
19
- uninstaller.uninstall
20
- installer = Installer.new(version, conf)
21
- installer.install
25
+ Uninstaller.new(version).uninstall
26
+ installer(version, conf)
22
27
  end
23
28
 
24
29
  desc 'rebuild [TAG] [options]', 'Rebuild a specific version of Vim, then install it'
25
30
  def rebuild(version, *conf)
26
- installer = Installer.new(version, conf)
27
- installer.rebuild
31
+ rebuilder(version, conf)
28
32
  end
29
33
 
30
34
  desc 'use [TAG]', 'Use a specific version of Vim as the default one.'
31
35
  def use(version)
32
- switcher = Switcher.new(version)
33
- switcher.use
36
+ Switcher.new(version).use
37
+ end
38
+
39
+ desc 'list', 'Look available vim versions'
40
+ def list
41
+ Installer.new('dummy').fetch
42
+ puts Version.list
43
+ end
44
+
45
+ desc 'versions', 'Look installed vim versions.'
46
+ def versions
47
+ puts Version.versions
34
48
  end
35
49
 
36
50
  desc 'uninstall [TAG]', 'Uninstall a specific version of Vim.'
37
51
  def uninstall(version)
38
- uninstaller = Uninstaller.new(version)
39
- uninstaller.uninstall
52
+ Uninstaller.new(version).uninstall
53
+ end
54
+
55
+ before_method(:install, :reinstall, :rebuild, :list) { validations }
56
+
57
+ private
58
+
59
+ def installer(version, conf)
60
+ i = Installer.new(version, conf)
61
+ i.fetch
62
+ i.checkout
63
+ i.configure
64
+ i.make_install
65
+ i.cp_etc
66
+ end
67
+
68
+ def rebuilder(version, conf)
69
+ r = Installer.new(version, conf)
70
+ r.make_clean
71
+ r.configure
72
+ r.make_install
40
73
  end
41
74
  end
@@ -1,6 +1 @@
1
- DOT_DIR = File.expand_path('~/.vvm-rb')
2
- ETC_DIR = "#{DOT_DIR}/etc"
3
- REPOS_DIR = "#{DOT_DIR}/repos"
4
- SRC_DIR = "#{DOT_DIR}/src"
5
- VIMS_DIR = "#{DOT_DIR}/vims"
6
1
  VIM_URI = 'https://vim.googlecode.com/hg/'
@@ -1,48 +1,15 @@
1
1
  require 'fileutils'
2
2
 
3
3
  class Installer
4
- include Validator
5
4
 
6
- def initialize(version, conf = nil)
5
+ def initialize(version, conf = [])
7
6
  @version = version
8
7
  @conf = conf
9
8
  end
10
9
 
11
- def install
12
- fetch
13
- checkout
14
- configure
15
- make_install
16
- cp_etc
17
-
18
- print "\e[32m"
19
- puts <<-EOS
20
-
21
- Vim is successfully installed. For daily use,
22
- please add the following line into your ~/.bash_login etc:
23
-
24
- test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
25
-
26
- EOS
27
- print "\e[0m"
28
- end
29
-
30
- def rebuild
31
- make_clean
32
- configure
33
- make_install
34
-
35
- print "\e[32m"
36
- puts <<-EOS
37
-
38
- Vim is successfully rebuilded.
39
- EOS
40
- print "\e[0m"
41
- end
42
-
43
10
  def fetch
44
- FileUtils.mkdir_p(REPOS_DIR)
45
- repos_dir = get_repos_dir
11
+ FileUtils.mkdir_p(get_repos_dir)
12
+ repos_dir = get_vimorg_dir
46
13
  unless Dir.exists?(repos_dir)
47
14
  system("hg clone #{VIM_URI} #{repos_dir}")
48
15
  end
@@ -50,11 +17,11 @@ Vim is successfully rebuilded.
50
17
  end
51
18
 
52
19
  def checkout
53
- FileUtils.mkdir_p(SRC_DIR)
54
- repos_dir = get_repos_dir
55
- src_dir = get_src_dir(@version)
56
- unless Dir.exists?(src_dir)
57
- system("cd #{repos_dir} && hg archive -t tar -r #{@version} -p #{@version} - | (cd #{SRC_DIR} && tar xf -)")
20
+ repos_dir = get_vimorg_dir
21
+ src_dir = get_src_dir
22
+ FileUtils.mkdir_p(src_dir)
23
+ unless Dir.exists?(get_src_dir(@version))
24
+ system("cd #{repos_dir} && hg archive -t tar -r #{@version} -p #{@version} - | (cd #{src_dir} && tar xf -)")
58
25
  end
59
26
  end
60
27
 
@@ -83,30 +50,10 @@ Vim is successfully rebuilded.
83
50
 
84
51
  def cp_etc
85
52
  unless File.exists?(get_login_file)
86
- FileUtils.mkdir_p(ETC_DIR)
87
-
53
+ etc_dir = get_etc_dir
54
+ FileUtils.mkdir_p(etc_dir)
88
55
  login = File.expand_path(File.dirname(__FILE__) + '/../../etc/login')
89
- FileUtils.cp(login, ETC_DIR)
56
+ FileUtils.cp(login, etc_dir)
90
57
  end
91
58
  end
92
-
93
- before(:fetch, :checkout) { validations }
94
-
95
- private
96
-
97
- def get_repos_dir
98
- return "#{REPOS_DIR}/vimorg"
99
- end
100
-
101
- def get_src_dir(version)
102
- return "#{SRC_DIR}/#{version}"
103
- end
104
-
105
- def get_vims_dir(version)
106
- return "#{VIMS_DIR}/#{version}"
107
- end
108
-
109
- def get_login_file
110
- return "#{ETC_DIR}/login"
111
- end
112
59
  end
@@ -6,7 +6,7 @@ class Switcher
6
6
  end
7
7
 
8
8
  def use
9
- current = get_current
9
+ current = get_current_dir
10
10
  if Dir.exists?(current)
11
11
  FileUtils.rm(current)
12
12
  end
@@ -18,14 +18,4 @@ class Switcher
18
18
  FileUtils.ln_s(vims_dir, current)
19
19
  end
20
20
  end
21
-
22
- private
23
-
24
- def get_current
25
- return "#{VIMS_DIR}/current"
26
- end
27
-
28
- def get_vims_dir(version)
29
- return "#{VIMS_DIR}/#{version}"
30
- end
31
21
  end
@@ -6,7 +6,7 @@ class Uninstaller
6
6
  end
7
7
 
8
8
  def uninstall
9
- current = get_current
9
+ current = get_current_dir
10
10
  vims_dir = get_vims_dir(@version)
11
11
  src_dir = get_src_dir(@version)
12
12
  if Dir.exists?(current)
@@ -22,18 +22,4 @@ class Uninstaller
22
22
  FileUtils.rm_rf(vims_dir)
23
23
  end
24
24
  end
25
-
26
- private
27
-
28
- def get_current
29
- return "#{VIMS_DIR}/current"
30
- end
31
-
32
- def get_vims_dir(version)
33
- return "#{VIMS_DIR}/#{version}"
34
- end
35
-
36
- def get_src_dir(version)
37
- return "#{SRC_DIR}/#{version}"
38
- end
39
25
  end
@@ -4,7 +4,7 @@ module Validator
4
4
  end
5
5
 
6
6
  module ClassMethods
7
- def before(*names)
7
+ def before_method(*names)
8
8
  names.each do |name|
9
9
  m = instance_method(name)
10
10
  define_method(name) do |*args, &block|
@@ -19,8 +19,9 @@ module Validator
19
19
  end
20
20
 
21
21
  def check_hg
22
- `hg --version`
23
- abort 'mercurial is required to install.' unless $?.success?
22
+ unless Kernel.system('hg --version > /dev/null')
23
+ abort 'mercurial is required to install.'
24
+ end
24
25
  return true
25
26
  end
26
27
  end
@@ -0,0 +1,14 @@
1
+ class Version
2
+ def self.list
3
+ Dir.chdir(get_vimorg_dir) do
4
+ list = `hg tags`.split.reverse
5
+ return list.values_at(* list.each_index.select {|i| i.odd?}).join("\n")
6
+ end
7
+ end
8
+
9
+ def self.versions
10
+ output = []
11
+ Dir.glob(File.join(get_vims_dir, 'v*')).sort.each{ |d| output << File.basename(d) }
12
+ return output.join("\n")
13
+ end
14
+ end
data/lib/vvm-rb.rb CHANGED
@@ -1,6 +1,11 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__)))
2
- require 'vvm-rb/cli'
1
+ require 'vvm-rb/constants'
3
2
  require 'vvm-rb/installer'
4
3
  require 'vvm-rb/uninstaller'
5
4
  require 'vvm-rb/switcher'
6
5
  require 'vvm-rb/validator'
6
+ require 'vvm-rb/accesser'
7
+ require 'vvm-rb/version'
8
+
9
+ module VvmRb
10
+ include Accesser
11
+ end
@@ -1,15 +1,15 @@
1
- require 'fileutils'
2
1
  require 'spec_helper'
3
2
 
4
3
  describe 'Installer' do
5
4
  describe 'install' do
6
5
  before :all do
7
- Cli.start('uninstall v7-3-969'.split)
8
- Cli.start('uninstall v7-4'.split)
9
- FileUtils.rm_rf(REPOS_DIR)
10
- FileUtils.rm_rf(ETC_DIR)
6
+ FileUtils.rm_rf(get_src_dir)
7
+ FileUtils.rm_rf(get_vims_dir)
8
+ FileUtils.rm_rf(get_repos_dir)
9
+ FileUtils.rm_rf(get_etc_dir)
11
10
  @version = 'v7-4'
12
- @installer = Installer.new(@version, [])
11
+ @installer = Installer.new(@version)
12
+ @installer.dot_dir = @vvm_tmp
13
13
  end
14
14
 
15
15
  context 'fetch' do
@@ -18,7 +18,7 @@ describe 'Installer' do
18
18
  end
19
19
 
20
20
  it 'exists vimorg dir' do
21
- expect(Dir.exists?("#{REPOS_DIR}/vimorg")).to be_true
21
+ expect(Dir.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(Dir.exists?("#{SRC_DIR}/#{@version}")).to be_true
31
+ expect(Dir.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(Dir.exists?("#{VIMS_DIR}/#{@version}")).to be_true
42
+ expect(Dir.exists?(get_vims_dir(@version))).to be_true
43
43
  end
44
44
  end
45
45
 
@@ -49,11 +49,11 @@ describe 'Installer' do
49
49
  end
50
50
 
51
51
  it 'exists etc dir' do
52
- expect(Dir.exists?(ETC_DIR)).to be_true
52
+ expect(Dir.exists?(get_etc_dir)).to be_true
53
53
  end
54
54
 
55
55
  it 'exists login file' do
56
- expect(File.exists?("#{ETC_DIR}/login")).to be_true
56
+ expect(File.exists?(get_login_file)).to be_true
57
57
  end
58
58
  end
59
59
  end
@@ -61,7 +61,8 @@ describe 'Installer' do
61
61
  describe 'rebuild' do
62
62
  before :all do
63
63
  @version = 'v7-4'
64
- @installer = Installer.new(@version, [])
64
+ @installer = Installer.new(@version)
65
+ @installer.dot_dir = @vvm_tmp
65
66
  end
66
67
 
67
68
  context 'make_clean' do
@@ -70,7 +71,7 @@ describe 'Installer' do
70
71
  end
71
72
 
72
73
  it 'not exists objects dir' do
73
- expect(Dir["#{SRC_DIR}/#{@version}/src/objects/*"].empty?).to be_true
74
+ expect(Dir["#{get_src_dir(@version)}/src/objects/*"].empty?).to be_true
74
75
  end
75
76
  end
76
77
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,10 @@
1
1
  require 'simplecov'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ SimpleCov::Formatter::HTMLFormatter,
6
+ Coveralls::SimpleCov::Formatter
7
+ ]
2
8
  SimpleCov.start do
3
9
  add_filter '/spec/'
4
10
  end
@@ -9,63 +15,35 @@ require 'rspec'
9
15
  require 'fileutils'
10
16
  require 'tmpdir'
11
17
  require 'vvm-rb'
18
+ include VvmRb
12
19
 
13
20
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
14
21
 
15
22
  RSpec.configure do |config|
16
23
  config.before :suite do
17
- clear_consts
18
- CACHE_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '.vvm_cache'))
19
- DOT_DIR = CACHE_DIR
20
- ETC_DIR = "#{DOT_DIR}/etc"
21
- REPOS_DIR = "#{DOT_DIR}/repos"
22
- SRC_DIR = "#{DOT_DIR}/src"
23
- VIMS_DIR = "#{DOT_DIR}/vims"
24
- VIM_URI = 'https://vim.googlecode.com/hg/'
25
- unless Dir.exists?(CACHE_DIR)
26
- FileUtils.mkdir_p(CACHE_DIR)
27
- Cli.start('install v7-3-969'.split)
28
- Cli.start('install v7-4'.split)
24
+ cache_dir = get_cache_dir
25
+ unless Dir.exists?(cache_dir)
26
+ FileUtils.mkdir_p(cache_dir)
27
+ %w{ v7-3-969 v7-4 }.each do |v|
28
+ i = Installer.new(v)
29
+ i.dot_dir = cache_dir
30
+ i.fetch
31
+ i.checkout
32
+ i.configure
33
+ i.make_install
34
+ i.cp_etc
35
+ end
29
36
  end
30
37
  end
31
38
 
32
39
  config.before :all do
33
- clear_consts
34
40
  @tmp = Dir.mktmpdir
35
- FileUtils.cp_r(CACHE_DIR, @tmp)
36
- DOT_DIR = File.expand_path(File.join(@tmp, '.vvm_cache'))
37
- ETC_DIR = "#{DOT_DIR}/etc"
38
- REPOS_DIR = "#{DOT_DIR}/repos"
39
- SRC_DIR = "#{DOT_DIR}/src"
40
- VIMS_DIR = "#{DOT_DIR}/vims"
41
+ FileUtils.cp_r(get_cache_dir, @tmp)
42
+ @vvm_tmp = File.expand_path(File.join(@tmp, '.vvm_cache'))
43
+ self.dot_dir = @vvm_tmp
41
44
  end
42
45
 
43
46
  config.after :all do
44
47
  FileUtils.rm_rf(@tmp)
45
48
  end
46
49
  end
47
-
48
- def clear_consts
49
- %w{
50
- DOT_DIR
51
- ETC_DIR
52
- REPOS_DIR
53
- SRC_DIR
54
- VIMS_DIR
55
- }.each do |c|
56
- const = c.to_sym
57
- Object.send(:remove_const, const) if Object.const_defined?(const)
58
- end
59
- end
60
-
61
- def capture(stream)
62
- begin
63
- stream = stream.to_s
64
- eval "$#{stream} = StringIO.new"
65
- yield
66
- result = eval("$#{stream}").string
67
- ensure
68
- eval("$#{stream} = #{stream.upcase}")
69
- end
70
- result
71
- end
@@ -5,20 +5,23 @@ describe 'Switcher' do
5
5
  context 'system vim' do
6
6
  before :all do
7
7
  switcher = Switcher.new('system')
8
+ switcher.dot_dir = @vvm_tmp
8
9
  switcher.use
9
10
  end
10
11
 
11
12
  it 'delete current' do
12
- expect(Dir.exists?("#{VIMS_DIR}/current")).not_to be_true
13
+ expect(Dir.exists?(get_current_dir)).not_to be_true
13
14
  end
14
15
  end
15
16
 
16
17
  context 'different version' do
17
18
  before :all do
18
- switcher = Switcher.new('v7-4')
19
+ version = 'v7-4'
20
+ switcher = Switcher.new(version)
21
+ switcher.dot_dir = @vvm_tmp
19
22
  switcher.use
20
- @vims_dir = "#{VIMS_DIR}/v7-4"
21
- @current = "#{VIMS_DIR}/current"
23
+ @vims_dir = get_vims_dir(version)
24
+ @current = get_current_dir
22
25
  end
23
26
 
24
27
  it 'exist current' do
@@ -33,6 +36,7 @@ describe 'Switcher' do
33
36
  context 'unknown version' do
34
37
  before :all do
35
38
  @switcher = Switcher.new('v7-5')
39
+ @switcher.dot_dir = @vvm_tmp
36
40
  end
37
41
 
38
42
  it 'raise error' do
@@ -4,8 +4,12 @@ describe 'Uninstaller' do
4
4
  describe 'uninstall' do
5
5
  context 'vim version is currently used' do
6
6
  before :all do
7
- Cli.start('use v7-4'.split)
8
- @uninstaller = Uninstaller.new('v7-4')
7
+ version = 'v7-4'
8
+ s = Switcher.new(version)
9
+ s.dot_dir = @vvm_tmp
10
+ s.use
11
+ @uninstaller = Uninstaller.new(version)
12
+ @uninstaller.dot_dir = @vvm_tmp
9
13
  end
10
14
 
11
15
  it 'raise error' do
@@ -17,15 +21,16 @@ describe 'Uninstaller' do
17
21
  before :all do
18
22
  @version = 'v7-3-969'
19
23
  @uninstaller = Uninstaller.new(@version)
24
+ @uninstaller.dot_dir = @vvm_tmp
20
25
  @uninstaller.uninstall
21
26
  end
22
27
 
23
28
  it 'delete src dir' do
24
- expect(Dir.exists?("#{SRC_DIR}/#{@version}")).not_to be_true
29
+ expect(Dir.exists?(get_src_dir(@version))).not_to be_true
25
30
  end
26
31
 
27
32
  it 'delete vims dir' do
28
- expect(Dir.exists?("#{VIMS_DIR}/#{@version}")).not_to be_true
33
+ expect(Dir.exists?(get_vims_dir(@version))).not_to be_true
29
34
  end
30
35
  end
31
36
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ include Validator
3
+
4
+ describe 'Validator' do
5
+ def dummy_method ; end
6
+ before_method(:dummy_method) { validations }
7
+
8
+ describe 'check_hg' do
9
+ context 'hg is installed' do
10
+ before do
11
+ Kernel.stub(:system).and_return(true)
12
+ end
13
+
14
+ it 'success to run the method' do
15
+ expect(dummy_method).to be_nil
16
+ end
17
+ end
18
+
19
+ context 'hg is not installed' do
20
+ before do
21
+ Kernel.stub(:system).and_return(false)
22
+ end
23
+
24
+ it 'cannot run the method' do
25
+ expect(proc { dummy_method }).to raise_error
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Version' do
4
+ before :all do
5
+ Version.dot_dir = @vvm_tmp
6
+ end
7
+
8
+ describe 'list' do
9
+ it 'echo available vim versions' do
10
+ expect(Version.list).to match(/start\n(v7-.+\n)+tip$/)
11
+ end
12
+ end
13
+
14
+ describe 'versions' do
15
+ it 'echo installed vim versions' do
16
+ expect(Version.versions).to eq("v7-3-969\nv7-4")
17
+ end
18
+ end
19
+ 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.3 ruby lib
5
+ # stub: vvm-rb 0.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vvm-rb"
9
- s.version = "0.0.3"
9
+ s.version = "0.0.4"
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-09-24"
13
+ s.date = "2013-10-04"
14
14
  s.description = "vim version manager."
15
15
  s.email = "s2g4t1n2@gmail.com"
16
16
  s.executables = ["vvm-rb"]
@@ -19,8 +19,10 @@ Gem::Specification.new do |s|
19
19
  "README.rdoc"
20
20
  ]
21
21
  s.files = [
22
+ ".coveralls.yml",
22
23
  ".document",
23
24
  ".rspec",
25
+ ".travis.yml",
24
26
  "Gemfile",
25
27
  "LICENSE.txt",
26
28
  "README.rdoc",
@@ -29,24 +31,27 @@ Gem::Specification.new do |s|
29
31
  "bin/vvm-rb",
30
32
  "etc/login",
31
33
  "lib/vvm-rb.rb",
34
+ "lib/vvm-rb/accesser.rb",
32
35
  "lib/vvm-rb/cli.rb",
33
36
  "lib/vvm-rb/constants.rb",
34
37
  "lib/vvm-rb/installer.rb",
35
38
  "lib/vvm-rb/switcher.rb",
36
39
  "lib/vvm-rb/uninstaller.rb",
37
40
  "lib/vvm-rb/validator.rb",
38
- "spec/cli_spec.rb",
41
+ "lib/vvm-rb/version.rb",
39
42
  "spec/installer_spec.rb",
40
43
  "spec/spec_helper.rb",
41
44
  "spec/switcher_spec.rb",
42
45
  "spec/uninstaller_spec.rb",
46
+ "spec/validator_spec.rb",
47
+ "spec/version_spec.rb",
43
48
  "spec/vvm-rb_spec.rb",
44
49
  "vvm-rb.gemspec"
45
50
  ]
46
51
  s.homepage = "http://github.com/calorie/vvm-rb"
47
52
  s.licenses = ["MIT"]
48
53
  s.require_paths = ["lib"]
49
- s.rubygems_version = "2.1.3"
54
+ s.rubygems_version = "2.1.5"
50
55
  s.summary = "vim version manager"
51
56
 
52
57
  if s.respond_to? :specification_version then
@@ -60,6 +65,7 @@ Gem::Specification.new do |s|
60
65
  s.add_development_dependency(%q<bundler>, [">= 0"])
61
66
  s.add_development_dependency(%q<jeweler>, [">= 0"])
62
67
  s.add_development_dependency(%q<simplecov>, [">= 0"])
68
+ s.add_development_dependency(%q<coveralls>, [">= 0"])
63
69
  else
64
70
  s.add_dependency(%q<rake>, [">= 0"])
65
71
  s.add_dependency(%q<thor>, [">= 0"])
@@ -68,6 +74,7 @@ Gem::Specification.new do |s|
68
74
  s.add_dependency(%q<bundler>, [">= 0"])
69
75
  s.add_dependency(%q<jeweler>, [">= 0"])
70
76
  s.add_dependency(%q<simplecov>, [">= 0"])
77
+ s.add_dependency(%q<coveralls>, [">= 0"])
71
78
  end
72
79
  else
73
80
  s.add_dependency(%q<rake>, [">= 0"])
@@ -77,6 +84,7 @@ Gem::Specification.new do |s|
77
84
  s.add_dependency(%q<bundler>, [">= 0"])
78
85
  s.add_dependency(%q<jeweler>, [">= 0"])
79
86
  s.add_dependency(%q<simplecov>, [">= 0"])
87
+ s.add_dependency(%q<coveralls>, [">= 0"])
80
88
  end
81
89
  end
82
90
 
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.3
4
+ version: 0.0.4
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-09-24 00:00:00.000000000 Z
11
+ date: 2013-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: coveralls
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: vim version manager.
112
126
  email: s2g4t1n2@gmail.com
113
127
  executables:
@@ -117,8 +131,10 @@ extra_rdoc_files:
117
131
  - LICENSE.txt
118
132
  - README.rdoc
119
133
  files:
134
+ - .coveralls.yml
120
135
  - .document
121
136
  - .rspec
137
+ - .travis.yml
122
138
  - Gemfile
123
139
  - LICENSE.txt
124
140
  - README.rdoc
@@ -127,17 +143,20 @@ files:
127
143
  - bin/vvm-rb
128
144
  - etc/login
129
145
  - lib/vvm-rb.rb
146
+ - lib/vvm-rb/accesser.rb
130
147
  - lib/vvm-rb/cli.rb
131
148
  - lib/vvm-rb/constants.rb
132
149
  - lib/vvm-rb/installer.rb
133
150
  - lib/vvm-rb/switcher.rb
134
151
  - lib/vvm-rb/uninstaller.rb
135
152
  - lib/vvm-rb/validator.rb
136
- - spec/cli_spec.rb
153
+ - lib/vvm-rb/version.rb
137
154
  - spec/installer_spec.rb
138
155
  - spec/spec_helper.rb
139
156
  - spec/switcher_spec.rb
140
157
  - spec/uninstaller_spec.rb
158
+ - spec/validator_spec.rb
159
+ - spec/version_spec.rb
141
160
  - spec/vvm-rb_spec.rb
142
161
  - vvm-rb.gemspec
143
162
  homepage: http://github.com/calorie/vvm-rb
@@ -160,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
179
  version: '0'
161
180
  requirements: []
162
181
  rubyforge_project:
163
- rubygems_version: 2.1.3
182
+ rubygems_version: 2.1.5
164
183
  signing_key:
165
184
  specification_version: 4
166
185
  summary: vim version manager
data/spec/cli_spec.rb DELETED
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Cli' do
4
- describe 'install' do
5
- let(:output) { capture(:stdout) { Cli.start('install v7-4-001'.split)} }
6
-
7
- it 'success' do
8
- expect(output).to match(/Vim is successfully installed/)
9
- end
10
- end
11
-
12
- describe 'reinstall' do
13
- let(:output) { capture(:stdout) { Cli.start('reinstall v7-4-001'.split)} }
14
-
15
- it 'success' do
16
- expect(output).to match(/Vim is successfully installed/)
17
- end
18
- end
19
-
20
- describe 'rebuild' do
21
- let(:output) { capture(:stdout) { Cli.start('rebuild v7-4-001'.split)} }
22
-
23
- it 'success' do
24
- expect(output).to match(/Vim is successfully rebuilded/)
25
- end
26
- end
27
-
28
- describe 'use' do
29
- let(:output) { capture(:stdout) { Cli.start('use v7-4'.split)} }
30
-
31
- it 'success' do
32
- expect(output).to eq('')
33
- end
34
- end
35
-
36
- describe 'uninstall' do
37
- let(:output) { capture(:stdout) { Cli.start('uninstall v7-3-969'.split)} }
38
-
39
- it 'success' do
40
- expect(output).to eq('')
41
- end
42
- end
43
- end