vim-flavor 1.1.5 → 2.0.0

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/features/.nav +6 -0
  4. data/features/branches/README.md +12 -0
  5. data/features/branches/changing_tracking_branches.feature +78 -0
  6. data/features/branches/detect_incompatible_declarations.feature +72 -0
  7. data/features/branches/install.feature +51 -0
  8. data/features/branches/upgrade.feature +30 -0
  9. data/features/install_vim_flavor.md +1 -1
  10. data/features/news.md +10 -0
  11. data/features/philosophy.md +22 -1
  12. data/features/resolve_dependencies/basics.feature +0 -32
  13. data/features/step_definitions/flavor_steps.rb +10 -0
  14. data/features/support/env.rb +7 -1
  15. data/features/version_lock.feature +1 -20
  16. data/features/version_tag_format.feature +44 -8
  17. data/lib/vim-flavor.rb +2 -0
  18. data/lib/vim-flavor/branchversion.rb +28 -0
  19. data/lib/vim-flavor/facade.rb +7 -3
  20. data/lib/vim-flavor/flavor.rb +20 -5
  21. data/lib/vim-flavor/flavorfile.rb +13 -12
  22. data/lib/vim-flavor/lockfileparser.rb +18 -4
  23. data/lib/vim-flavor/plainversion.rb +28 -0
  24. data/lib/vim-flavor/version.rb +10 -17
  25. data/lib/vim-flavor/versionconstraint.rb +23 -7
  26. data/spec/branchversion_spec.rb +50 -0
  27. data/spec/enumerableextension_spec.rb +4 -4
  28. data/spec/facade_spec.rb +2 -2
  29. data/spec/flavor_spec.rb +9 -8
  30. data/spec/flavorfile_spec.rb +44 -25
  31. data/spec/lockfile_spec.rb +58 -23
  32. data/spec/plainversion_spec.rb +75 -0
  33. data/spec/spec_helper.rb +10 -0
  34. data/spec/stringextension_spec.rb +4 -3
  35. data/spec/version_spec.rb +33 -51
  36. data/spec/versionconstraint_spec.rb +81 -26
  37. data/vim-flavor.gemspec +1 -0
  38. metadata +35 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3af3445611a09f669898cdd66a43f7591dc17b1a
4
- data.tar.gz: 1ded87c558b1572b3f7a8099e71c9d64ac84126f
3
+ metadata.gz: ed8e9b52605c8aaa5285aa081653824e1f4c0e1b
4
+ data.tar.gz: c300452d28a9bdebeaa480d40d85c5a641ebda59
5
5
  SHA512:
6
- metadata.gz: 01a5437a08c3acf45fa9f071099d1cd4f5e7bb1af8bd710f7e0fb9533fc5995ed126d7391b3cd50b3be277e3d9124ad65a667a5e6735f5c503dcbe7cb089b330
7
- data.tar.gz: aa9837dd97da4f11979b9762dcf443a55526e62bceee3edaad4aeedf9981350b5c6abbc655fa6a046c1902e6c6034da8e9e88ae278e15fcff4fdd4bac028467c
6
+ metadata.gz: d4ae143d043e5426572b17b09e9d5006cbaadd7ba787fac00afcbed39b1b2c915ddff92519e5c66f48e4dbea89c4b91fec712f666c06ac1881a6b29a2571201e
7
+ data.tar.gz: ca4552878793038715ca13b5eb46a1641dec9d7b9b99473a103548c8380ec2fcd0cf39a09785c195c27323f6cbe9e82d1c88a539bfca1741853b7c3f62f73ae1
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0.0
4
+ - 2.1.0
5
5
  before_script:
6
6
  - git config --global 'user.name' 'Travis CI'
7
7
  - git config --global 'user.email' 'user@example.com'
data/features/.nav CHANGED
@@ -1,3 +1,4 @@
1
+ - news.md
1
2
  - philosophy.md
2
3
  - install_vim_flavor.md (Install vim-flavor)
3
4
  - uninstall_vim_flavor.md (Uninstall vim-flavor)
@@ -17,3 +18,8 @@
17
18
  - failures.feature
18
19
  - specifying_test_scripts.feature
19
20
  - version_tag_format.feature
21
+ - branches:
22
+ - install.feature
23
+ - upgrade.feature
24
+ - changing_tracking_branches.feature
25
+ - detect_incompatible_declarations.feature
@@ -0,0 +1,12 @@
1
+ Sometimes it's necessary to try out proposed changes of a Vim plugin which are
2
+ not released as a proper version. So that `vim-flavor` can also track the
3
+ latest revision of a specific branch of a Vim plugin.
4
+
5
+ Unlike plain versions, branches are not comparable. So that it's not possible
6
+ to detect incompatible plugins before installing. It's not recommended for
7
+ daily use. Use branches at your own risk.
8
+
9
+
10
+
11
+
12
+ <!-- vim: set expandtab shiftwidth=4 softtabstop=4 textwidth=78 : -->
@@ -0,0 +1,78 @@
1
+ Feature: Changing tracking branches
2
+ In order to try out another branch instead of the currently used one,
3
+ as a lazy Vim user,
4
+ I want to use the latest revision of the new branch.
5
+
6
+ Background:
7
+ Given a repository "foo" with versions "1.0.0 1.0.1 1.0.2"
8
+
9
+ Scenario: Changing tracking branches
10
+ Given a flavorfile with:
11
+ """ruby
12
+ flavor '$foo_uri', branch: 'master'
13
+ """
14
+ And a lockfile with:
15
+ """
16
+ $foo_uri ($foo_rev_101 at experimental)
17
+ """
18
+ When I run `vim-flavor install`
19
+ Then it should pass with template:
20
+ """
21
+ Checking versions...
22
+ Use $foo_uri ... $foo_rev_102 at master
23
+ Deploying plugins...
24
+ $foo_uri $foo_rev_102 at master ... done
25
+ Completed.
26
+ """
27
+ And a bootstrap script is created in "$home/.vim"
28
+ And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
29
+
30
+ Scenario: Use a branch instead of a version
31
+ Given a flavorfile with:
32
+ """ruby
33
+ flavor '$foo_uri', branch: 'master'
34
+ """
35
+ And a lockfile with:
36
+ """
37
+ $foo_uri (1.0.1)
38
+ """
39
+ When I run `vim-flavor install`
40
+ Then it should pass with template:
41
+ """
42
+ Checking versions...
43
+ Use $foo_uri ... $foo_rev_102 at master
44
+ Deploying plugins...
45
+ $foo_uri $foo_rev_102 at master ... done
46
+ Completed.
47
+ """
48
+ And a lockfile is created with:
49
+ """
50
+ $foo_uri ($foo_rev_102 at master)
51
+ """
52
+ And a bootstrap script is created in "$home/.vim"
53
+ And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
54
+
55
+ Scenario: Use a version instead of a branch
56
+ Given a flavorfile with:
57
+ """ruby
58
+ flavor '$foo_uri', '~> 1.0.1'
59
+ """
60
+ And a lockfile with:
61
+ """
62
+ $foo_uri ($foo_rev_100 at master)
63
+ """
64
+ When I run `vim-flavor install`
65
+ Then it should pass with template:
66
+ """
67
+ Checking versions...
68
+ Use $foo_uri ... 1.0.2
69
+ Deploying plugins...
70
+ $foo_uri 1.0.2 ... done
71
+ Completed.
72
+ """
73
+ And a lockfile is created with:
74
+ """
75
+ $foo_uri (1.0.2)
76
+ """
77
+ And a bootstrap script is created in "$home/.vim"
78
+ And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
@@ -0,0 +1,72 @@
1
+ Feature: Detect incompatible declarations
2
+ In order to avoid using Vim with inconsistent configurations,
3
+ as a lazy Vim user,
4
+ I want to detect incompatible declaratios before installing Vim plugins.
5
+
6
+ Scenario: Detect incompatible branches
7
+ Given a repository "L" with versions "0.1 0.2 0.3 0.4"
8
+ And "L" has "experimental" branch
9
+ And a repository "A" with versions "0.0" and a flavorfile:
10
+ """ruby
11
+ flavor '$L_uri', branch: 'master'
12
+ """
13
+ And a repository "B" with versions "0.0" and a flavorfile:
14
+ """ruby
15
+ flavor '$L_uri', branch: 'experimental'
16
+ """
17
+ And a flavorfile with:
18
+ """ruby
19
+ flavor '$A_uri'
20
+ flavor '$B_uri'
21
+ """
22
+ When I run `vim-flavor install`
23
+ Then it should fail with template:
24
+ """
25
+ Checking versions...
26
+ Use $A_uri ... 0.0
27
+ Use $L_uri ... $L_rev_04 at master
28
+ Use $B_uri ... 0.0
29
+ Use $L_uri ... $L_rev_04 at experimental
30
+ Found incompatible declarations:
31
+ $L_uri branch: master is required by $A_uri
32
+ $L_uri branch: experimental is required by $B_uri
33
+ Please resolve the conflict.
34
+ """
35
+ And a bootstrap script is not created in "$home/.vim"
36
+ And a flavor "$A_uri" is not deployed to "$home/.vim"
37
+ And a flavor "$B_uri" is not deployed to "$home/.vim"
38
+ And a flavor "$L_uri" is not deployed to "$home/.vim"
39
+
40
+ Scenario: Detect mixed use of branchs and versions
41
+ Given a repository "L" with versions "0.1 0.2 0.3 0.4"
42
+ And "L" has "experimental" branch
43
+ And a repository "A" with versions "0.0" and a flavorfile:
44
+ """ruby
45
+ flavor '$L_uri', branch: 'master'
46
+ """
47
+ And a repository "B" with versions "0.0" and a flavorfile:
48
+ """ruby
49
+ flavor '$L_uri', '~> 0.2'
50
+ """
51
+ And a flavorfile with:
52
+ """ruby
53
+ flavor '$A_uri'
54
+ flavor '$B_uri'
55
+ """
56
+ When I run `vim-flavor install`
57
+ Then it should fail with template:
58
+ """
59
+ Checking versions...
60
+ Use $A_uri ... 0.0
61
+ Use $L_uri ... $L_rev_04 at master
62
+ Use $B_uri ... 0.0
63
+ Use $L_uri ... 0.4
64
+ Found incompatible declarations:
65
+ $L_uri branch: master is required by $A_uri
66
+ $L_uri ~> 0.2 is required by $B_uri
67
+ Please resolve the conflict.
68
+ """
69
+ And a bootstrap script is not created in "$home/.vim"
70
+ And a flavor "$A_uri" is not deployed to "$home/.vim"
71
+ And a flavor "$B_uri" is not deployed to "$home/.vim"
72
+ And a flavor "$L_uri" is not deployed to "$home/.vim"
@@ -0,0 +1,51 @@
1
+ Feature: Install Vim plugins with specific branches
2
+ In order to try out proposed changes which are not released yet,
3
+ as a lazy Vim user,
4
+ I want to track the latest revision of a specific branch.
5
+
6
+ Background:
7
+ Given a repository "foo" with versions "1.0.0 1.0.1 1.0.2"
8
+
9
+ Scenario: Install a new plugin from scratch
10
+ Given a flavorfile with:
11
+ """ruby
12
+ flavor '$foo_uri', branch: 'master'
13
+ """
14
+ When I run `vim-flavor install`
15
+ Then it should pass with template:
16
+ """
17
+ Checking versions...
18
+ Use $foo_uri ... $foo_rev_102 at master
19
+ Deploying plugins...
20
+ $foo_uri $foo_rev_102 at master ... done
21
+ Completed.
22
+ """
23
+ And a lockfile is created with:
24
+ """
25
+ $foo_uri ($foo_rev_102 at master)
26
+ """
27
+ And a bootstrap script is created in "$home/.vim"
28
+ And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
29
+
30
+ Scenario: Install a plugin according to a lockfile
31
+ Given a flavorfile with:
32
+ """ruby
33
+ flavor '$foo_uri', branch: 'master'
34
+ """
35
+ And I run `vim-flavor install`
36
+ And a lockfile is created with:
37
+ """
38
+ $foo_uri ($foo_rev_102 at master)
39
+ """
40
+ And "foo" version "1.0.3" is released
41
+ When I run `vim-flavor install`
42
+ Then it should pass with template:
43
+ """
44
+ Checking versions...
45
+ Use $foo_uri ... $foo_rev_102 at master
46
+ Deploying plugins...
47
+ $foo_uri $foo_rev_102 at master ... skipped (already deployed)
48
+ Completed.
49
+ """
50
+ And a bootstrap script is created in "$home/.vim"
51
+ And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
@@ -0,0 +1,30 @@
1
+ Feature: Upgrade Vim plugins with specific branches
2
+ In order to try out proposed changes which are not released yet,
3
+ as a lazy Vim user,
4
+ I want to track the latest revision of a specific branch.
5
+
6
+ Background:
7
+ Given a repository "foo" with versions "1.0.0 1.0.1 1.0.2"
8
+
9
+ Scenario: Upgrade a plugin
10
+ Given a flavorfile with:
11
+ """ruby
12
+ flavor '$foo_uri', branch: 'master'
13
+ """
14
+ And I run `vim-flavor install`
15
+ And a lockfile is created with:
16
+ """
17
+ $foo_uri ($foo_rev_102 at master)
18
+ """
19
+ And "foo" version "1.0.3" is released
20
+ When I run `vim-flavor upgrade`
21
+ Then it should pass with template:
22
+ """
23
+ Checking versions...
24
+ Use $foo_uri ... $foo_rev_103 at master
25
+ Deploying plugins...
26
+ $foo_uri $foo_rev_103 at master ... done
27
+ Completed.
28
+ """
29
+ And a bootstrap script is created in "$home/.vim"
30
+ And a flavor "$foo_uri" version "1.0.3" is deployed to "$home/.vim"
@@ -1,7 +1,7 @@
1
1
  ## Required softwares
2
2
 
3
3
  * [Git](http://git-scm.com/) 1.7.9 or later
4
- * [Ruby](http://www.ruby-lang.org/) 1.9.2 or later
4
+ * [Ruby](http://www.ruby-lang.org/) 2.0.0 or later
5
5
  * Recommendation: Use [RVM](http://beginrescueend.com/) or other tools
6
6
  for ease of installation across different envinronments.
7
7
  * [Vim](http://www.vim.org/) 7.3 or later
data/features/news.md ADDED
@@ -0,0 +1,10 @@
1
+ ## vim-flavor 2.0.0
2
+
3
+ ### Feature additions
4
+
5
+ * [Branches](./branches) are supported.
6
+
7
+
8
+ ### Incompatible changes
9
+
10
+ * Ruby 2.0.0 or later is required to run vim-flavor.
@@ -1,6 +1,6 @@
1
1
  ## Installable plugins
2
2
 
3
- Not all Vim plugins can be installed with vim-flavor.
3
+ Basically, not all Vim plugins can be installed with vim-flavor.
4
4
  vim-flavor can install plugins which meet the following conditions:
5
5
 
6
6
  * Plugins must have dedicated Git repositories.
@@ -41,6 +41,27 @@ vim-flavor can install plugins which meet the following conditions:
41
41
  Such plugins are not ready to use for everyone.
42
42
  So that it should not be installable.
43
43
 
44
+ Though the above principle is not changed, nowadays (2014)
45
+
46
+ * www.vim.org becomes less popular as a central repository of Vim plugins.
47
+ Because:
48
+ * It's a tedious task to publish plugins at www.vim.org because there is no
49
+ standard tool to automate the process to publish plugins.
50
+ * As GitHub becomes more popular, many plugin authors seem to choose only
51
+ GitHub to publish plugins because it is easy and fast.
52
+ * As a result, vim-scripts.org's mirrors are mostly outdated. Latest versions
53
+ are not usually found in the mirrors. So that GitHub repositories rather
54
+ than vim-scripts.org's mirrors are specified in [flavorfile](./flavorfile)
55
+ in most cases.
56
+ * But unlike vim-scripts.org's mirrors, "version" tags might not exist in wild
57
+ repositories.
58
+ * And sometimes it's necessary to track a brach with proposed changes which
59
+ are not ready to release as a proper version.
60
+
61
+ So that [branches](./branches) are also supported. But branches are not
62
+ comparable and it's not possible to detect incompatibility before installing
63
+ plugins. It's not recommended for daily use. Use branches at your own risk.
64
+
44
65
 
45
66
 
46
67
 
@@ -148,35 +148,3 @@ 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"
@@ -44,6 +44,16 @@ Given /^"([^"]*)" version "([^"]*)" is released$/ do |basename, version|
44
44
  }
45
45
  end
46
46
 
47
+ Given /^"([^"]*)" has "([^"]*)" branch$/ do |basename, branch|
48
+ repository_path = make_repo_path(basename)
49
+ sh <<-"END"
50
+ {
51
+ cd '#{repository_path}' &&
52
+ git branch '#{branch}'
53
+ } >/dev/null
54
+ END
55
+ end
56
+
47
57
  Given /^a repository "([^"]*)" from offline cache$/ do |repo_name|
48
58
  repository_path = make_repo_path(repo_name).sub(expand('$tmp/'), '')
49
59
  sh <<-"END"
@@ -30,10 +30,16 @@ FF
30
30
  done
31
31
  } >/dev/null
32
32
  END
33
+ versions.split.each do |v|
34
+ variable_table["#{basename}_rev_#{v.gsub('.', '')}"] = sh(<<-"END").chomp
35
+ cd '#{repository_path}' &&
36
+ git rev-list -n1 '#{v}' --
37
+ END
38
+ end
33
39
  end
34
40
 
35
41
  def expand(virtual_path)
36
- virtual_path.gsub(/\$([A-Za-z_]+)/) {
42
+ virtual_path.gsub(/\$([A-Za-z0-9_]+)/) {
37
43
  variable_table[$1]
38
44
  }
39
45
  end
@@ -3,7 +3,7 @@ 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
- Scenario: Install with a lockfile including "X.Y.Z" style tags
6
+ Scenario: Install with a lockfile
7
7
  Given a repository "foo" with versions "1.0.0 1.0.1 1.0.2"
8
8
  And a flavorfile with:
9
9
  """ruby
@@ -21,22 +21,3 @@ Feature: Version lock
21
21
  """
22
22
  And a bootstrap script is created in "$home/.vim"
23
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"