vim-flavor 1.1.4 → 1.1.5
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 +4 -4
- data/features/resolve_dependencies/upgrade_outdated_dependencies.feature +88 -0
- data/features/support/env.rb +1 -1
- data/lib/vim-flavor/facade.rb +29 -15
- data/lib/vim-flavor/flavor.rb +2 -3
- data/lib/vim-flavor/lockfileparser.rb +1 -1
- data/lib/vim-flavor/version.rb +1 -1
- data/spec/flavor_spec.rb +9 -14
- data/spec/lockfile_spec.rb +9 -5
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3af3445611a09f669898cdd66a43f7591dc17b1a
|
4
|
+
data.tar.gz: 1ded87c558b1572b3f7a8099e71c9d64ac84126f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a5437a08c3acf45fa9f071099d1cd4f5e7bb1af8bd710f7e0fb9533fc5995ed126d7391b3cd50b3be277e3d9124ad65a667a5e6735f5c503dcbe7cb089b330
|
7
|
+
data.tar.gz: aa9837dd97da4f11979b9762dcf443a55526e62bceee3edaad4aeedf9981350b5c6abbc655fa6a046c1902e6c6034da8e9e88ae278e15fcff4fdd4bac028467c
|
@@ -0,0 +1,88 @@
|
|
1
|
+
Feature: Upgrade outdated dependencies of Vim plugins
|
2
|
+
In order to smoothly install Vim plugins,
|
3
|
+
as a lazy Vim user,
|
4
|
+
I want to automatically upgrade outdated dependencies of Vim plugins.
|
5
|
+
|
6
|
+
Scenario: Some plugins use outdated dependencies
|
7
|
+
Given a repository "L" with versions "0.1 0.2 0.3 0.4"
|
8
|
+
And a repository "A" with versions "0.0" and a flavorfile:
|
9
|
+
"""ruby
|
10
|
+
flavor '$L_uri', '~> 0.3'
|
11
|
+
"""
|
12
|
+
And a repository "B" with versions "0.0" and a flavorfile:
|
13
|
+
"""ruby
|
14
|
+
flavor '$L_uri', '~> 0.3'
|
15
|
+
"""
|
16
|
+
And a flavorfile with:
|
17
|
+
"""ruby
|
18
|
+
flavor '$A_uri'
|
19
|
+
flavor '$B_uri'
|
20
|
+
flavor '$L_uri'
|
21
|
+
"""
|
22
|
+
And I run `vim-flavor install`
|
23
|
+
And it should pass with template:
|
24
|
+
"""
|
25
|
+
Checking versions...
|
26
|
+
Use $A_uri ... 0.0
|
27
|
+
Use $L_uri ... 0.4
|
28
|
+
Use $B_uri ... 0.0
|
29
|
+
Use $L_uri ... 0.4
|
30
|
+
Use $L_uri ... 0.4
|
31
|
+
Deploying plugins...
|
32
|
+
$A_uri 0.0 ... done
|
33
|
+
$B_uri 0.0 ... done
|
34
|
+
$L_uri 0.4 ... done
|
35
|
+
Completed.
|
36
|
+
"""
|
37
|
+
And a lockfile is created with:
|
38
|
+
"""
|
39
|
+
$A_uri (0.0)
|
40
|
+
$B_uri (0.0)
|
41
|
+
$L_uri (0.4)
|
42
|
+
"""
|
43
|
+
And a bootstrap script is created in "$home/.vim"
|
44
|
+
And a flavor "$A_uri" version "0.0" is deployed to "$home/.vim"
|
45
|
+
And a flavor "$B_uri" version "0.0" is deployed to "$home/.vim"
|
46
|
+
And a flavor "$L_uri" version "0.4" is deployed to "$home/.vim"
|
47
|
+
When "L" version "0.5" is released
|
48
|
+
And a repository "X" with versions "0.0" and a flavorfile:
|
49
|
+
"""ruby
|
50
|
+
flavor '$L_uri', '~> 0.5'
|
51
|
+
"""
|
52
|
+
And I edit the flavorfile as:
|
53
|
+
"""ruby
|
54
|
+
flavor '$A_uri'
|
55
|
+
flavor '$B_uri'
|
56
|
+
flavor '$L_uri'
|
57
|
+
flavor '$X_uri'
|
58
|
+
"""
|
59
|
+
And I run `vim-flavor install`
|
60
|
+
Then it should pass with template:
|
61
|
+
"""
|
62
|
+
Checking versions...
|
63
|
+
Use $A_uri ... 0.0
|
64
|
+
Use $L_uri ... 0.4
|
65
|
+
Use $B_uri ... 0.0
|
66
|
+
Use $L_uri ... 0.4
|
67
|
+
Use $L_uri ... 0.4
|
68
|
+
Use $X_uri ... 0.0
|
69
|
+
Use $L_uri ... 0.5
|
70
|
+
Deploying plugins...
|
71
|
+
$A_uri 0.0 ... skipped (already deployed)
|
72
|
+
$B_uri 0.0 ... skipped (already deployed)
|
73
|
+
$L_uri 0.5 ... done
|
74
|
+
$X_uri 0.0 ... done
|
75
|
+
Completed.
|
76
|
+
"""
|
77
|
+
And a lockfile is created with:
|
78
|
+
"""
|
79
|
+
$A_uri (0.0)
|
80
|
+
$B_uri (0.0)
|
81
|
+
$L_uri (0.5)
|
82
|
+
$X_uri (0.0)
|
83
|
+
"""
|
84
|
+
And a bootstrap script is created in "$home/.vim"
|
85
|
+
And a flavor "$A_uri" version "0.0" is deployed to "$home/.vim"
|
86
|
+
And a flavor "$B_uri" version "0.0" is deployed to "$home/.vim"
|
87
|
+
And a flavor "$L_uri" version "0.5" is deployed to "$home/.vim"
|
88
|
+
And a flavor "$X_uri" version "0.0" is deployed to "$home/.vim"
|
data/features/support/env.rb
CHANGED
data/lib/vim-flavor/facade.rb
CHANGED
@@ -89,26 +89,40 @@ module Vim
|
|
89
89
|
|
90
90
|
def complete(current_flavor_table, locked_flavor_table, mode, level = 1)
|
91
91
|
nfs = complete_flavors(current_flavor_table, locked_flavor_table, mode, level, 'you')
|
92
|
-
nfgs = nfs.group_by {|nf| nf.repo_name}
|
93
92
|
|
94
93
|
Hash[
|
95
|
-
|
96
|
-
|
97
|
-
vs = nfg.group_by {|nf| nf.locked_version}.values
|
98
|
-
if 2 <= vs.length
|
99
|
-
ss = []
|
100
|
-
ss << 'Found incompatible declarations:'
|
101
|
-
nfg.each do |nf|
|
102
|
-
ss << " #{nf.repo_name} #{nf.version_constraint} is required by #{nf.requirer}"
|
103
|
-
end
|
104
|
-
ss << 'Please resolve the conflict.'
|
105
|
-
abort ss.join("\n")
|
106
|
-
end
|
107
|
-
[repo_name, nfg.first]
|
94
|
+
nfs.group_by {|nf| nf.repo_name}.map {|repo_name, nfg|
|
95
|
+
[repo_name, choose_a_flavor(nfg)]
|
108
96
|
}
|
109
97
|
]
|
110
98
|
end
|
111
99
|
|
100
|
+
def choose_a_flavor(nfg)
|
101
|
+
vs = nfg.map {|nf| nf.locked_version}.uniq
|
102
|
+
if vs.length == 1
|
103
|
+
nfg.first
|
104
|
+
else
|
105
|
+
latest_version = vs.max()
|
106
|
+
if nfg.all? {|nf| nf.satisfied_with?(latest_version)}
|
107
|
+
nf = nfg.first
|
108
|
+
nf.use_specific_version(latest_version)
|
109
|
+
nf
|
110
|
+
else
|
111
|
+
stop_by_incompatible_declarations(nfg)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def stop_by_incompatible_declarations(nfg)
|
117
|
+
ss = []
|
118
|
+
ss << 'Found incompatible declarations:'
|
119
|
+
nfg.each do |nf|
|
120
|
+
ss << " #{nf.repo_name} #{nf.version_constraint} is required by #{nf.requirer}"
|
121
|
+
end
|
122
|
+
ss << 'Please resolve the conflict.'
|
123
|
+
abort ss.join("\n")
|
124
|
+
end
|
125
|
+
|
112
126
|
def complete_flavors(current_flavor_table, locked_flavor_table, mode, level, requirer)
|
113
127
|
current_flavor_table.values.map(&:dup).sort_by(&:repo_name).
|
114
128
|
on_failure {trace " failed\n"}.
|
@@ -129,7 +143,7 @@ module Vim
|
|
129
143
|
already_cached = nf.cached?
|
130
144
|
nf.clone() unless already_cached
|
131
145
|
|
132
|
-
if mode == :install and lf and nf.satisfied_with?(lf)
|
146
|
+
if mode == :install and lf and nf.satisfied_with?(lf.locked_version)
|
133
147
|
if not nf.cached_version?(lf.locked_version)
|
134
148
|
nf.fetch()
|
135
149
|
if not nf.cached_version?(lf.locked_version)
|
data/lib/vim-flavor/flavor.rb
CHANGED
@@ -135,9 +135,8 @@ module Vim
|
|
135
135
|
versions_from_tags(list_tags())
|
136
136
|
end
|
137
137
|
|
138
|
-
def satisfied_with?(
|
139
|
-
|
140
|
-
version_constraint.compatible?(locked_flavor.locked_version)
|
138
|
+
def satisfied_with?(version)
|
139
|
+
version_constraint.compatible?(version)
|
141
140
|
end
|
142
141
|
end
|
143
142
|
end
|
data/lib/vim-flavor/version.rb
CHANGED
data/spec/flavor_spec.rb
CHANGED
@@ -30,24 +30,19 @@ module Vim
|
|
30
30
|
f
|
31
31
|
}
|
32
32
|
|
33
|
-
def
|
34
|
-
|
35
|
-
f.repo_name = repo_name
|
36
|
-
f.locked_version = locked_version
|
37
|
-
f
|
33
|
+
def version(s)
|
34
|
+
Version.create(s)
|
38
35
|
end
|
39
36
|
|
40
|
-
it {should be_satisfied_with
|
41
|
-
|
42
|
-
it {should be_satisfied_with locked_flavor('foo', '1.2.4')}
|
43
|
-
it {should be_satisfied_with locked_flavor('foo', '1.3.3')}
|
44
|
-
it {should be_satisfied_with locked_flavor('foo', '2.2.3')}
|
37
|
+
it {should be_satisfied_with version('1.2.3')}
|
45
38
|
|
46
|
-
it {
|
47
|
-
it {
|
48
|
-
it {
|
39
|
+
it {should be_satisfied_with version('1.2.4')}
|
40
|
+
it {should be_satisfied_with version('1.3.3')}
|
41
|
+
it {should be_satisfied_with version('2.2.3')}
|
49
42
|
|
50
|
-
it {should_not be_satisfied_with
|
43
|
+
it {should_not be_satisfied_with version('0.2.3')}
|
44
|
+
it {should_not be_satisfied_with version('1.1.3')}
|
45
|
+
it {should_not be_satisfied_with version('1.2.2')}
|
51
46
|
end
|
52
47
|
end
|
53
48
|
end
|
data/spec/lockfile_spec.rb
CHANGED
@@ -14,10 +14,14 @@ module Vim
|
|
14
14
|
def flavor(repo_name, locked_version)
|
15
15
|
f = Flavor.new()
|
16
16
|
f.repo_name = repo_name
|
17
|
-
f.locked_version = locked_version
|
17
|
+
f.locked_version = version(locked_version)
|
18
18
|
f
|
19
19
|
end
|
20
20
|
|
21
|
+
def version(s)
|
22
|
+
Version.create(s)
|
23
|
+
end
|
24
|
+
|
21
25
|
it 'has flavors sorted by repo_name' do
|
22
26
|
l = LockFile.new(@tmp_path.to_lockfile_path)
|
23
27
|
foo = flavor('foo', '1.2.3')
|
@@ -52,11 +56,11 @@ module Vim
|
|
52
56
|
|
53
57
|
l.load()
|
54
58
|
l.flavor_table['foo'].repo_name.should == 'foo'
|
55
|
-
l.flavor_table['foo'].locked_version.should == '1.2.3'
|
59
|
+
l.flavor_table['foo'].locked_version.should == version('1.2.3')
|
56
60
|
l.flavor_table['bar'].repo_name.should == 'bar'
|
57
|
-
l.flavor_table['bar'].locked_version.should == '2.3.4'
|
61
|
+
l.flavor_table['bar'].locked_version.should == version('2.3.4')
|
58
62
|
l.flavor_table['baz'].repo_name.should == 'baz'
|
59
|
-
l.flavor_table['baz'].locked_version.should == '3.4.5'
|
63
|
+
l.flavor_table['baz'].locked_version.should == version('3.4.5')
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
@@ -70,7 +74,7 @@ module Vim
|
|
70
74
|
|
71
75
|
l = LockFile.load_or_new(@tmp_path.to_lockfile_path)
|
72
76
|
l.flavor_table['foo'].repo_name.should == 'foo'
|
73
|
-
l.flavor_table['foo'].locked_version.should == '1.2.3'
|
77
|
+
l.flavor_table['foo'].locked_version.should == version('1.2.3')
|
74
78
|
end
|
75
79
|
|
76
80
|
it 'only creates a new instance if a given path does not exist' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kana Natsuno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- features/philosophy.md
|
116
116
|
- features/resolve_dependencies/README.md
|
117
117
|
- features/resolve_dependencies/basics.feature
|
118
|
+
- features/resolve_dependencies/upgrade_outdated_dependencies.feature
|
118
119
|
- features/resolve_dependencies/version_conflict.feature
|
119
120
|
- features/step_definitions/bootstrap_script_steps.rb
|
120
121
|
- features/step_definitions/cli_steps.rb
|
@@ -202,6 +203,7 @@ test_files:
|
|
202
203
|
- features/philosophy.md
|
203
204
|
- features/resolve_dependencies/README.md
|
204
205
|
- features/resolve_dependencies/basics.feature
|
206
|
+
- features/resolve_dependencies/upgrade_outdated_dependencies.feature
|
205
207
|
- features/resolve_dependencies/version_conflict.feature
|
206
208
|
- features/step_definitions/bootstrap_script_steps.rb
|
207
209
|
- features/step_definitions/cli_steps.rb
|