vvm-rb 1.0.5 → 1.0.6

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: 755c774b73d58d917c74b88af6e7754aa10412a6
4
- data.tar.gz: 2f095924c9429d711f559812f79f805ff96ef44c
3
+ metadata.gz: e08c72a5b27ed92131730f671b43e6ec6f61f480
4
+ data.tar.gz: f16fa32a4e6ad7a062b07b473bfa7ac4665851d0
5
5
  SHA512:
6
- metadata.gz: ef4019d4ab749de4ef027487e8c3b17de6d6f9364c91f79974c26e86fe0d4135083013c3b7d28c7b3daaf49201a7728710d8367410a06d60589263a9838d29af
7
- data.tar.gz: 6d0eec7ce158aa3e07ac6285b7af50a7cfc3d144aa7b1010b3639905773535a99d2ad03c6985ce0268935cd1b786d4e0d3819722abe2bc246315953000960c82
6
+ metadata.gz: 02f5817f4248013fc4e6fabeddeab196851e10c7bf4b4ae60fce0fc5f77df871f9b9324831befb1a8fc5181804c77535cc6386e4a84bb61e635d79bb4c21fbe1
7
+ data.tar.gz: 371b7bb3c16c0f358696f851a9975cbb156dde7a9699b9872f4c8d6911977b6f94f766fbe7fa44a1426ae817a8f96b130dce1b291f37ae43ef4499ec58ff5cf2
data/.rubocop.yml CHANGED
@@ -15,3 +15,5 @@ Documentation:
15
15
  Enabled: false
16
16
  SpecialGlobalVars:
17
17
  Enabled: false
18
+ AssignmentInCondition:
19
+ Enabled: false
data/Gemfile CHANGED
@@ -9,4 +9,8 @@ group :development do
9
9
  gem 'jeweler', '~> 2.0'
10
10
  gem 'simplecov', '~> 0.9.2'
11
11
  gem 'coveralls', '~> 0.7.10', require: false
12
+
13
+ platforms :ruby_19 do
14
+ gem 'tins', '~> 1.6.0'
15
+ end
12
16
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
data/lib/vvm/constants.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vvm
2
- VIM_URI = 'https://vim.googlecode.com/hg/'
2
+ VIM_URI = 'https://bitbucket.org/vim-mirror/vim'
3
3
  end
data/lib/vvm/validator.rb CHANGED
@@ -2,13 +2,21 @@ require 'mkmf'
2
2
 
3
3
  module Vvm
4
4
  module Validator
5
+ METHOD_MAP = {
6
+ install: %w(version? hg? new_version?),
7
+ update: %w(hg?),
8
+ reinstall: %w(hg? installed_version?),
9
+ rebuild: %w(version? hg? installed_version?),
10
+ use: %w(version? installed_version?),
11
+ list: %w(hg?),
12
+ uninstall: %w(version? installed_version?)
13
+ }
14
+
5
15
  module_function
6
16
 
7
17
  def validate_before_invoke(command)
8
- version? if %w(install rebuild use uninstall).include?(command)
9
- hg? if %w(install reinstall rebuild list update).include?(command)
10
- new_version? if command == 'install'
11
- installed_version? if %w(reinstall rebuild use uninstall).include?(command)
18
+ return unless validations = METHOD_MAP[command.to_sym]
19
+ validations.each { |m| send(m) }
12
20
  end
13
21
 
14
22
  def hg?
@@ -36,8 +44,8 @@ module Vvm
36
44
  private
37
45
 
38
46
  def find_version
39
- version_regex = /\Av7-.+\z|\A(\d\.\d(a|b){0,1}(\.\d+){0,1})\z/
40
- regex = /(\Astart\z|\Atip\z|\Asystem\z|\Alatest\z|#{version_regex})/
47
+ version_regex = /\Av7\..+\z|\A(\d\.\d(a|b){0,1}(\.\d+){0,1})\z/
48
+ regex = /(\Atip\z|\Asystem\z|\Alatest\z|#{version_regex})/
41
49
  $*.find { |v| v =~ regex }
42
50
  end
43
51
 
data/lib/vvm/version.rb CHANGED
@@ -19,7 +19,7 @@ module Vvm
19
19
  end
20
20
 
21
21
  def self.latest
22
- list.select { |v| v =~ /\Av7-.+\z/ }.last
22
+ list.select { |v| v =~ /\Av7\..+\z/ }.last
23
23
  end
24
24
 
25
25
  def self.current
@@ -28,7 +28,7 @@ module Vvm
28
28
  end
29
29
 
30
30
  def self.convert(version)
31
- "v#{version.gsub(/\./, '-')}"
31
+ "v#{version}"
32
32
  end
33
33
 
34
34
  def self.format(version)
data/spec/spec_helper.rb CHANGED
@@ -16,7 +16,7 @@ require 'fileutils'
16
16
  require 'tmpdir'
17
17
  require 'vvm'
18
18
 
19
- VERSION1, VERSION2 = 'v7-4-083', 'v7-4-103'
19
+ VERSION1, VERSION2 = 'v7.4.083', 'v7.4.103'
20
20
 
21
21
  # [todo] - test is too slow
22
22
 
@@ -31,7 +31,7 @@ describe 'Switcher' do
31
31
 
32
32
  context 'unknown version' do
33
33
  before :all do
34
- @switcher = Vvm::Switcher.new('v7-5')
34
+ @switcher = Vvm::Switcher.new('v7.5')
35
35
  end
36
36
 
37
37
  it 'raise error' do
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe 'Validator' do
4
4
  include Vvm::Validator
5
5
 
6
- NEW_VERSION = 'v7-4-050'
6
+ NEW_VERSION = 'v7.4.050'
7
7
 
8
8
  describe 'validate_before_invoke' do
9
9
  before do
@@ -14,11 +14,6 @@ describe 'Validator' do
14
14
  end
15
15
 
16
16
  context 'install' do
17
- it 'new_version?' do
18
- expect(Vvm::Validator).to receive(:new_version?).with(no_args)
19
- Vvm::Validator.validate_before_invoke('install')
20
- end
21
-
22
17
  it 'version?' do
23
18
  expect(Vvm::Validator).to receive(:version?).with(no_args)
24
19
  Vvm::Validator.validate_before_invoke('install')
@@ -28,21 +23,41 @@ describe 'Validator' do
28
23
  expect(Vvm::Validator).to receive(:hg?).with(no_args)
29
24
  Vvm::Validator.validate_before_invoke('install')
30
25
  end
26
+
27
+ it 'new_version?' do
28
+ expect(Vvm::Validator).to receive(:new_version?).with(no_args)
29
+ Vvm::Validator.validate_before_invoke('install')
30
+ end
31
+
32
+ it 'installed_version?' do
33
+ expect(Vvm::Validator).not_to receive(:installed_version?).with(no_args)
34
+ Vvm::Validator.validate_before_invoke('install')
35
+ end
31
36
  end
32
37
 
33
38
  context 'reinstall' do
39
+ it 'version?' do
40
+ expect(Vvm::Validator).not_to receive(:version?).with(no_args)
41
+ Vvm::Validator.validate_before_invoke('reinstall')
42
+ end
43
+
34
44
  it 'hg?' do
35
45
  expect(Vvm::Validator).to receive(:hg?).with(no_args)
36
46
  Vvm::Validator.validate_before_invoke('reinstall')
37
47
  end
38
- end
39
48
 
40
- context 'rebuild' do
49
+ it 'new_version?' do
50
+ expect(Vvm::Validator).not_to receive(:new_version?).with(no_args)
51
+ Vvm::Validator.validate_before_invoke('reinstall')
52
+ end
53
+
41
54
  it 'installed_version?' do
42
55
  expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
43
- Vvm::Validator.validate_before_invoke('rebuild')
56
+ Vvm::Validator.validate_before_invoke('reinstall')
44
57
  end
58
+ end
45
59
 
60
+ context 'rebuild' do
46
61
  it 'version?' do
47
62
  expect(Vvm::Validator).to receive(:version?).with(no_args)
48
63
  Vvm::Validator.validate_before_invoke('rebuild')
@@ -52,37 +67,104 @@ describe 'Validator' do
52
67
  expect(Vvm::Validator).to receive(:hg?).with(no_args)
53
68
  Vvm::Validator.validate_before_invoke('rebuild')
54
69
  end
55
- end
56
70
 
57
- context 'use' do
71
+ it 'new_version?' do
72
+ expect(Vvm::Validator).not_to receive(:new_version?).with(no_args)
73
+ Vvm::Validator.validate_before_invoke('rebuild')
74
+ end
75
+
58
76
  it 'installed_version?' do
59
77
  expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
60
- Vvm::Validator.validate_before_invoke('use')
78
+ Vvm::Validator.validate_before_invoke('rebuild')
61
79
  end
80
+ end
62
81
 
82
+ context 'use' do
63
83
  it 'version?' do
64
84
  expect(Vvm::Validator).to receive(:version?).with(no_args)
65
85
  Vvm::Validator.validate_before_invoke('use')
66
86
  end
87
+
88
+ it 'hg?' do
89
+ expect(Vvm::Validator).not_to receive(:hg?).with(no_args)
90
+ Vvm::Validator.validate_before_invoke('use')
91
+ end
92
+
93
+ it 'new_version?' do
94
+ expect(Vvm::Validator).not_to receive(:new_version?).with(no_args)
95
+ Vvm::Validator.validate_before_invoke('use')
96
+ end
97
+
98
+ it 'installed_version?' do
99
+ expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
100
+ Vvm::Validator.validate_before_invoke('use')
101
+ end
67
102
  end
68
103
 
69
104
  context 'list' do
105
+ it 'version?' do
106
+ expect(Vvm::Validator).not_to receive(:version?).with(no_args)
107
+ Vvm::Validator.validate_before_invoke('list')
108
+ end
109
+
70
110
  it 'hg?' do
71
111
  expect(Vvm::Validator).to receive(:hg?).with(no_args)
72
112
  Vvm::Validator.validate_before_invoke('list')
73
113
  end
114
+
115
+ it 'new_version?' do
116
+ expect(Vvm::Validator).not_to receive(:new_version?).with(no_args)
117
+ Vvm::Validator.validate_before_invoke('list')
118
+ end
119
+
120
+ it 'installed_version?' do
121
+ expect(Vvm::Validator).not_to receive(:installed_version?).with(no_args)
122
+ Vvm::Validator.validate_before_invoke('list')
123
+ end
74
124
  end
75
125
 
76
- context 'uninstall' do
126
+ context 'versions' do
127
+ it 'version?' do
128
+ expect(Vvm::Validator).not_to receive(:version?).with(no_args)
129
+ Vvm::Validator.validate_before_invoke('versions')
130
+ end
131
+
132
+ it 'hg?' do
133
+ expect(Vvm::Validator).not_to receive(:hg?).with(no_args)
134
+ Vvm::Validator.validate_before_invoke('versions')
135
+ end
136
+
137
+ it 'new_version?' do
138
+ expect(Vvm::Validator).not_to receive(:new_version?).with(no_args)
139
+ Vvm::Validator.validate_before_invoke('versions')
140
+ end
141
+
77
142
  it 'installed_version?' do
78
- expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
79
- Vvm::Validator.validate_before_invoke('uninstall')
143
+ expect(Vvm::Validator).not_to receive(:installed_version?).with(no_args)
144
+ Vvm::Validator.validate_before_invoke('versions')
80
145
  end
146
+ end
81
147
 
148
+ context 'uninstall' do
82
149
  it 'version?' do
83
150
  expect(Vvm::Validator).to receive(:version?).with(no_args)
84
151
  Vvm::Validator.validate_before_invoke('uninstall')
85
152
  end
153
+
154
+ it 'hg?' do
155
+ expect(Vvm::Validator).not_to receive(:hg?).with(no_args)
156
+ Vvm::Validator.validate_before_invoke('uninstall')
157
+ end
158
+
159
+ it 'new_version?' do
160
+ expect(Vvm::Validator).not_to receive(:new_version?).with(no_args)
161
+ Vvm::Validator.validate_before_invoke('uninstall')
162
+ end
163
+
164
+ it 'installed_version?' do
165
+ expect(Vvm::Validator).to receive(:installed_version?).with(no_args)
166
+ Vvm::Validator.validate_before_invoke('uninstall')
167
+ end
86
168
  end
87
169
  end
88
170
 
data/spec/version_spec.rb CHANGED
@@ -10,7 +10,7 @@ describe 'Version' do
10
10
  end
11
11
 
12
12
  it 'echo available vim versions' do
13
- expect(Vvm::Version.list.join("\n")).to match(/\Astart\n(v7-.+\n)+tip\z/)
13
+ expect(Vvm::Version.list.join("\n")).to match(/\A(v7\..+\n)+tip\z/)
14
14
  end
15
15
  end
16
16
 
@@ -40,7 +40,7 @@ describe 'Version' do
40
40
 
41
41
  describe 'latest' do
42
42
  it 'return latest vim version' do
43
- expect(Vvm::Version.latest).to match(/\Av7-.+\z/)
43
+ expect(Vvm::Version.latest).to match(/\Av7\..+\z/)
44
44
  end
45
45
  end
46
46
 
@@ -62,26 +62,26 @@ describe 'Version' do
62
62
 
63
63
  describe 'convert' do
64
64
  it 'version to tag' do
65
- expect(Vvm::Version.convert('7.4.112')).to eq 'v7-4-112'
65
+ expect(Vvm::Version.convert('7.4.112')).to eq 'v7.4.112'
66
66
  end
67
67
  end
68
68
 
69
69
  describe 'format' do
70
70
  context 'tag' do
71
71
  it 'return formated vim version' do
72
- expect(Vvm::Version.format('v7-4-112')).to eq 'v7-4-112'
72
+ expect(Vvm::Version.format('v7.4.112')).to eq 'v7.4.112'
73
73
  end
74
74
  end
75
75
 
76
76
  context 'dicimal version' do
77
77
  it 'return formated vim version' do
78
- expect(Vvm::Version.format('7.4a.001')).to eq 'v7-4a-001'
78
+ expect(Vvm::Version.format('7.4a.001')).to eq 'v7.4a.001'
79
79
  end
80
80
  end
81
81
 
82
82
  context 'latest' do
83
83
  it 'return latest vim version' do
84
- expect(Vvm::Version.format('latest')).to match(/\Av7-.+\z/)
84
+ expect(Vvm::Version.format('latest')).to match(/\Av7\..+\z/)
85
85
  end
86
86
  end
87
87
  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 ruby lib
5
+ # stub: vvm-rb 1.0.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vvm-rb"
9
- s.version = "1.0.5"
9
+ s.version = "1.0.6"
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-27"
14
+ s.date = "2016-03-20"
15
15
  s.description = "vim version manager."
16
16
  s.email = "s2g4t1n2@gmail.com"
17
17
  s.executables = ["vvm"]
@@ -68,6 +68,7 @@ Gem::Specification.new do |s|
68
68
  s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
69
69
  s.add_development_dependency(%q<simplecov>, ["~> 0.9.2"])
70
70
  s.add_development_dependency(%q<coveralls>, ["~> 0.7.10"])
71
+ s.add_development_dependency(%q<tins>, ["~> 1.6.0"])
71
72
  else
72
73
  s.add_dependency(%q<thor>, ["~> 0.19.1"])
73
74
  s.add_dependency(%q<rspec>, ["~> 3.2"])
@@ -76,6 +77,7 @@ Gem::Specification.new do |s|
76
77
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
77
78
  s.add_dependency(%q<simplecov>, ["~> 0.9.2"])
78
79
  s.add_dependency(%q<coveralls>, ["~> 0.7.10"])
80
+ s.add_dependency(%q<tins>, ["~> 1.6.0"])
79
81
  end
80
82
  else
81
83
  s.add_dependency(%q<thor>, ["~> 0.19.1"])
@@ -85,6 +87,7 @@ Gem::Specification.new do |s|
85
87
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
86
88
  s.add_dependency(%q<simplecov>, ["~> 0.9.2"])
87
89
  s.add_dependency(%q<coveralls>, ["~> 0.7.10"])
90
+ s.add_dependency(%q<tins>, ["~> 1.6.0"])
88
91
  end
89
92
  end
90
93
 
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.5
4
+ version: 1.0.6
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-27 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.7.10
111
+ - !ruby/object:Gem::Dependency
112
+ name: tins
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.6.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.6.0
111
125
  description: vim version manager.
112
126
  email: s2g4t1n2@gmail.com
113
127
  executables: