vvm-rb 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/vvm/validator.rb +9 -6
- data/lib/vvm/version.rb +1 -0
- data/spec/validator_spec.rb +59 -15
- data/spec/version_spec.rb +1 -0
- data/vvm-rb.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32c51f21af48612f2f8c9555e5e9c9622c9470f0
|
4
|
+
data.tar.gz: 8ef8927b47f61441d738b544856a7961f7553738
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0a57c971bd69c88fcca3fdfc8df79b57d097e518ddf7dd2d3dd19ced076347e4771edb5c33630228e255b6321d16038791319a9e536ee33fee9a4418c96005a
|
7
|
+
data.tar.gz: 07dbc860185e3158c12b0d294eee2968e33de91bfa5411c98ebf92f207a32ad59bc6dbd2df2ff2fce1391fd95bb66881e7d4215c4c231cdcccb47a28b4660524
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
data/lib/vvm/validator.rb
CHANGED
@@ -5,10 +5,10 @@ module Vvm
|
|
5
5
|
module_function
|
6
6
|
|
7
7
|
def validate_before_invoke(command)
|
8
|
-
new_version? if command == 'install'
|
9
|
-
installed_version? if %w(reinstall rebuild use uninstall).include?(command)
|
10
8
|
version? if %w(install rebuild use uninstall).include?(command)
|
11
9
|
hg? if %w(install reinstall rebuild list).include?(command)
|
10
|
+
new_version? if command == 'install'
|
11
|
+
installed_version? if %w(reinstall rebuild use uninstall).include?(command)
|
12
12
|
end
|
13
13
|
|
14
14
|
def hg?
|
@@ -17,7 +17,7 @@ module Vvm
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def version?
|
20
|
-
abort 'undefined vim version. please run [ vvm list ].' if
|
20
|
+
abort 'undefined vim version. please run [ vvm list ].' if find_version.nil?
|
21
21
|
true
|
22
22
|
end
|
23
23
|
|
@@ -33,11 +33,14 @@ module Vvm
|
|
33
33
|
|
34
34
|
private
|
35
35
|
|
36
|
-
def
|
36
|
+
def find_version
|
37
37
|
version_regex = /\Av7-.+\z|\A(\d\.\d(a|b){0,1}(\.\d+){0,1})\z/
|
38
38
|
regex = /(\Astart\z|\Atip\z|\Asystem\z|\Alatest\z|#{version_regex})/
|
39
|
-
|
40
|
-
|
39
|
+
$*.find { |v| v =~ regex }
|
40
|
+
end
|
41
|
+
|
42
|
+
def version
|
43
|
+
Version.format(find_version)
|
41
44
|
end
|
42
45
|
|
43
46
|
def version_include?(ver)
|
data/lib/vvm/version.rb
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -108,7 +108,7 @@ describe 'Validator' do
|
|
108
108
|
before(:all) { $* << %w(vvm install) }
|
109
109
|
|
110
110
|
context 'available tag' do
|
111
|
-
before { $*[2] = NEW_VERSION }
|
111
|
+
before(:all) { $*[2] = NEW_VERSION }
|
112
112
|
|
113
113
|
it 'success to run the method' do
|
114
114
|
expect(version?).to be_truthy
|
@@ -116,7 +116,7 @@ describe 'Validator' do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
context 'latest' do
|
119
|
-
before { $*[2] = 'latest' }
|
119
|
+
before(:all) { $*[2] = 'latest' }
|
120
120
|
|
121
121
|
it 'success to run the method' do
|
122
122
|
expect(version?).to be_truthy
|
@@ -124,7 +124,7 @@ describe 'Validator' do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
context 'tag is not available' do
|
127
|
-
before { $*[2] = '--use' }
|
127
|
+
before(:all) { $*[2] = '--use' }
|
128
128
|
|
129
129
|
it 'cannot run the method' do
|
130
130
|
expect(proc { version? }).to raise_error
|
@@ -133,29 +133,73 @@ describe 'Validator' do
|
|
133
133
|
end
|
134
134
|
|
135
135
|
describe 'new_version?' do
|
136
|
-
context '
|
137
|
-
|
138
|
-
|
136
|
+
context 'with arg' do
|
137
|
+
context 'new version' do
|
138
|
+
it 'success to run the method' do
|
139
|
+
expect(new_version?(NEW_VERSION)).to be_truthy
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context 'version is installed' do
|
144
|
+
it 'cannot run the method' do
|
145
|
+
expect(proc { new_version?(VERSION1) }).to raise_error
|
146
|
+
end
|
139
147
|
end
|
140
148
|
end
|
141
149
|
|
142
|
-
context '
|
143
|
-
|
144
|
-
|
150
|
+
context 'without arg' do
|
151
|
+
before(:all) { $* << %w(vvm install) }
|
152
|
+
|
153
|
+
context 'new version' do
|
154
|
+
before(:all) { $*[2] = NEW_VERSION }
|
155
|
+
|
156
|
+
it 'success to run the method' do
|
157
|
+
expect(new_version?).to be_truthy
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context 'version is installed' do
|
162
|
+
before(:all) { $*[2] = VERSION1 }
|
163
|
+
|
164
|
+
it 'cannot run the method' do
|
165
|
+
expect(proc { new_version? }).to raise_error
|
166
|
+
end
|
145
167
|
end
|
146
168
|
end
|
147
169
|
end
|
148
170
|
|
149
171
|
describe 'installed_version?' do
|
150
|
-
context '
|
151
|
-
|
152
|
-
|
172
|
+
context 'with arg' do
|
173
|
+
context 'version is installed' do
|
174
|
+
it 'success to run the method' do
|
175
|
+
expect(installed_version?(VERSION1)).to be_truthy
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context 'version is not installed' do
|
180
|
+
it 'cannot run the method' do
|
181
|
+
expect(proc { installed_version?(NEW_VERSION) }).to raise_error
|
182
|
+
end
|
153
183
|
end
|
154
184
|
end
|
155
185
|
|
156
|
-
context '
|
157
|
-
|
158
|
-
|
186
|
+
context 'without arg' do
|
187
|
+
before(:all) { $* << %w(vvm install) }
|
188
|
+
|
189
|
+
context 'version is installed' do
|
190
|
+
before(:all) { $*[2] = VERSION1 }
|
191
|
+
|
192
|
+
it 'success to run the method' do
|
193
|
+
expect(installed_version?).to be_truthy
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
context 'version is not installed' do
|
198
|
+
before(:all) { $*[2] = NEW_VERSION }
|
199
|
+
|
200
|
+
it 'cannot run the method' do
|
201
|
+
expect(proc { installed_version? }).to raise_error
|
202
|
+
end
|
159
203
|
end
|
160
204
|
end
|
161
205
|
end
|
data/spec/version_spec.rb
CHANGED
data/vvm-rb.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
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
|
+
# stub: vvm-rb 1.0.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vvm-rb"
|
9
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.4"
|
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"]
|