vim-flavor 1.1.0 → 1.1.1
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.
- data/features/.nav +1 -0
- data/features/flavorfile/version_constraint.feature +2 -1
- data/features/resolve_dependencies/basics.feature +32 -0
- data/features/step_definitions/lockfile_steps.rb +6 -0
- data/features/version_lock.feature +21 -4
- data/features/version_tag_format.feature +74 -0
- data/lib/vim-flavor/flavor.rb +2 -2
- data/lib/vim-flavor/lockfileparser.rb +1 -0
- data/lib/vim-flavor/version.rb +22 -1
- data/lib/vim-flavor/versionconstraint.rb +3 -3
- data/spec/version_spec.rb +66 -0
- data/spec/versionconstraint_spec.rb +7 -0
- metadata +6 -2
data/features/.nav
CHANGED
@@ -5,7 +5,8 @@ Feature: Version constraint
|
|
5
5
|
|
6
6
|
Note that vim-flavor assumes that plugins follow [the versioning pocilies of
|
7
7
|
RubyGems](http://docs.rubygems.org/read/chapter/7#page26), to determine
|
8
|
-
compatibility of plugins. See also [Philosophy](philosophy) for the
|
8
|
+
compatibility of plugins. See also [Philosophy](../philosophy) for the
|
9
|
+
details.
|
9
10
|
|
10
11
|
Background:
|
11
12
|
Given a repository "foo" with versions "1.0 1.1 1.2 2.0"
|
@@ -148,3 +148,35 @@ Feature: Resolve dependencies of Vim plugins
|
|
148
148
|
And a bootstrap script is created in "$home/.vim"
|
149
149
|
And a flavor "$foo_uri" version "2.1" is deployed to "$home/.vim"
|
150
150
|
And a flavor "$bar_uri" version "2.1" is deployed to "$home/.vim"
|
151
|
+
|
152
|
+
Scenario: Resolve dependencies with different style version tags
|
153
|
+
Given a repository "foo" with versions "v4.5 v6.7 v8.9"
|
154
|
+
And a repository "bar" with versions "1.0 1.1 2.0 2.1" and a flavorfile:
|
155
|
+
"""ruby
|
156
|
+
flavor '$foo_uri', '>= 6.7'
|
157
|
+
"""
|
158
|
+
And a flavorfile with:
|
159
|
+
"""ruby
|
160
|
+
flavor '$foo_uri'
|
161
|
+
flavor '$bar_uri'
|
162
|
+
"""
|
163
|
+
When I run `vim-flavor install`
|
164
|
+
Then it should pass with template:
|
165
|
+
"""
|
166
|
+
Checking versions...
|
167
|
+
Use $bar_uri ... 2.1
|
168
|
+
Use $foo_uri ... v8.9
|
169
|
+
Use $foo_uri ... v8.9
|
170
|
+
Deploying plugins...
|
171
|
+
$bar_uri 2.1 ... done
|
172
|
+
$foo_uri v8.9 ... done
|
173
|
+
Completed.
|
174
|
+
"""
|
175
|
+
And a lockfile is created with:
|
176
|
+
"""
|
177
|
+
$bar_uri (2.1)
|
178
|
+
$foo_uri (v8.9)
|
179
|
+
"""
|
180
|
+
And a bootstrap script is created in "$home/.vim"
|
181
|
+
And a flavor "$foo_uri" version "v8.9" is deployed to "$home/.vim"
|
182
|
+
And a flavor "$bar_uri" version "2.1" is deployed to "$home/.vim"
|
@@ -3,11 +3,9 @@ Feature: Version lock
|
|
3
3
|
as a lazy Vim user,
|
4
4
|
I want to keep versions of Vim plugins which I installed before.
|
5
5
|
|
6
|
-
|
6
|
+
Scenario: Install with a lockfile including "X.Y.Z" style tags
|
7
7
|
Given a repository "foo" with versions "1.0.0 1.0.1 1.0.2"
|
8
|
-
|
9
|
-
Scenario: Install with lockfile
|
10
|
-
Given a flavorfile with:
|
8
|
+
And a flavorfile with:
|
11
9
|
"""ruby
|
12
10
|
flavor '$foo_uri'
|
13
11
|
"""
|
@@ -23,3 +21,22 @@ Feature: Version lock
|
|
23
21
|
"""
|
24
22
|
And a bootstrap script is created in "$home/.vim"
|
25
23
|
And a flavor "$foo_uri" version "1.0.0" is deployed to "$home/.vim"
|
24
|
+
|
25
|
+
Scenario: Install with a lockfile including "vX.Y.Z" style tags
|
26
|
+
Given a repository "foo" with versions "v4.5.6 v8.8 v9.0"
|
27
|
+
And a flavorfile with:
|
28
|
+
"""ruby
|
29
|
+
flavor '$foo_uri'
|
30
|
+
"""
|
31
|
+
And a lockfile with:
|
32
|
+
"""
|
33
|
+
$foo_uri (v8.8)
|
34
|
+
"""
|
35
|
+
When I run `vim-flavor install`
|
36
|
+
Then it should pass
|
37
|
+
And the lockfile is updated with:
|
38
|
+
"""
|
39
|
+
$foo_uri (v8.8)
|
40
|
+
"""
|
41
|
+
And a bootstrap script is created in "$home/.vim"
|
42
|
+
And a flavor "$foo_uri" version "v8.8" is deployed to "$home/.vim"
|
@@ -0,0 +1,74 @@
|
|
1
|
+
Feature: Version tag format
|
2
|
+
In order to use proper versions of Vim plugins,
|
3
|
+
as a lazy Vim user,
|
4
|
+
I want to use only tags which are formatted as versions.
|
5
|
+
|
6
|
+
Scenario: With tags in the style of "X.Y.Z"
|
7
|
+
Given a repository "foo" with versions "1 1.2 1.2.3"
|
8
|
+
And a flavorfile with:
|
9
|
+
"""ruby
|
10
|
+
flavor '$foo_uri'
|
11
|
+
"""
|
12
|
+
When I run `vim-flavor install`
|
13
|
+
Then it should pass
|
14
|
+
And a lockfile is created with:
|
15
|
+
"""
|
16
|
+
$foo_uri (1.2.3)
|
17
|
+
"""
|
18
|
+
And a bootstrap script is created in "$home/.vim"
|
19
|
+
And a flavor "$foo_uri" version "1.2.3" is deployed to "$home/.vim"
|
20
|
+
|
21
|
+
Scenario: With tags in the style of "vX.Y.Z"
|
22
|
+
Given a repository "foo" with versions "v4.5.6 v7 v8.9"
|
23
|
+
And a flavorfile with:
|
24
|
+
"""ruby
|
25
|
+
flavor '$foo_uri'
|
26
|
+
"""
|
27
|
+
When I run `vim-flavor install`
|
28
|
+
Then it should pass
|
29
|
+
And a lockfile is created with:
|
30
|
+
"""
|
31
|
+
$foo_uri (v8.9)
|
32
|
+
"""
|
33
|
+
And a bootstrap script is created in "$home/.vim"
|
34
|
+
And a flavor "$foo_uri" version "v8.9" is deployed to "$home/.vim"
|
35
|
+
|
36
|
+
Scenario: Without valid tags
|
37
|
+
Given a repository "foo" with versions "abc def ghi"
|
38
|
+
And a flavorfile with:
|
39
|
+
"""ruby
|
40
|
+
flavor '$foo_uri'
|
41
|
+
"""
|
42
|
+
When I run `vim-flavor install`
|
43
|
+
Then it should fail with template:
|
44
|
+
"""
|
45
|
+
Checking versions...
|
46
|
+
Use $foo_uri ... failed
|
47
|
+
"""
|
48
|
+
And it should fail with regexp:
|
49
|
+
"""
|
50
|
+
There is no valid version
|
51
|
+
"""
|
52
|
+
And a lockfile is not created
|
53
|
+
And a bootstrap script is not created in "$home/.vim"
|
54
|
+
And a flavor "$foo_uri" is not deployed to "$home/.vim"
|
55
|
+
|
56
|
+
Scenario: Without tags
|
57
|
+
Given a repository "foo"
|
58
|
+
And a flavorfile with:
|
59
|
+
"""ruby
|
60
|
+
flavor '$foo_uri'
|
61
|
+
"""
|
62
|
+
When I run `vim-flavor install`
|
63
|
+
Then it should fail with template:
|
64
|
+
"""
|
65
|
+
Checking versions...
|
66
|
+
Use $foo_uri ... failed
|
67
|
+
"""
|
68
|
+
And it should fail with regexp:
|
69
|
+
"""
|
70
|
+
There is no valid version
|
71
|
+
"""
|
72
|
+
And a lockfile is not created
|
73
|
+
And a bootstrap script is not created in "$home/.vim"
|
74
|
+
And a flavor "$foo_uri" is not deployed to "$home/.vim"
|
data/lib/vim-flavor/flavor.rb
CHANGED
@@ -129,8 +129,8 @@ module Vim
|
|
129
129
|
|
130
130
|
def versions_from_tags(tags)
|
131
131
|
tags.
|
132
|
-
select {|t| t != '' &&
|
133
|
-
map {|t|
|
132
|
+
select {|t| t != '' && Version.correct?(t)}.
|
133
|
+
map {|t| Version.create(t)}
|
134
134
|
end
|
135
135
|
|
136
136
|
def list_versions()
|
data/lib/vim-flavor/version.rb
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
module Vim
|
2
2
|
module Flavor
|
3
|
-
VERSION = '1.1.
|
3
|
+
VERSION = '1.1.1'
|
4
|
+
|
5
|
+
class Version < Gem::Version
|
6
|
+
attr_accessor :original_tag_name
|
7
|
+
|
8
|
+
def initialize(tag_name)
|
9
|
+
@original_tag_name = tag_name
|
10
|
+
super(self.class.normalize_tag_name(tag_name))
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.normalize_tag_name(tag_name)
|
14
|
+
tag_name.sub(/^v/, '')
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.correct?(tag_name)
|
18
|
+
super(normalize_tag_name(tag_name))
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s()
|
22
|
+
@original_tag_name
|
23
|
+
end
|
24
|
+
end
|
4
25
|
end
|
5
26
|
end
|
@@ -22,14 +22,14 @@ module Vim
|
|
22
22
|
def self.parse(s)
|
23
23
|
m = /^\s*(>=|~>)\s+(\S+)$/.match(s)
|
24
24
|
if m
|
25
|
-
[
|
25
|
+
[Version.create(m[2]), m[1]]
|
26
26
|
else
|
27
27
|
raise "Invalid version constraint: #{s.inspect}"
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def compatible?(other_version_or_s)
|
32
|
-
v =
|
32
|
+
v = Version.create(other_version_or_s)
|
33
33
|
if qualifier == '~>'
|
34
34
|
self.base_version.bump() > v and v >= self.base_version
|
35
35
|
elsif qualifier == '>='
|
@@ -42,7 +42,7 @@ module Vim
|
|
42
42
|
def find_the_best_version(versions)
|
43
43
|
versions.
|
44
44
|
select {|v| compatible?(v)}.
|
45
|
-
max()
|
45
|
+
max() or raise 'There is no valid version'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Vim
|
4
|
+
module Flavor
|
5
|
+
describe Version do
|
6
|
+
describe '::create' do
|
7
|
+
it 'accept "X.Y.Z" style tags' do
|
8
|
+
expect {
|
9
|
+
Version.create('1')
|
10
|
+
Version.create('1.2')
|
11
|
+
Version.create('1.2.3')
|
12
|
+
}.not_to raise_error
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'accept "vX.Y.Z" style tags' do
|
16
|
+
expect {
|
17
|
+
Version.create('v1')
|
18
|
+
Version.create('v1.2')
|
19
|
+
Version.create('v1.2.3')
|
20
|
+
}.not_to raise_error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '::correct?' do
|
25
|
+
it 'accept "X.Y.Z" style tags' do
|
26
|
+
Version.correct?('1').should be_true
|
27
|
+
Version.correct?('1.2').should be_true
|
28
|
+
Version.correct?('1.2.3').should be_true
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'accept "vX.Y.Z" style tags' do
|
32
|
+
Version.correct?('v1').should be_true
|
33
|
+
Version.correct?('v1.2').should be_true
|
34
|
+
Version.correct?('v1.2.3').should be_true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#<=>' do
|
39
|
+
it 'can comapre "X.Y.Z" tags' do
|
40
|
+
Version.create('1.2.3').should be <= Version.create('1.3')
|
41
|
+
Version.create('1.2.3').should be == Version.create('1.2.3')
|
42
|
+
Version.create('1.2.3').should be >= Version.create('1.1')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'can comapre "vX.Y.Z" tags' do
|
46
|
+
Version.create('v1.2.3').should be <= Version.create('v1.3')
|
47
|
+
Version.create('v1.2.3').should be == Version.create('v1.2.3')
|
48
|
+
Version.create('v1.2.3').should be >= Version.create('v1.1')
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'can comapre "X.Y.Z" tag with "vX.Y.Z" tag' do
|
52
|
+
Version.create('1.2.3').should be <= Version.create('v1.3')
|
53
|
+
Version.create('1.2.3').should be == Version.create('v1.2.3')
|
54
|
+
Version.create('1.2.3').should be >= Version.create('v1.1')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '#to_s' do
|
59
|
+
it 'is converted into the original string' do
|
60
|
+
Version.create('1.2.3').to_s.should == '1.2.3'
|
61
|
+
Version.create('v1.2.3').to_s.should == 'v1.2.3'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -50,6 +50,13 @@ module Vim
|
|
50
50
|
find_the_best_version(['1.2.2', '1.2.3', '1.2.4', '1.3.3', '2.0']).
|
51
51
|
should == '1.2.4'
|
52
52
|
end
|
53
|
+
|
54
|
+
it 'fails if no version is given' do
|
55
|
+
expect {
|
56
|
+
VersionConstraint.new('>= 1.2.3').
|
57
|
+
find_the_best_version([]).tap {|v| p v}
|
58
|
+
}.to raise_error(RuntimeError, 'There is no valid version')
|
59
|
+
end
|
53
60
|
end
|
54
61
|
end
|
55
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vim-flavor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parslet
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- features/typical_usage/upgrade_vim_plugins.feature
|
148
148
|
- features/uninstall_vim_flavor.md
|
149
149
|
- features/version_lock.feature
|
150
|
+
- features/version_tag_format.feature
|
150
151
|
- lib/vim-flavor.rb
|
151
152
|
- lib/vim-flavor/cli.rb
|
152
153
|
- lib/vim-flavor/enumerableextension.rb
|
@@ -166,6 +167,7 @@ files:
|
|
166
167
|
- spec/lockfile_spec.rb
|
167
168
|
- spec/spec_helper.rb
|
168
169
|
- spec/stringextension_spec.rb
|
170
|
+
- spec/version_spec.rb
|
169
171
|
- spec/versionconstraint_spec.rb
|
170
172
|
- vim-flavor.gemspec
|
171
173
|
homepage: https://github.com/kana/vim-flavor
|
@@ -231,6 +233,7 @@ test_files:
|
|
231
233
|
- features/typical_usage/upgrade_vim_plugins.feature
|
232
234
|
- features/uninstall_vim_flavor.md
|
233
235
|
- features/version_lock.feature
|
236
|
+
- features/version_tag_format.feature
|
234
237
|
- spec/enumerableextension_spec.rb
|
235
238
|
- spec/facade_spec.rb
|
236
239
|
- spec/flavor_spec.rb
|
@@ -238,4 +241,5 @@ test_files:
|
|
238
241
|
- spec/lockfile_spec.rb
|
239
242
|
- spec/spec_helper.rb
|
240
243
|
- spec/stringextension_spec.rb
|
244
|
+
- spec/version_spec.rb
|
241
245
|
- spec/versionconstraint_spec.rb
|