vim-flavor 2.2.2 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +12 -0
- data/.github/workflows/ci.yml +35 -0
- data/.gitmodules +2 -2
- data/.ruby-version +1 -0
- data/CHANGELOG.md +178 -0
- data/README.md +133 -45
- data/Rakefile +11 -0
- data/config/cucumber.yml +1 -0
- data/features/.nav +2 -1
- data/features/backward_compatibilities/flavorfile.feature +166 -0
- data/features/backward_compatibilities/lockfile.feature +22 -0
- data/features/branches/changing_tracking_branches.feature +0 -3
- data/features/branches/detect_incompatible_declarations.feature +0 -2
- data/features/branches/install.feature +0 -2
- data/features/branches/update.feature +0 -1
- data/features/caching/deployment.feature +1 -0
- data/features/flavorfile/README.md +1 -1
- data/features/flavorfile/comments.feature +0 -1
- data/features/flavorfile/groups.feature +0 -3
- data/features/flavorfile/repository_name.feature +2 -5
- data/features/flavorfile/version_constraint.feature +3 -7
- data/features/install_vim_flavor.md +6 -12
- data/features/news.md +1 -0
- data/features/philosophy.md +4 -4
- data/features/resolve_dependencies/README.md +4 -3
- data/features/resolve_dependencies/basics.feature +0 -4
- data/features/resolve_dependencies/upgrade_outdated_dependencies.feature +0 -2
- data/features/resolve_dependencies/version_conflict.feature +0 -2
- data/features/step_definitions/cli_steps.rb +6 -1
- data/features/step_definitions/dependency_steps.rb +2 -1
- data/features/step_definitions/directory_steps.rb +1 -1
- data/features/step_definitions/file_steps.rb +2 -2
- data/features/step_definitions/flavor_steps.rb +25 -9
- data/features/step_definitions/flavorfile_steps.rb +10 -1
- data/features/step_definitions/lockfile_steps.rb +14 -5
- data/features/support/env.rb +22 -12
- data/features/testing_vim_plugins/README.md +7 -6
- data/features/testing_vim_plugins/dependencies.feature +14 -15
- data/features/testing_vim_plugins/failures.feature +6 -6
- data/features/testing_vim_plugins/specifying_test_scripts.feature +12 -12
- data/features/testing_vim_plugins/typical_usage.feature +33 -10
- data/features/typical_usage/README.md +7 -7
- data/features/typical_usage/deploy_to_arbitrary_place.feature +0 -1
- data/features/typical_usage/install_vim_plugins.feature +0 -1
- data/features/typical_usage/uninstall_vim_plugins.feature +0 -1
- data/features/typical_usage/update_vim_plugins.feature +0 -3
- data/features/uninstall_vim_flavor.md +3 -4
- data/features/version_lock.feature +0 -1
- data/features/version_tag_format.feature +0 -4
- data/lib/vim-flavor/cli.rb +2 -2
- data/lib/vim-flavor/console.rb +22 -0
- data/lib/vim-flavor/env.rb +1 -1
- data/lib/vim-flavor/facade.rb +17 -48
- data/lib/vim-flavor/flavor.rb +1 -1
- data/lib/vim-flavor/flavorfile.rb +24 -1
- data/lib/vim-flavor/lockfile.rb +16 -1
- data/lib/vim-flavor/stringextension.rb +3 -11
- data/lib/vim-flavor/version.rb +1 -1
- data/lib/vim-flavor.rb +1 -1
- data/spec/branchversion_spec.rb +4 -4
- data/spec/stringextension_spec.rb +33 -2
- data/vim-flavor.gemspec +8 -5
- metadata +70 -26
- data/.travis.yml +0 -7
- data/features/news.md +0 -65
- data/features/step_definitions/bootstrap_script_steps.rb +0 -6
- data/spec/facade_spec.rb +0 -57
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: Lockfile
|
2
|
+
In order to avoid unexpected result and confusion,
|
3
|
+
as a lazy Vim user,
|
4
|
+
I want to stop vim-flavor process if obsolete file still exists.
|
5
|
+
|
6
|
+
Scenario: User has old name of lockfile
|
7
|
+
Given a repository "foo" with versions "1.0.0 1.0.1 1.0.2"
|
8
|
+
And a flavorfile with:
|
9
|
+
"""ruby
|
10
|
+
flavor '$foo_uri'
|
11
|
+
"""
|
12
|
+
And an old name lockfile with:
|
13
|
+
"""
|
14
|
+
$foo_uri (1.0.1)
|
15
|
+
"""
|
16
|
+
When I run `vim-flavor install`
|
17
|
+
Then it should fail with template:
|
18
|
+
"""
|
19
|
+
Error: VimFlavor.lock is no longer used. Rename it to Flavorfile.lock.
|
20
|
+
"""
|
21
|
+
And a lockfile is not created
|
22
|
+
And a flavor "$foo_uri" is not deployed to "$home/.vim"
|
@@ -24,7 +24,6 @@ Feature: Changing tracking branches
|
|
24
24
|
$foo_uri $foo_rev_102 at master ... done
|
25
25
|
Completed.
|
26
26
|
"""
|
27
|
-
And a bootstrap script is created in "$home/.vim"
|
28
27
|
And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
|
29
28
|
|
30
29
|
Scenario: Use a branch instead of a version
|
@@ -49,7 +48,6 @@ Feature: Changing tracking branches
|
|
49
48
|
"""
|
50
49
|
$foo_uri ($foo_rev_102 at master)
|
51
50
|
"""
|
52
|
-
And a bootstrap script is created in "$home/.vim"
|
53
51
|
And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
|
54
52
|
|
55
53
|
Scenario: Use a version instead of a branch
|
@@ -74,5 +72,4 @@ Feature: Changing tracking branches
|
|
74
72
|
"""
|
75
73
|
$foo_uri (1.0.2)
|
76
74
|
"""
|
77
|
-
And a bootstrap script is created in "$home/.vim"
|
78
75
|
And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
|
@@ -32,7 +32,6 @@ Feature: Detect incompatible declarations
|
|
32
32
|
$L_uri branch: experimental is required by $B_uri
|
33
33
|
Please resolve the conflict.
|
34
34
|
"""
|
35
|
-
And a bootstrap script is not created in "$home/.vim"
|
36
35
|
And a flavor "$A_uri" is not deployed to "$home/.vim"
|
37
36
|
And a flavor "$B_uri" is not deployed to "$home/.vim"
|
38
37
|
And a flavor "$L_uri" is not deployed to "$home/.vim"
|
@@ -66,7 +65,6 @@ Feature: Detect incompatible declarations
|
|
66
65
|
$L_uri ~> 0.2 is required by $B_uri
|
67
66
|
Please resolve the conflict.
|
68
67
|
"""
|
69
|
-
And a bootstrap script is not created in "$home/.vim"
|
70
68
|
And a flavor "$A_uri" is not deployed to "$home/.vim"
|
71
69
|
And a flavor "$B_uri" is not deployed to "$home/.vim"
|
72
70
|
And a flavor "$L_uri" is not deployed to "$home/.vim"
|
@@ -24,7 +24,6 @@ Feature: Install Vim plugins with specific branches
|
|
24
24
|
"""
|
25
25
|
$foo_uri ($foo_rev_102 at master)
|
26
26
|
"""
|
27
|
-
And a bootstrap script is created in "$home/.vim"
|
28
27
|
And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
|
29
28
|
|
30
29
|
Scenario: Install a plugin according to a lockfile
|
@@ -47,5 +46,4 @@ Feature: Install Vim plugins with specific branches
|
|
47
46
|
$foo_uri $foo_rev_102 at master ... skipped (already deployed)
|
48
47
|
Completed.
|
49
48
|
"""
|
50
|
-
And a bootstrap script is created in "$home/.vim"
|
51
49
|
And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Flavorfile is a DSL to declare which versions of Vim plugins to use.
|
2
2
|
Whenever `vim-flavor` is invoked to manage Vim plugins,
|
3
|
-
`vim-flavor` reads a file `
|
3
|
+
`vim-flavor` reads a file `Flavorfile` in the current working directory,
|
4
4
|
and evaluates it as a flavorfile.
|
5
5
|
|
6
6
|
|
@@ -19,7 +19,6 @@ Feature: Groups
|
|
19
19
|
"""
|
20
20
|
$foo_uri (1.2)
|
21
21
|
"""
|
22
|
-
And a bootstrap script is created in "$home/.vim"
|
23
22
|
And a flavor "$foo_uri" version "1.2" is deployed to "$home/.vim"
|
24
23
|
But a flavor "$bar_uri" is not deployed to "$home/.vim"
|
25
24
|
|
@@ -35,7 +34,6 @@ Feature: Groups
|
|
35
34
|
"""
|
36
35
|
$foo_uri (1.2)
|
37
36
|
"""
|
38
|
-
And a bootstrap script is created in "$home/.vim"
|
39
37
|
And a flavor "$foo_uri" version "1.2" is deployed to "$home/.vim"
|
40
38
|
But a flavor "$bar_uri" is not deployed to "$home/.vim"
|
41
39
|
|
@@ -52,6 +50,5 @@ Feature: Groups
|
|
52
50
|
And a lockfile is created with:
|
53
51
|
"""
|
54
52
|
"""
|
55
|
-
And a bootstrap script is created in "$home/.vim"
|
56
53
|
But a flavor "$foo_uri" is not deployed to "$home/.vim"
|
57
54
|
But a flavor "$bar_uri" is not deployed to "$home/.vim"
|
@@ -7,7 +7,7 @@ Feature: Repository name
|
|
7
7
|
Given a GitHub repository "vim-scripts/vspec" with versions "0.0.4 1.2.0"
|
8
8
|
And a flavorfile with:
|
9
9
|
"""ruby
|
10
|
-
# Fetch the plugin from
|
10
|
+
# Fetch the plugin from https://github.com/vim-scripts/vspec.git
|
11
11
|
flavor 'vspec', '~> 0.0'
|
12
12
|
"""
|
13
13
|
When I run `vim-flavor install`
|
@@ -16,14 +16,13 @@ Feature: Repository name
|
|
16
16
|
"""
|
17
17
|
vspec (0.0.4)
|
18
18
|
"""
|
19
|
-
And a bootstrap script is created in "$home/.vim"
|
20
19
|
And a flavor "vspec" version "0.0.4" is deployed to "$home/.vim"
|
21
20
|
|
22
21
|
Scenario: Declare using a Vim plugin from GitHub
|
23
22
|
Given a GitHub repository "kana/vim-vspec" with versions "0.0.4 1.2.0"
|
24
23
|
And a flavorfile with:
|
25
24
|
"""ruby
|
26
|
-
# Fetch the plugin from
|
25
|
+
# Fetch the plugin from https://github.com/kana/vim-vspec.git
|
27
26
|
flavor 'kana/vim-vspec', '~> 0.0'
|
28
27
|
"""
|
29
28
|
When I run `vim-flavor install`
|
@@ -32,7 +31,6 @@ Feature: Repository name
|
|
32
31
|
"""
|
33
32
|
kana/vim-vspec (0.0.4)
|
34
33
|
"""
|
35
|
-
And a bootstrap script is created in "$home/.vim"
|
36
34
|
And a flavor "kana/vim-vspec" version "0.0.4" is deployed to "$home/.vim"
|
37
35
|
|
38
36
|
Scenario: Declare using a Vim plugin from an arbitrary URI
|
@@ -48,5 +46,4 @@ Feature: Repository name
|
|
48
46
|
"""
|
49
47
|
$vspec_uri (0.0.4)
|
50
48
|
"""
|
51
|
-
And a bootstrap script is created in "$home/.vim"
|
52
49
|
And a flavor "$vspec_uri" version "0.0.4" is deployed to "$home/.vim"
|
@@ -3,10 +3,9 @@ Feature: Version constraint
|
|
3
3
|
as a lazy Vim user,
|
4
4
|
I want to declare desirable versions of Vim plugins.
|
5
5
|
|
6
|
-
Note that vim-flavor assumes that plugins follow [
|
7
|
-
|
8
|
-
|
9
|
-
details.
|
6
|
+
Note that vim-flavor assumes that plugins follow [Semantic Versioning
|
7
|
+
2.0.0](https://semver.org/spec/v2.0.0.html), to determine compatibility of
|
8
|
+
plugins. See also [Philosophy](../philosophy) for the details.
|
10
9
|
|
11
10
|
Background:
|
12
11
|
Given a repository "foo" with versions "1.0 1.1 1.2 2.0"
|
@@ -22,7 +21,6 @@ Feature: Version constraint
|
|
22
21
|
"""
|
23
22
|
$foo_uri (2.0)
|
24
23
|
"""
|
25
|
-
And a bootstrap script is created in "$home/.vim"
|
26
24
|
And a flavor "$foo_uri" version "2.0" is deployed to "$home/.vim"
|
27
25
|
|
28
26
|
Scenario: Declare using a Vim plugin not older than a specific version
|
@@ -36,7 +34,6 @@ Feature: Version constraint
|
|
36
34
|
"""
|
37
35
|
$foo_uri (2.0)
|
38
36
|
"""
|
39
|
-
And a bootstrap script is created in "$home/.vim"
|
40
37
|
And a flavor "$foo_uri" version "2.0" is deployed to "$home/.vim"
|
41
38
|
|
42
39
|
Scenario: Declare using the latest and compatible version of a Vim plugin
|
@@ -50,5 +47,4 @@ Feature: Version constraint
|
|
50
47
|
"""
|
51
48
|
$foo_uri (1.2)
|
52
49
|
"""
|
53
|
-
And a bootstrap script is created in "$home/.vim"
|
54
50
|
And a flavor "$foo_uri" version "1.2" is deployed to "$home/.vim"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
## Required softwares
|
2
2
|
|
3
|
-
* [Git](
|
4
|
-
* [Ruby](
|
5
|
-
* Recommendation: Use [
|
3
|
+
* [Git](https://git-scm.com/) 2.10.1 or later
|
4
|
+
* [Ruby](https://www.ruby-lang.org/) 3.0.0 or later
|
5
|
+
* Recommendation: Use [rbenv](https://github.com/rbenv/rbenv) or other tools
|
6
6
|
for ease of installation across different envinronments.
|
7
|
-
* [Vim](
|
7
|
+
* [Vim](https://www.vim.org/) 8.0 or later
|
8
8
|
* Note that Vim should be compiled as normal, big or huge version
|
9
9
|
to use most of plugins.
|
10
10
|
|
@@ -26,14 +26,8 @@
|
|
26
26
|
|
27
27
|
cd $YOUR_REPOSITORY_FOR_DOTFILES
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
# runtime flavors/bootstrap.vim
|
32
|
-
vim vimrc
|
33
|
-
|
34
|
-
touch VimFlavor VimFlavor.lock
|
35
|
-
|
36
|
-
git add VimFlavor VimFlavor.lock vimrc
|
29
|
+
touch Flavorfile Flavorfile.lock
|
30
|
+
git add Flavorfile Flavorfile.lock
|
37
31
|
git commit -m 'Use vim-flavor to manage my favorite Vim plugins'
|
38
32
|
|
39
33
|
|
data/features/news.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
../CHANGELOG.md
|
data/features/philosophy.md
CHANGED
@@ -8,11 +8,11 @@ vim-flavor can install plugins which meet the following conditions:
|
|
8
8
|
This is an intentional design. Because:
|
9
9
|
* [vim-scripts.org](http://vim-scripts.org/) provides
|
10
10
|
[comprehensive Git mirrors](https://github.com/vim-scripts) for
|
11
|
-
[plugins uploaded to www.vim.org](
|
11
|
+
[plugins uploaded to www.vim.org](https://www.vim.org/scripts/index.php).
|
12
12
|
* Experimental plugins which are not uploaded to www.vim.org
|
13
13
|
are usually found in [GitHub](https://github.com/).
|
14
|
-
* Plugins must follow [
|
15
|
-
|
14
|
+
* Plugins must follow [Semantic Versioning
|
15
|
+
2.0.0](https://semver.org/spec/v2.0.0.html) and have "version"
|
16
16
|
tags in their repositories. For example, if there is the version 1.2.3 of
|
17
17
|
a plugin, its repository must have the tag `1.2.3`, and the files of the
|
18
18
|
version 1.2.3 can be checked out via the tag `1.2.3`. In other words,
|
@@ -35,7 +35,7 @@ vim-flavor can install plugins which meet the following conditions:
|
|
35
35
|
* Git mirrors by vim-scripts.org have proper directory structures even if
|
36
36
|
the original plugins are uploaded to www.vim.org without proper directory
|
37
37
|
structures. (A good example is
|
38
|
-
[a.vim](
|
38
|
+
[a.vim](https://www.vim.org/scripts/script.php?script_id=31) and
|
39
39
|
[its mirror](https://github.com/vim-scripts/a.vim).)
|
40
40
|
* Other Git repositories might not have proper directory structures.
|
41
41
|
Such plugins are not ready to use for everyone.
|
@@ -14,12 +14,13 @@ overlooked.
|
|
14
14
|
|
15
15
|
So that `vim-flavor` automatically resolves dependencies of Vim plugins. If
|
16
16
|
a plugin declares its dependencies as a [flavorfile](flavorfile) and saves it
|
17
|
-
as `
|
17
|
+
as `Flavorfile`, `vim-flavor` reads the file and automatically installs
|
18
18
|
dependencies according to the file.
|
19
19
|
|
20
20
|
`vim-flavor` also takes care about versions of Vim plugins. If two plugins
|
21
|
-
require the same plugin but required versions are not compatible to
|
22
|
-
installation will be stopped to avoid using Vim with a broken
|
21
|
+
require the same plugin but required versions are not compatible to each
|
22
|
+
other, installation will be stopped to avoid using Vim with a broken
|
23
|
+
configuration.
|
23
24
|
|
24
25
|
|
25
26
|
|
@@ -34,7 +34,6 @@ Feature: Resolve dependencies of Vim plugins
|
|
34
34
|
$foo_uri (1.1)
|
35
35
|
$qux_uri (2.1)
|
36
36
|
"""
|
37
|
-
And a bootstrap script is created in "$home/.vim"
|
38
37
|
And a flavor "$foo_uri" version "1.1" is deployed to "$home/.vim"
|
39
38
|
And a flavor "$bar_uri" version "2.1" is deployed to "$home/.vim"
|
40
39
|
And a flavor "$qux_uri" version "2.1" is deployed to "$home/.vim"
|
@@ -72,7 +71,6 @@ Feature: Resolve dependencies of Vim plugins
|
|
72
71
|
$foo_uri (1.1)
|
73
72
|
$qux_uri (1.1)
|
74
73
|
"""
|
75
|
-
And a bootstrap script is created in "$home/.vim"
|
76
74
|
And a flavor "$foo_uri" version "1.1" is deployed to "$home/.vim"
|
77
75
|
And a flavor "$bar_uri" version "2.1" is deployed to "$home/.vim"
|
78
76
|
And a flavor "$qux_uri" version "1.1" is deployed to "$home/.vim"
|
@@ -112,7 +110,6 @@ Feature: Resolve dependencies of Vim plugins
|
|
112
110
|
$foo_uri (2.1)
|
113
111
|
$qux_uri (2.1)
|
114
112
|
"""
|
115
|
-
And a bootstrap script is created in "$home/.vim"
|
116
113
|
And a flavor "$foo_uri" version "2.1" is deployed to "$home/.vim"
|
117
114
|
And a flavor "$bar_uri" version "2.1" is deployed to "$home/.vim"
|
118
115
|
And a flavor "$qux_uri" version "2.1" is deployed to "$home/.vim"
|
@@ -145,6 +142,5 @@ Feature: Resolve dependencies of Vim plugins
|
|
145
142
|
$bar_uri (2.1)
|
146
143
|
$foo_uri (2.1)
|
147
144
|
"""
|
148
|
-
And a bootstrap script is created in "$home/.vim"
|
149
145
|
And a flavor "$foo_uri" version "2.1" is deployed to "$home/.vim"
|
150
146
|
And a flavor "$bar_uri" version "2.1" is deployed to "$home/.vim"
|
@@ -40,7 +40,6 @@ Feature: Update outdated dependencies of Vim plugins
|
|
40
40
|
$B_uri (0.0)
|
41
41
|
$L_uri (0.4)
|
42
42
|
"""
|
43
|
-
And a bootstrap script is created in "$home/.vim"
|
44
43
|
And a flavor "$A_uri" version "0.0" is deployed to "$home/.vim"
|
45
44
|
And a flavor "$B_uri" version "0.0" is deployed to "$home/.vim"
|
46
45
|
And a flavor "$L_uri" version "0.4" is deployed to "$home/.vim"
|
@@ -81,7 +80,6 @@ Feature: Update outdated dependencies of Vim plugins
|
|
81
80
|
$L_uri (0.5)
|
82
81
|
$X_uri (0.0)
|
83
82
|
"""
|
84
|
-
And a bootstrap script is created in "$home/.vim"
|
85
83
|
And a flavor "$A_uri" version "0.0" is deployed to "$home/.vim"
|
86
84
|
And a flavor "$B_uri" version "0.0" is deployed to "$home/.vim"
|
87
85
|
And a flavor "$L_uri" version "0.5" is deployed to "$home/.vim"
|
@@ -31,7 +31,6 @@ Feature: Version conflict
|
|
31
31
|
$foo_uri ~> 2.0 is required by $qux_uri
|
32
32
|
Please resolve the conflict.
|
33
33
|
"""
|
34
|
-
And a bootstrap script is not created in "$home/.vim"
|
35
34
|
And a flavor "$foo_uri" is not deployed to "$home/.vim"
|
36
35
|
And a flavor "$bar_uri" is not deployed to "$home/.vim"
|
37
36
|
And a flavor "$qux_uri" is not deployed to "$home/.vim"
|
@@ -59,6 +58,5 @@ Feature: Version conflict
|
|
59
58
|
$foo_uri >= 2.0 is required by you
|
60
59
|
Please resolve the conflict.
|
61
60
|
"""
|
62
|
-
And a bootstrap script is not created in "$home/.vim"
|
63
61
|
And a flavor "$foo_uri" is not deployed to "$home/.vim"
|
64
62
|
And a flavor "$bar_uri" is not deployed to "$home/.vim"
|
@@ -7,7 +7,12 @@ Then 'it should pass' do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Then /^it should (pass|fail) with template:$/ do |pass_fail, template|
|
10
|
-
|
10
|
+
expect(last_command_started).to have_output(an_output_string_including(expand(template)))
|
11
|
+
if pass_fail == 'pass'
|
12
|
+
expect(last_command_started).to be_successfully_executed
|
13
|
+
else
|
14
|
+
expect(last_command_started).not_to be_successfully_executed
|
15
|
+
end
|
11
16
|
end
|
12
17
|
|
13
18
|
When /^I run `(.*)` \(variables expanded\)$/ do |command|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
Then /^a dependency "(.*)" is stored in "(.*)"$/ do |repo_name, deps_path|
|
2
|
+
cache_path = "#{deps_path}/#{repo_name.zap}"
|
2
3
|
steps %Q{
|
3
|
-
Then a directory named "#{
|
4
|
+
Then a directory named "#{path_for_step(cache_path)}" should exist
|
4
5
|
}
|
5
6
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Given /^an executable file named "(.*)" with:$/ do |file_path, content|
|
2
2
|
steps %Q{
|
3
|
-
Given a file named "#{file_path}" with:
|
3
|
+
Given a file named "#{path_for_step(file_path)}" with:
|
4
4
|
"""
|
5
5
|
#{content}
|
6
6
|
"""
|
7
7
|
}
|
8
|
-
File.chmod(0755, File.join([
|
8
|
+
File.chmod(0755, File.join([expand_path('.'), file_path]))
|
9
9
|
end
|
@@ -18,7 +18,11 @@ Given /^the repository "([^"]*)" has versions "([^"]*)"$/ do |basename, versions
|
|
18
18
|
end
|
19
19
|
|
20
20
|
Given /^the repository "([^"]*)" has versions "([^"]*)" and a flavorfile:$/ do |basename, versions, flavorfile_content|
|
21
|
-
add_new_versions_to_repo(basename, versions, flavorfile_content)
|
21
|
+
add_new_versions_to_repo(basename, versions, flavorfile_content, :new)
|
22
|
+
end
|
23
|
+
|
24
|
+
Given /^the repository "([^"]*)" has versions "([^"]*)" and an old name flavorfile:$/ do |basename, versions, flavorfile_content|
|
25
|
+
add_new_versions_to_repo(basename, versions, flavorfile_content, :old)
|
22
26
|
end
|
23
27
|
|
24
28
|
Given /^a (?:(?:GitHub|local) )?repository "([^"]*)" with versions "([^"]*)"$/ do |basename, versions|
|
@@ -38,6 +42,16 @@ Given /^a (?:(?:GitHub|local) )?repository "([^"]*)" with versions "([^"]*)" and
|
|
38
42
|
}
|
39
43
|
end
|
40
44
|
|
45
|
+
Given /^a (?:(?:GitHub|local) )?repository "([^"]*)" with versions "([^"]*)" and an old name flavorfile:$/ do |basename, versions, flavorfile_content|
|
46
|
+
steps %Q{
|
47
|
+
Given a repository "#{basename}"
|
48
|
+
And the repository "#{basename}" has versions "#{versions}" and an old name flavorfile:
|
49
|
+
"""
|
50
|
+
#{flavorfile_content}
|
51
|
+
"""
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
41
55
|
Given /^"([^"]*)" version "([^"]*)" is released$/ do |basename, version|
|
42
56
|
steps %Q{
|
43
57
|
Given the repository "#{basename}" has versions "#{version}"
|
@@ -58,21 +72,22 @@ Given /^a repository "([^"]*)" from offline cache$/ do |repo_name|
|
|
58
72
|
repository_path = make_repo_path(repo_name).sub(expand('$tmp/'), '')
|
59
73
|
sh <<-"END"
|
60
74
|
{
|
61
|
-
git clone --quiet --no-checkout 'vendor/#{repo_name}' '#{
|
75
|
+
git clone --quiet --no-checkout 'vendor/#{repo_name}' '#{expand_path('.')}/#{repository_path}'
|
62
76
|
} >/dev/null
|
63
77
|
END
|
64
78
|
end
|
65
79
|
|
66
80
|
Given /^I disable network to the original repository of "([^"]*)"$/ do |basename|
|
67
81
|
steps %Q{
|
68
|
-
Given I delete the directory "#{make_repo_path(basename)}"
|
82
|
+
Given I delete the directory "#{path_for_step(make_repo_path(basename))}"
|
69
83
|
}
|
70
84
|
end
|
71
85
|
|
72
86
|
When /^I create a file named "([^"]*)" in "([^"]*)" deployed to "([^"]*)"$/ do |file_name, v_repo_name, v_vimfiles_path|
|
73
87
|
flavor_path = make_flavor_path(expand(v_vimfiles_path), expand(v_repo_name))
|
88
|
+
file_path = "#{flavor_path}/#{file_name}"
|
74
89
|
steps %Q{
|
75
|
-
When I write to "#{
|
90
|
+
When I write to "#{path_for_step(file_path)}" with:
|
76
91
|
"""
|
77
92
|
"""
|
78
93
|
}
|
@@ -82,24 +97,24 @@ Then /^a flavor "([^"]*)" version "([^"]*)" is deployed to "([^"]*)"$/ do |v_rep
|
|
82
97
|
flavor_path = make_flavor_path(expand(v_vimfiles_path), expand(v_repo_name))
|
83
98
|
basename = expand(v_repo_name).split('/').last.sub(/^vim-/, '')
|
84
99
|
steps %Q{
|
85
|
-
Then the file "#{flavor_path}/doc/#{basename}.txt" should contain:
|
100
|
+
Then the file "#{path_for_step(flavor_path)}/doc/#{basename}.txt" should contain:
|
86
101
|
"""
|
87
102
|
*#{basename}* #{version}
|
88
103
|
"""
|
89
|
-
Then a file named "#{flavor_path}/doc/tags" should exist
|
104
|
+
Then a file named "#{path_for_step(flavor_path)}/doc/tags" should exist
|
90
105
|
}
|
91
106
|
end
|
92
107
|
|
93
108
|
Then /^a flavor "([^"]*)" is not deployed to "([^"]*)"$/ do |v_repo_name, v_vimfiles_path|
|
94
109
|
flavor_path = make_flavor_path(expand(v_vimfiles_path), expand(v_repo_name))
|
95
110
|
steps %Q{
|
96
|
-
Then a directory named "#{flavor_path}" should not exist
|
111
|
+
Then a directory named "#{path_for_step(flavor_path)}" should not exist
|
97
112
|
}
|
98
113
|
end
|
99
114
|
|
100
115
|
Then /^"([^"]*)" version "([^"]*)" is (?:(not) )?cached$/ do |v_repo_name, version, p|
|
101
116
|
d = make_cached_repo_path(expand(v_repo_name), expand('$home').to_stash_path)
|
102
|
-
(system <<-"END").
|
117
|
+
expect(system <<-"END").to equal(p != 'not')
|
103
118
|
{
|
104
119
|
cd '#{d}' &&
|
105
120
|
git rev-list --quiet '#{version}'
|
@@ -109,7 +124,8 @@ end
|
|
109
124
|
|
110
125
|
Then /^a file named "([^"]*)" (should(?: not)?) exist in "([^"]*)" deployed to "([^"]*)"$/ do |file_name, should, v_repo_name, v_vimfiles_path|
|
111
126
|
flavor_path = make_flavor_path(expand(v_vimfiles_path), expand(v_repo_name))
|
127
|
+
file_path = "#{flavor_path}/#{file_name}"
|
112
128
|
steps %Q{
|
113
|
-
Then a file named "#{
|
129
|
+
Then a file named "#{path_for_step(file_path)}" #{should} exist
|
114
130
|
}
|
115
131
|
end
|
@@ -1,6 +1,15 @@
|
|
1
1
|
Given 'a flavorfile with:' do |content|
|
2
2
|
steps %Q{
|
3
|
-
Given a file named "#{'.'.to_flavorfile_path}" with:
|
3
|
+
Given a file named "#{path_for_step(expand_path('.').to_flavorfile_path)}" with:
|
4
|
+
"""
|
5
|
+
#{expand(content)}
|
6
|
+
"""
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
Given 'an old name flavorfile with:' do |content|
|
11
|
+
steps %Q{
|
12
|
+
Given a file named "#{path_for_step("#{expand_path('.')}/VimFlavor")}" with:
|
4
13
|
"""
|
5
14
|
#{expand(content)}
|
6
15
|
"""
|
@@ -1,6 +1,15 @@
|
|
1
1
|
Given 'a lockfile with:' do |content|
|
2
2
|
steps %Q{
|
3
|
-
Given a file named "#{'.'.to_lockfile_path}" with:
|
3
|
+
Given a file named "#{path_for_step(expand_path('.').to_lockfile_path)}" with:
|
4
|
+
"""
|
5
|
+
#{expand(content)}
|
6
|
+
"""
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
Given 'an old name lockfile with:' do |content|
|
11
|
+
steps %Q{
|
12
|
+
Given a file named "#{path_for_step("#{expand_path('.')}/VimFlavor.lock")}" with:
|
4
13
|
"""
|
5
14
|
#{expand(content)}
|
6
15
|
"""
|
@@ -18,7 +27,7 @@ end
|
|
18
27
|
|
19
28
|
Given 'I delete the lockfile' do
|
20
29
|
steps %Q{
|
21
|
-
Given I remove the file "#{'.'.to_lockfile_path}"
|
30
|
+
Given I remove the file "#{path_for_step(expand_path('.').to_lockfile_path)}"
|
22
31
|
}
|
23
32
|
end
|
24
33
|
|
@@ -34,7 +43,7 @@ end
|
|
34
43
|
Then /^(?:a|the) lockfile is (?:created|updated) with:$/ do |content|
|
35
44
|
# For some reason, Cucumber drops the last newline from every docstring...
|
36
45
|
steps %Q{
|
37
|
-
Then the file "#{'.'.to_lockfile_path}" should contain exactly:
|
46
|
+
Then the file "#{path_for_step(expand_path('.').to_lockfile_path)}" should contain exactly:
|
38
47
|
"""
|
39
48
|
#{content == '' ? '' : expand(content) + "\n"}
|
40
49
|
"""
|
@@ -42,11 +51,11 @@ Then /^(?:a|the) lockfile is (?:created|updated) with:$/ do |content|
|
|
42
51
|
end
|
43
52
|
|
44
53
|
Then /^(?:a|the) lockfile is (?:created|updated) and matches with:$/ do |content|
|
45
|
-
|
54
|
+
expect(path_for_step(expand_path('.').to_lockfile_path)).to have_file_content(/#{content}/)
|
46
55
|
end
|
47
56
|
|
48
57
|
Then /^(?:a|the) lockfile is not created$/ do
|
49
58
|
steps %Q{
|
50
|
-
Then a file named "#{'.'.to_lockfile_path}" should not exist
|
59
|
+
Then a file named "#{path_for_step(expand_path('.').to_lockfile_path)}" should not exist
|
51
60
|
}
|
52
61
|
end
|
data/features/support/env.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require 'aruba/api'
|
2
2
|
require 'aruba/cucumber'
|
3
3
|
require 'fileutils'
|
4
|
+
require 'pathname'
|
4
5
|
require 'vim-flavor'
|
5
6
|
|
6
7
|
class FakeUserEnvironment
|
7
8
|
include Vim::Flavor::ShellUtility
|
8
9
|
|
9
|
-
def add_new_versions_to_repo(basename, versions, flavorfile_content = nil)
|
10
|
+
def add_new_versions_to_repo(basename, versions, flavorfile_content = nil, naming_style = :new)
|
10
11
|
repository_path = make_repo_path(basename)
|
12
|
+
flavorfile_path = naming_style == :new ?
|
13
|
+
repository_path.to_flavorfile_path :
|
14
|
+
"#{repository_path}/VimFlavor"
|
11
15
|
doc_name = basename.split('/').last.sub(/^vim-/, '')
|
12
16
|
sh <<-"END"
|
13
17
|
{
|
@@ -19,10 +23,10 @@ class FakeUserEnvironment
|
|
19
23
|
git add doc
|
20
24
|
#{
|
21
25
|
%Q{
|
22
|
-
cat <<'FF' >#{
|
26
|
+
cat <<'FF' >#{flavorfile_path}
|
23
27
|
#{expand(flavorfile_content)}
|
24
28
|
FF
|
25
|
-
git add #{
|
29
|
+
git add #{flavorfile_path}
|
26
30
|
} if flavorfile_content
|
27
31
|
}
|
28
32
|
git commit -m "Version $v"
|
@@ -44,6 +48,16 @@ FF
|
|
44
48
|
}
|
45
49
|
end
|
46
50
|
|
51
|
+
def path_for_step(path)
|
52
|
+
cwd = Pathname.new(expand_path('.'))
|
53
|
+
pathd = Pathname.new(path)
|
54
|
+
if not pathd.absolute?
|
55
|
+
pathd = cwd + pathd
|
56
|
+
end
|
57
|
+
|
58
|
+
pathd.relative_path_from(cwd).to_s
|
59
|
+
end
|
60
|
+
|
47
61
|
def make_cached_repo_path(repo_name, stash_path)
|
48
62
|
"#{stash_path}/repos/#{repo_name.zap}"
|
49
63
|
end
|
@@ -68,22 +82,18 @@ end
|
|
68
82
|
Before do
|
69
83
|
variable_table['version'] = Vim::Flavor::VERSION
|
70
84
|
|
71
|
-
variable_table['tmp'] = File.absolute_path(
|
85
|
+
variable_table['tmp'] = File.absolute_path(expand_path('.'))
|
72
86
|
|
73
87
|
steps %Q{
|
74
88
|
Given a directory named "home"
|
75
89
|
}
|
76
|
-
variable_table['home'] = File.absolute_path(File.join([
|
90
|
+
variable_table['home'] = File.absolute_path(File.join([expand_path('.'), 'home']))
|
77
91
|
|
78
92
|
@aruba_timeout_seconds = 5
|
79
|
-
end
|
80
93
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
set_env 'VIM_FLAVOR_GITHUB_URI_PREFIX', expand('file://$tmp/repos/')
|
85
|
-
set_env 'VIM_FLAVOR_GITHUB_URI_SUFFIX', ''
|
86
|
-
end
|
94
|
+
set_environment_variable 'VIM_FLAVOR_HOME', variable_table['home']
|
95
|
+
set_environment_variable 'VIM_FLAVOR_GITHUB_URI_PREFIX', expand('file://$tmp/repos/')
|
96
|
+
set_environment_variable 'VIM_FLAVOR_GITHUB_URI_SUFFIX', ''
|
87
97
|
end
|
88
98
|
|
89
99
|
World do
|