vvm-rb 1.0.4 → 1.0.5

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: 32c51f21af48612f2f8c9555e5e9c9622c9470f0
4
- data.tar.gz: 8ef8927b47f61441d738b544856a7961f7553738
3
+ metadata.gz: 755c774b73d58d917c74b88af6e7754aa10412a6
4
+ data.tar.gz: 2f095924c9429d711f559812f79f805ff96ef44c
5
5
  SHA512:
6
- metadata.gz: b0a57c971bd69c88fcca3fdfc8df79b57d097e518ddf7dd2d3dd19ced076347e4771edb5c33630228e255b6321d16038791319a9e536ee33fee9a4418c96005a
7
- data.tar.gz: 07dbc860185e3158c12b0d294eee2968e33de91bfa5411c98ebf92f207a32ad59bc6dbd2df2ff2fce1391fd95bb66881e7d4215c4c231cdcccb47a28b4660524
6
+ metadata.gz: ef4019d4ab749de4ef027487e8c3b17de6d6f9364c91f79974c26e86fe0d4135083013c3b7d28c7b3daaf49201a7728710d8367410a06d60589263a9838d29af
7
+ data.tar.gz: 6d0eec7ce158aa3e07ac6285b7af50a7cfc3d144aa7b1010b3639905773535a99d2ad03c6985ce0268935cd1b786d4e0d3819722abe2bc246315953000960c82
data/README.rdoc CHANGED
@@ -1,10 +1,11 @@
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]
3
+ {<img src="https://img.shields.io/gem/v/vvm-rb.svg" alt="Gem Version" />}[http://badge.fury.io/rb/vvm-rb]
4
+ {<img src="https://img.shields.io/gemnasium/calorie/vvm-rb.svg" alt="Dependency Status" />}[https://gemnasium.com/calorie/vvm-rb]
5
+ {<img src="https://img.shields.io/travis/calorie/vvm-rb.svg" />}[https://travis-ci.org/calorie/vvm-rb]
6
+ {<img src="https://img.shields.io/coveralls/calorie/vvm-rb.svg" alt="Coverage Status" />}[https://coveralls.io/r/calorie/vvm-rb]
7
+ {<img src="https://img.shields.io/codeclimate/github/calorie/vvm-rb.svg" />}[https://codeclimate.com/github/calorie/vvm-rb]
8
+ {<img src="http://img.shields.io/badge/license-MIT-brightgreen.svg" />}[https://raw.githubusercontent.com/calorie/vvm-rb/master/LICENSE.txt]
8
9
 
9
10
 
10
11
  vim version manager : forked from https://github.com/kana/vim-version-manager
@@ -24,7 +25,7 @@ or
24
25
  $ bundle install
25
26
  $ rake install
26
27
 
27
- == Usage
28
+ == Setup
28
29
  please add the following line into your ~/.bash_login etc:
29
30
 
30
31
  test -f ~/.vvm-rb/etc/login && source ~/.vvm-rb/etc/login
@@ -38,7 +39,7 @@ you can set your default options of configure:
38
39
 
39
40
  export VVMOPT="--enable-rubyinterp --enable-pythoninterp"
40
41
 
41
- == Commands Examples
42
+ == Usage
42
43
 
43
44
  $ vvm help
44
45
  $ vvm install 7.4.103 --enable-rubyinterp
@@ -51,7 +52,7 @@ you can set your default options of configure:
51
52
  $ vvm uninstall 7.4.103
52
53
  $ vvm update
53
54
 
54
- after use command, you have to reload shell:
55
+ after `vvm use`, you have to reload shell:
55
56
 
56
57
  $ exec $SHELL
57
58
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
data/lib/vvm/cli.rb CHANGED
@@ -13,15 +13,14 @@ module Vvm
13
13
  i.configure
14
14
  i.make_install
15
15
  Installer.cp_etc
16
-
17
16
  invoke :use, [version], {} if options[:use]
18
17
  i.message
19
18
  end
20
19
 
21
20
  desc 'update', 'Update to latest version of Vim'
22
21
  def update
23
- current = Version.current
24
- if current == 'system'
22
+ Installer.pull
23
+ if (current = Version.current) == 'system'
25
24
  run 'vvm install --use latest'
26
25
  run 'vvm use system' unless $?.success?
27
26
  else
@@ -53,6 +52,7 @@ module Vvm
53
52
 
54
53
  desc 'list', 'Look available versions of Vim.'
55
54
  def list
55
+ Installer.pull
56
56
  puts Version.list.join("\n")
57
57
  end
58
58
 
@@ -69,8 +69,6 @@ module Vvm
69
69
  no_commands do
70
70
  def invoke_command(command, *args)
71
71
  validate_before_invoke(command.name)
72
- Installer.fetch unless File.exist?(vimorg_dir)
73
- Installer.pull if %w(install list).include?(command.name)
74
72
  super
75
73
  end
76
74
  end
data/lib/vvm/installer.rb CHANGED
@@ -16,6 +16,7 @@ module Vvm
16
16
  end
17
17
 
18
18
  def self.pull
19
+ fetch unless File.exist?(vimorg_dir)
19
20
  Dir.chdir(vimorg_dir) { system('hg -q pull') }
20
21
  end
21
22
 
data/lib/vvm/validator.rb CHANGED
@@ -6,7 +6,7 @@ module Vvm
6
6
 
7
7
  def validate_before_invoke(command)
8
8
  version? if %w(install rebuild use uninstall).include?(command)
9
- hg? if %w(install reinstall rebuild list).include?(command)
9
+ hg? if %w(install reinstall rebuild list update).include?(command)
10
10
  new_version? if command == 'install'
11
11
  installed_version? if %w(reinstall rebuild use uninstall).include?(command)
12
12
  end
@@ -21,7 +21,9 @@ module Vvm
21
21
  true
22
22
  end
23
23
 
24
- def new_version?(ver = version)
24
+ def new_version?(ver = nil)
25
+ Installer.pull
26
+ ver = version if ver.nil?
25
27
  abort "#{ver} is already installed." if version_include?(ver)
26
28
  true
27
29
  end
data/lib/vvm/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Vvm
2
2
  class Version
3
3
  def self.list
4
- Installer.fetch unless File.exist?(vimorg_dir)
4
+ abort "#{vimorg_dir} not found." unless File.exist?(vimorg_dir)
5
5
  Dir.chdir(vimorg_dir) do
6
6
  list = `hg tags`.split.reverse
7
7
  return list.values_at(* list.each_index.select(&:odd?))
@@ -31,6 +31,12 @@ describe 'Installer', disable_cache: true do
31
31
  context 'pull', clean: true, vimorg: true do
32
32
  before :all do
33
33
  Dir.chdir(vimorg_dir) { system('hg rollback') }
34
+ end
35
+
36
+ it 'vimorg_dir not found' do
37
+ allow(File).to receive(:exist?).with(vimorg_dir).and_return(false)
38
+ allow(Vvm::Installer).to receive(:fetch).and_return(true)
39
+ expect(Vvm::Installer).to receive(:fetch)
34
40
  Vvm::Installer.pull
35
41
  end
36
42
 
@@ -133,6 +133,10 @@ describe 'Validator' do
133
133
  end
134
134
 
135
135
  describe 'new_version?' do
136
+ before do
137
+ allow(Vvm::Installer).to receive(:pull).and_return(true)
138
+ end
139
+
136
140
  context 'with arg' do
137
141
  context 'new version' do
138
142
  it 'success to run the method' do
data/spec/version_spec.rb CHANGED
@@ -4,8 +4,12 @@ require 'tmpdir'
4
4
 
5
5
  describe 'Version' do
6
6
  describe 'list' do
7
+ it 'vimorg_dir not found' do
8
+ allow(File).to receive(:exist?).and_return(false)
9
+ expect(proc { Vvm::Version.list }).to raise_error
10
+ end
11
+
7
12
  it 'echo available vim versions' do
8
- FileUtils.rm_rf(vimorg_dir) if File.exist?(vimorg_dir)
9
13
  expect(Vvm::Version.list.join("\n")).to match(/\Astart\n(v7-.+\n)+tip\z/)
10
14
  end
11
15
  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.4 ruby lib
5
+ # stub: vvm-rb 1.0.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vvm-rb"
9
- s.version = "1.0.4"
9
+ s.version = "1.0.5"
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-21"
14
+ s.date = "2015-02-27"
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
4
+ version: 1.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: 2015-02-21 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor