vim-flavor 2.2.1 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +5 -5
  2. data/.github/dependabot.yml +12 -0
  3. data/.github/workflows/ci.yml +35 -0
  4. data/.gitmodules +2 -2
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +169 -0
  7. data/README.md +133 -45
  8. data/Rakefile +11 -0
  9. data/config/cucumber.yml +1 -0
  10. data/features/.nav +2 -1
  11. data/features/backward_compatibilities/flavorfile.feature +166 -0
  12. data/features/backward_compatibilities/lockfile.feature +22 -0
  13. data/features/branches/changing_tracking_branches.feature +0 -3
  14. data/features/branches/detect_incompatible_declarations.feature +0 -2
  15. data/features/branches/install.feature +0 -2
  16. data/features/branches/update.feature +0 -1
  17. data/features/caching/deployment.feature +1 -0
  18. data/features/flavorfile/README.md +1 -1
  19. data/features/flavorfile/comments.feature +0 -1
  20. data/features/flavorfile/groups.feature +0 -3
  21. data/features/flavorfile/repository_name.feature +2 -5
  22. data/features/flavorfile/version_constraint.feature +3 -7
  23. data/features/install_vim_flavor.md +6 -12
  24. data/features/news.md +1 -0
  25. data/features/philosophy.md +4 -4
  26. data/features/resolve_dependencies/README.md +4 -3
  27. data/features/resolve_dependencies/basics.feature +0 -4
  28. data/features/resolve_dependencies/upgrade_outdated_dependencies.feature +0 -2
  29. data/features/resolve_dependencies/version_conflict.feature +0 -2
  30. data/features/step_definitions/cli_steps.rb +6 -1
  31. data/features/step_definitions/dependency_steps.rb +2 -1
  32. data/features/step_definitions/directory_steps.rb +1 -1
  33. data/features/step_definitions/file_steps.rb +2 -2
  34. data/features/step_definitions/flavor_steps.rb +25 -9
  35. data/features/step_definitions/flavorfile_steps.rb +10 -1
  36. data/features/step_definitions/lockfile_steps.rb +14 -5
  37. data/features/support/env.rb +22 -12
  38. data/features/testing_vim_plugins/README.md +7 -6
  39. data/features/testing_vim_plugins/dependencies.feature +14 -15
  40. data/features/testing_vim_plugins/failures.feature +6 -6
  41. data/features/testing_vim_plugins/specifying_test_scripts.feature +12 -12
  42. data/features/testing_vim_plugins/typical_usage.feature +33 -10
  43. data/features/typical_usage/README.md +7 -7
  44. data/features/typical_usage/deploy_to_arbitrary_place.feature +0 -1
  45. data/features/typical_usage/install_vim_plugins.feature +0 -1
  46. data/features/typical_usage/uninstall_vim_plugins.feature +0 -1
  47. data/features/typical_usage/update_vim_plugins.feature +0 -3
  48. data/features/uninstall_vim_flavor.md +3 -4
  49. data/features/version_lock.feature +0 -1
  50. data/features/version_tag_format.feature +0 -4
  51. data/lib/vim-flavor/cli.rb +2 -2
  52. data/lib/vim-flavor/console.rb +22 -0
  53. data/lib/vim-flavor/env.rb +1 -1
  54. data/lib/vim-flavor/facade.rb +18 -49
  55. data/lib/vim-flavor/flavor.rb +1 -1
  56. data/lib/vim-flavor/flavorfile.rb +24 -1
  57. data/lib/vim-flavor/lockfile.rb +15 -0
  58. data/lib/vim-flavor/shellutility.rb +2 -1
  59. data/lib/vim-flavor/stringextension.rb +3 -11
  60. data/lib/vim-flavor/version.rb +1 -1
  61. data/lib/vim-flavor.rb +1 -1
  62. data/spec/branchversion_spec.rb +4 -4
  63. data/spec/stringextension_spec.rb +33 -2
  64. data/vim-flavor.gemspec +8 -5
  65. metadata +70 -26
  66. data/.travis.yml +0 -7
  67. data/features/news.md +0 -55
  68. data/features/step_definitions/bootstrap_script_steps.rb +0 -6
  69. data/spec/facade_spec.rb +0 -57
@@ -36,11 +36,11 @@ Feature: Dependencies
36
36
  """
37
37
  -------- Preparing dependencies
38
38
  Checking versions...
39
- Use kana/vim-textobj-user ... 0\.\d+(\.\d+)?
40
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
39
+ Use kana/vim-textobj-user ... v?\d+\.\d+(\.\d+)?
40
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
41
41
  Deploying plugins...
42
- kana/vim-textobj-user 0\.\d+(\.\d+)? ... done
43
- kana/vim-vspec 1\.\d+(\.\d+)? ... done
42
+ kana/vim-textobj-user v?\d+\.\d+(\.\d+)? ... done
43
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
44
44
  Completed.
45
45
  -------- Testing a Vim plugin
46
46
  t/basics.vim .. ok
@@ -50,11 +50,11 @@ Feature: Dependencies
50
50
  """
51
51
  And a lockfile is created and matches with:
52
52
  """
53
- kana/vim-textobj-user \(0\.\d+(\.\d+)?\)
54
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
53
+ kana/vim-textobj-user \(v?\d+\.\d+(\.\d+)?\)
54
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
55
55
  """
56
- And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
57
- And a dependency "kana/vim-textobj-user" is stored in ".vim-flavor/deps"
56
+ And a dependency "kana/vim-vspec" is stored in ".vim-flavor/pack/flavors/start"
57
+ And a dependency "kana/vim-textobj-user" is stored in ".vim-flavor/pack/flavors/start"
58
58
 
59
59
  Scenario: Update dependencies for testing
60
60
  Given a flavorfile with:
@@ -72,10 +72,10 @@ Feature: Dependencies
72
72
  -------- Preparing dependencies
73
73
  Checking versions...
74
74
  Use kana/vim-textobj-user ... 0\.3\.5
75
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
75
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
76
76
  Deploying plugins...
77
77
  kana/vim-textobj-user 0\.3\.5 ... done
78
- kana/vim-vspec 1\.\d+(\.\d+)? ... done
78
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
79
79
  Completed.
80
80
  -------- Testing a Vim plugin
81
81
  Files=0, Tests=0, \d+ wallclock secs .*
@@ -84,19 +84,18 @@ Feature: Dependencies
84
84
  And a lockfile is updated and matches with:
85
85
  """
86
86
  kana/vim-textobj-user \(0\.3\.5\)
87
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
87
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
88
88
  """
89
89
  When I run `vim-flavor test --update-dependencies`
90
90
  Then it should pass with regexp:
91
91
  """
92
- .*
93
92
  -------- Preparing dependencies
94
93
  Checking versions...
95
94
  Use kana/vim-textobj-user ... 0\.3\.13
96
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
95
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
97
96
  Deploying plugins...
98
97
  kana/vim-textobj-user 0\.3\.13 ... done
99
- kana/vim-vspec 1\.\d+(\.\d+)? ... skipped \(already deployed\)
98
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... skipped \(already deployed\)
100
99
  Completed.
101
100
  -------- Testing a Vim plugin
102
101
  Files=0, Tests=0, \d+ wallclock secs .*
@@ -105,5 +104,5 @@ Feature: Dependencies
105
104
  And a lockfile is updated and matches with:
106
105
  """
107
106
  kana/vim-textobj-user \(0\.3\.13\)
108
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
107
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
109
108
  """
@@ -29,14 +29,14 @@ Feature: Failures
29
29
  """
30
30
  -------- Preparing dependencies
31
31
  Checking versions...
32
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
32
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
33
33
  Deploying plugins...
34
- kana/vim-vspec 1\.\d+(\.\d+)? ... done
34
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
35
35
  Completed.
36
36
  -------- Testing a Vim plugin
37
37
  t/basics.vim ..\s
38
38
  not ok 1 - g:foo is equal to 5
39
- # Expected g:foo == 5
39
+ # Expected g:foo == 5 at line 1
40
40
  # Actual value: 3
41
41
  # Expected value: 5
42
42
  Failed 1/1 subtests
@@ -45,7 +45,7 @@ Feature: Failures
45
45
  -------------------
46
46
  t/basics.vim \(Wstat: 0 Tests: 1 Failed: 1\)
47
47
  Failed test: 1
48
- Files=1, Tests=1, 0 wallclock secs (.*)
48
+ Files=1, Tests=1, \d+ wallclock secs .*
49
49
  Result: FAIL
50
50
  """
51
51
  And the output should not contain:
@@ -54,6 +54,6 @@ Feature: Failures
54
54
  """
55
55
  And a lockfile is created and matches with:
56
56
  """
57
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
57
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
58
58
  """
59
- And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
59
+ And a dependency "kana/vim-vspec" is stored in ".vim-flavor/pack/flavors/start"
@@ -37,9 +37,9 @@ Feature: Specifying test scripts
37
37
  """
38
38
  -------- Preparing dependencies
39
39
  Checking versions...
40
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
40
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
41
41
  Deploying plugins...
42
- kana/vim-vspec 1\.\d+(\.\d+)? ... done
42
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
43
43
  Completed.
44
44
  -------- Testing a Vim plugin
45
45
  spec/basics.vim .. ok
@@ -50,9 +50,9 @@ Feature: Specifying test scripts
50
50
  """
51
51
  And a lockfile is created and matches with:
52
52
  """
53
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
53
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
54
54
  """
55
- And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
55
+ And a dependency "kana/vim-vspec" is stored in ".vim-flavor/pack/flavors/start"
56
56
 
57
57
  Scenario: Running a specific `.vim` test script
58
58
  When I run `vim-flavor test spec/basics.vim`
@@ -60,9 +60,9 @@ Feature: Specifying test scripts
60
60
  """
61
61
  -------- Preparing dependencies
62
62
  Checking versions...
63
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
63
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
64
64
  Deploying plugins...
65
- kana/vim-vspec 1\.\d+(\.\d+)? ... done
65
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
66
66
  Completed.
67
67
  -------- Testing a Vim plugin
68
68
  spec/basics.vim .. ok
@@ -72,9 +72,9 @@ Feature: Specifying test scripts
72
72
  """
73
73
  And a lockfile is created and matches with:
74
74
  """
75
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
75
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
76
76
  """
77
- And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
77
+ And a dependency "kana/vim-vspec" is stored in ".vim-flavor/pack/flavors/start"
78
78
 
79
79
  Scenario: Running a specific `.t` test script
80
80
  When I run `vim-flavor test spec/sh.t`
@@ -82,9 +82,9 @@ Feature: Specifying test scripts
82
82
  """
83
83
  -------- Preparing dependencies
84
84
  Checking versions...
85
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
85
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
86
86
  Deploying plugins...
87
- kana/vim-vspec 1\.\d+(\.\d+)? ... done
87
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
88
88
  Completed.
89
89
  -------- Testing a Vim plugin
90
90
  spec/sh.t .. ok
@@ -94,6 +94,6 @@ Feature: Specifying test scripts
94
94
  """
95
95
  And a lockfile is created and matches with:
96
96
  """
97
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
97
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
98
98
  """
99
- And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
99
+ And a dependency "kana/vim-vspec" is stored in ".vim-flavor/pack/flavors/start"
@@ -5,12 +5,6 @@ Feature: Typical usage
5
5
 
6
6
  Background:
7
7
  Given a repository "kana/vim-vspec" from offline cache
8
-
9
- Scenario: Testing a Vim plugin without any dependency
10
- Given a flavorfile with:
11
- """ruby
12
- # No dependency
13
- """
14
8
  And a file named "plugin/foo.vim" with:
15
9
  """vim
16
10
  let g:foo = 3
@@ -33,14 +27,43 @@ Feature: Typical usage
33
27
  echo 'ok 1'
34
28
  echo '1..1'
35
29
  """
30
+
31
+ Scenario: Testing a Vim plugin with no dependencies
32
+ Given a flavorfile with:
33
+ """ruby
34
+ # No dependencies
35
+ """
36
+ When I run `vim-flavor test`
37
+ Then it should pass with regexp:
38
+ """
39
+ -------- Preparing dependencies
40
+ Checking versions...
41
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
42
+ Deploying plugins...
43
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
44
+ Completed.
45
+ -------- Testing a Vim plugin
46
+ t/basics.vim .. ok
47
+ t/sh.t ........ ok
48
+ All tests successful.
49
+ Files=2, Tests=2, \d+ wallclock secs .*
50
+ Result: PASS
51
+ """
52
+ And a lockfile is created and matches with:
53
+ """
54
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
55
+ """
56
+ And a dependency "kana/vim-vspec" is stored in ".vim-flavor/pack/flavors/start"
57
+
58
+ Scenario: Assuming no dependencies if flavorfile does not exist
36
59
  When I run `vim-flavor test`
37
60
  Then it should pass with regexp:
38
61
  """
39
62
  -------- Preparing dependencies
40
63
  Checking versions...
41
- Use kana/vim-vspec ... 1\.\d+(\.\d+)?
64
+ Use kana/vim-vspec ... v?\d+.\d+(\.\d+)?
42
65
  Deploying plugins...
43
- kana/vim-vspec 1\.\d+(\.\d+)? ... done
66
+ kana/vim-vspec v?\d+.\d+(\.\d+)? ... done
44
67
  Completed.
45
68
  -------- Testing a Vim plugin
46
69
  t/basics.vim .. ok
@@ -51,6 +74,6 @@ Feature: Typical usage
51
74
  """
52
75
  And a lockfile is created and matches with:
53
76
  """
54
- kana/vim-vspec \(1\.\d+(\.\d+)?\)
77
+ kana/vim-vspec \(v?\d+.\d+(\.\d+)?\)
55
78
  """
56
- And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
79
+ And a dependency "kana/vim-vspec" is stored in ".vim-flavor/pack/flavors/start"
@@ -26,21 +26,21 @@ and `vim-flavor` does it.
26
26
  cd $YOUR_REPOSITORY_FOR_DOTFILES
27
27
 
28
28
  # Add, delete or change declarations which versions of Vim plugins to use.
29
- vim VimFlavor
29
+ vim Flavorfile
30
30
 
31
- # Install Vim plugins according to VimFlavor.
31
+ # Install Vim plugins according to Flavorfile.
32
32
  vim-flavor install
33
33
 
34
34
  # Record changes to the declarations and locked status.
35
- git add VimFlavor VimFlavor.lock
35
+ git add Flavorfile Flavorfile.lock
36
36
  git commit -m '...'
37
37
 
38
38
 
39
39
 
40
40
 
41
- ## Flavorfile (`VimFlavor`)
41
+ ## Flavorfile (`Flavorfile`)
42
42
 
43
- `vim-flavor` reads a file `VimFlavor` in the current working directory.
43
+ `vim-flavor` reads a file `Flavorfile` in the current working directory.
44
44
  The file is called a flavorfile. A flavorfile contains zero or more
45
45
  declarations about Vim plugins and which versions of Vim plugins to use.
46
46
 
@@ -49,9 +49,9 @@ See also [more details about flavorfile](flavorfile).
49
49
 
50
50
 
51
51
 
52
- ## Lockfile (`VimFlavor.lock`)
52
+ ## Lockfile (`Flavorfile.lock`)
53
53
 
54
- `vim-flavor` creates a file `VimFlavor.lock` in the current working directory.
54
+ `vim-flavor` creates a file `Flavorfile.lock` in the current working directory.
55
55
  The file is called a lockfile. A lockfile contains details about installed
56
56
  Vim plugins to use the same configuration on every machine.
57
57
 
@@ -19,5 +19,4 @@ Feature: Deploy Vim plugins to a non-standard directory
19
19
  """
20
20
  $foo_uri (1.0.2)
21
21
  """
22
- And a bootstrap script is created in "my-vimfiles"
23
22
  And a flavor "$foo_uri" version "1.0.2" is deployed to "my-vimfiles"
@@ -21,5 +21,4 @@ Feature: Install Vim plugins
21
21
  """
22
22
  $foo_uri (1.0.2)
23
23
  """
24
- And a bootstrap script is created in "$home/.vim"
25
24
  And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
@@ -26,6 +26,5 @@ Feature: Uninstall Vim plugins
26
26
  """
27
27
  $bar_uri (2.0.2)
28
28
  """
29
- And a bootstrap script is created in "$home/.vim"
30
29
  And a flavor "$bar_uri" version "2.0.2" is deployed to "$home/.vim"
31
30
  But a flavor "$foo_uri" is not deployed to "$home/.vim"
@@ -30,7 +30,6 @@ Feature: Update Vim plugins
30
30
  $baz_uri (1.0.2)
31
31
  $foo_uri (1.0.2)
32
32
  """
33
- And a bootstrap script is created in "$home/.vim"
34
33
  And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
35
34
  And a flavor "$bar_uri" version "1.0.2" is deployed to "$home/.vim"
36
35
  And a flavor "$baz_uri" version "1.0.2" is deployed to "$home/.vim"
@@ -56,7 +55,6 @@ Feature: Update Vim plugins
56
55
  $baz_uri (1.0.2)
57
56
  $foo_uri (1.0.2)
58
57
  """
59
- And a bootstrap script is created in "$home/.vim"
60
58
  And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
61
59
  And a flavor "$bar_uri" version "1.0.0" is deployed to "$home/.vim"
62
60
  And a flavor "$baz_uri" version "1.0.2" is deployed to "$home/.vim"
@@ -82,7 +80,6 @@ Feature: Update Vim plugins
82
80
  $baz_uri (1.0.2)
83
81
  $foo_uri (1.0.2)
84
82
  """
85
- And a bootstrap script is created in "$home/.vim"
86
83
  And a flavor "$foo_uri" version "1.0.2" is deployed to "$home/.vim"
87
84
  And a flavor "$bar_uri" version "1.0.2" is deployed to "$home/.vim"
88
85
  And a flavor "$baz_uri" version "1.0.2" is deployed to "$home/.vim"
@@ -1,11 +1,10 @@
1
1
  ## Uninstallation steps
2
2
 
3
- rm -r ~/.vim-flavor
4
- rm -r ~/.vim/flavors # or ~/vimfiles/flavors etc.
3
+ rm -rf ~/.vim-flavor
4
+ rm -rf ~/.vim/pack/flavors
5
5
 
6
6
  cd $YOUR_REPOSITORY_FOR_DOTFILES
7
- rm VimFlavor VimFlavor.lock
8
- vim vimrc # Remove the "runtime flavors/bootstrap.vim" line.
7
+ rm Flavorfile Flavorfile.lock
9
8
  git commit -am 'Farewell to vim-flavor'
10
9
 
11
10
  gem uninstall vim-flavor
@@ -19,5 +19,4 @@ Feature: Version lock
19
19
  """
20
20
  $foo_uri (1.0.0)
21
21
  """
22
- And a bootstrap script is created in "$home/.vim"
23
22
  And a flavor "$foo_uri" version "1.0.0" is deployed to "$home/.vim"
@@ -26,7 +26,6 @@ Feature: Version tag format
26
26
  """
27
27
  $foo_uri (1.2.3)
28
28
  """
29
- And a bootstrap script is created in "$home/.vim"
30
29
  And a flavor "$foo_uri" version "1.2.3" is deployed to "$home/.vim"
31
30
  When I run `vim-flavor install`
32
31
  Then it should pass with template:
@@ -57,7 +56,6 @@ Feature: Version tag format
57
56
  """
58
57
  $foo_uri (v1.2.3)
59
58
  """
60
- And a bootstrap script is created in "$home/.vim"
61
59
  And a flavor "$foo_uri" version "v1.2.3" is deployed to "$home/.vim"
62
60
  When I run `vim-flavor install`
63
61
  Then it should pass with template:
@@ -86,7 +84,6 @@ Feature: Version tag format
86
84
  There is no valid version
87
85
  """
88
86
  And a lockfile is not created
89
- And a bootstrap script is not created in "$home/.vim"
90
87
  And a flavor "$foo_uri" is not deployed to "$home/.vim"
91
88
 
92
89
  Scenario: Without tags
@@ -106,5 +103,4 @@ Feature: Version tag format
106
103
  There is no valid version
107
104
  """
108
105
  And a lockfile is not created
109
- And a bootstrap script is not created in "$home/.vim"
110
106
  And a flavor "$foo_uri" is not deployed to "$home/.vim"
@@ -9,7 +9,7 @@ module Vim
9
9
  :banner => 'DIR'
10
10
  end
11
11
 
12
- desc 'install', 'Install Vim plugins according to VimFlavor file.'
12
+ desc 'install', 'Install Vim plugins according to Flavofile.'
13
13
  common_options_to_deploy
14
14
  def install
15
15
  Facade.new().install(
@@ -18,7 +18,7 @@ module Vim
18
18
  end
19
19
 
20
20
  desc 'update [REPO_NAME...]',
21
- 'Update Vim plugins according to VimFlavor file.'
21
+ 'Update Vim plugins according to Flavorfile.'
22
22
  common_options_to_deploy
23
23
  def update(*repo_names)
24
24
  Facade.new().update(
@@ -0,0 +1,22 @@
1
+ require 'pastel'
2
+
3
+ module Vim
4
+ module Flavor
5
+ module Console
6
+ class << self
7
+ private def pastel
8
+ @pastel ||= Pastel.new(enabled: $stdout.tty?)
9
+ end
10
+
11
+ def warn message
12
+ puts pastel.yellow("Warning: #{message}")
13
+ end
14
+
15
+ def error message
16
+ puts pastel.red("Error: #{message}")
17
+ exit(1)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -11,7 +11,7 @@ module Vim
11
11
  def github_uri_prefix
12
12
  @github_uri_prefix ||=
13
13
  ENV['VIM_FLAVOR_GITHUB_URI_PREFIX'] ||
14
- 'git://github.com/'
14
+ 'https://github.com/'
15
15
  end
16
16
 
17
17
  def github_uri_suffix
@@ -20,39 +20,42 @@ module Vim
20
20
  def test(files_or_dirs, options)
21
21
  trace "-------- Preparing dependencies\n"
22
22
 
23
- flavorfile = FlavorFile.load_or_new(Dir.getwd().to_flavorfile_path)
23
+ flavorfile_path = FlavorFile.path_from(Dir.getwd(), true)
24
+ flavorfile = FlavorFile.load_or_new(flavorfile_path)
24
25
  flavorfile.flavor 'kana/vim-vspec', '~> 1.5', :group => :development unless
25
26
  flavorfile.flavor_table.has_key?('kana/vim-vspec')
26
- lockfile = LockFile.load_or_new(Dir.getwd().to_lockfile_path)
27
+ lockfile_path = LockFile.path_from(Dir.getwd(), true)
28
+ lockfile = LockFile.load_or_new(lockfile_path)
29
+ flavors_path = Dir.getwd().to_stash_path.to_flavors_path
27
30
 
28
31
  refresh_flavors(
29
32
  options[:update_dependencies] ? :update : :install,
30
33
  flavorfile,
31
34
  lockfile,
32
35
  [:runtime, :development],
33
- Dir.getwd().to_stash_path.to_deps_path
36
+ flavors_path
34
37
  )
35
38
 
36
39
  trace "-------- Testing a Vim plugin\n"
37
40
 
38
- this_path = Dir.getwd()
39
- deps_path = this_path.to_stash_path.to_deps_path
40
- runner = "#{deps_path}/#{'kana/vim-vspec'.zap}/bin/prove-vspec"
41
+ runner = "#{flavors_path}/#{'kana/vim-vspec'.zap}/bin/prove-vspec"
41
42
  plugin_paths = lockfile.flavors.map {|f|
42
- "#{deps_path}/#{f.repo_name.zap}"
43
+ "#{flavors_path}/#{f.repo_name.zap}"
43
44
  }
44
- runtime_paths = ([this_path] + plugin_paths).flat_map {|p| ['-d', p]}
45
+ runtime_paths = ([Dir.getwd()] + plugin_paths).flat_map {|p| ['-d', p]}
45
46
  command =
46
47
  %Q{ '#{runner}' \
47
48
  #{runtime_paths.flat_map {|p| ['-d', p]}.shelljoin} \
48
49
  #{files_or_dirs.shelljoin} }
49
- succeeded = system(command)
50
+ succeeded = system('bash', '-c', command)
50
51
  exit(1) unless succeeded
51
52
  end
52
53
 
53
54
  def install_or_update(mode, vimfiles_path)
54
- flavorfile = FlavorFile.load(Dir.getwd().to_flavorfile_path)
55
- lockfile = LockFile.load_or_new(Dir.getwd().to_lockfile_path)
55
+ flavorfile_path = FlavorFile.path_from(Dir.getwd(), true)
56
+ flavorfile = FlavorFile.load_or_new(flavorfile_path)
57
+ lockfile_path = LockFile.path_from(Dir.getwd(), true)
58
+ lockfile = LockFile.load_or_new(lockfile_path)
56
59
  refresh_flavors(
57
60
  mode,
58
61
  flavorfile,
@@ -175,7 +178,8 @@ module Vim
175
178
 
176
179
  def complete_a_flavor_dependencies(nf, locked_flavor_table, mode, groups, level)
177
180
  nf.checkout()
178
- ff = FlavorFile.load_or_new(nf.cached_repo_path.to_flavorfile_path)
181
+ flavorfile_path = FlavorFile.path_from(nf.cached_repo_path, false)
182
+ ff = FlavorFile.load_or_new(flavorfile_path)
179
183
  complete_flavors(ff.flavor_table, locked_flavor_table, mode, groups, level + 1, nf.repo_name)
180
184
  end
181
185
 
@@ -183,7 +187,8 @@ module Vim
183
187
  trace "Deploying plugins...\n"
184
188
 
185
189
  a_flavors_path = File.absolute_path(flavors_path)
186
- deployment_memo = LockFile.load_or_new(a_flavors_path.to_lockfile_path)
190
+ lockfile_path = LockFile.path_from(a_flavors_path, false)
191
+ deployment_memo = LockFile.load_or_new(lockfile_path)
187
192
 
188
193
  # To uninstall flavors which were deployed by vim-flavor 1.0.2 or
189
194
  # older, the whole deployed flavors have to be removed. Because
@@ -193,8 +198,6 @@ module Vim
193
198
  :secure => true
194
199
  ) if deployment_memo.flavors.empty?
195
200
 
196
- create_vim_script_for_bootstrap(a_flavors_path)
197
-
198
201
  flavors.
199
202
  before_each {|f| trace " #{f.repo_name} #{f.locked_version} ..."}.
200
203
  on_failure {trace " failed\n"}.
@@ -228,40 +231,6 @@ module Vim
228
231
  deployment_memo.save()
229
232
  end
230
233
 
231
- def create_vim_script_for_bootstrap(flavors_path)
232
- bootstrap_path = flavors_path.to_bootstrap_path
233
- FileUtils.mkdir_p(File.dirname(bootstrap_path))
234
- File.open(bootstrap_path, 'w') do |f|
235
- f.write(<<-'END')
236
- function! s:bootstrap()
237
- let current_rtp = &runtimepath
238
- let current_rtps = split(current_rtp, ',')
239
- set runtimepath&
240
- let default_rtp = &runtimepath
241
- let default_rtps = split(default_rtp, ',')
242
- let user_dir = default_rtps[0]
243
- let user_after_dir = default_rtps[-1]
244
- let base_rtps =
245
- \ filter(copy(current_rtps),
246
- \ 'v:val !=# user_dir && v:val !=# user_after_dir')
247
- let flavor_dirs =
248
- \ filter(split(glob(user_dir . '/flavors/*'), '\n'),
249
- \ 'isdirectory(v:val)')
250
- let new_rtps =
251
- \ []
252
- \ + [user_dir]
253
- \ + flavor_dirs
254
- \ + base_rtps
255
- \ + map(reverse(copy(flavor_dirs)), 'v:val . "/after"')
256
- \ + [user_after_dir]
257
- let &runtimepath = join(new_rtps, ',')
258
- endfunction
259
-
260
- call s:bootstrap()
261
- END
262
- end
263
- end
264
-
265
234
  def trace message
266
235
  print message
267
236
  end
@@ -25,7 +25,7 @@ module Vim
25
25
  end
26
26
 
27
27
  def cached_version?(version)
28
- system <<-"END"
28
+ system 'bash', '-c', <<-"END"
29
29
  {
30
30
  cd '#{cached_repo_path}' &&
31
31
  git rev-list --quiet '#{version.to_revision}' --
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  module Vim
2
4
  module Flavor
3
5
  class FlavorFile
@@ -16,7 +18,7 @@ module Vim
16
18
 
17
19
  def self.load_or_new(flavorfile_path)
18
20
  ff = new()
19
- ff.load(flavorfile_path) if File.exists?(flavorfile_path)
21
+ ff.load(flavorfile_path) if FileTest.exists?(flavorfile_path)
20
22
  ff
21
23
  end
22
24
 
@@ -26,6 +28,27 @@ module Vim
26
28
  ff
27
29
  end
28
30
 
31
+ def self.path_from(dir_path, warn)
32
+ flavorfile_path = dir_path.to_flavorfile_path
33
+ new_path = Pathname.new(flavorfile_path).relative_path_from(Pathname.getwd())
34
+ old_path = new_path.dirname() / 'VimFlavor'
35
+
36
+ path = if FileTest.exists?(new_path)
37
+ if warn and FileTest.exists?(old_path)
38
+ Console::warn "Delete #{old_path}. #{new_path} is being read instead."
39
+ end
40
+ new_path
41
+ elsif FileTest.exists?(old_path)
42
+ if warn
43
+ Console::warn "Rename #{old_path} to #{new_path}. #{old_path} wll be ignored in future version."
44
+ end
45
+ old_path
46
+ else
47
+ new_path
48
+ end
49
+ path.to_s
50
+ end
51
+
29
52
  def load(flavorfile_path)
30
53
  instance_eval(
31
54
  File.open(flavorfile_path, 'r').read(),
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  module Vim
2
4
  module Flavor
3
5
  class LockFile
@@ -7,6 +9,18 @@ module Vim
7
9
  l
8
10
  end
9
11
 
12
+ def self.path_from(dir_path, error)
13
+ lockfile_path = dir_path.to_lockfile_path
14
+ new_path = Pathname.new(lockfile_path).relative_path_from(Pathname.getwd())
15
+ old_path = new_path.dirname() / 'VimFlavor.lock'
16
+
17
+ if error and FileTest.exists?(old_path)
18
+ Console::error "#{old_path} is no longer used. Rename it to #{new_path}."
19
+ end
20
+
21
+ new_path.to_s
22
+ end
23
+
10
24
  def initialize(path)
11
25
  @path = path
12
26
  end
@@ -38,6 +52,7 @@ module Vim
38
52
  end
39
53
 
40
54
  def save()
55
+ FileUtils.mkdir_p(File.dirname(@path))
41
56
  File.open(@path, 'w') do |io|
42
57
  lines = flavors.flat_map {|f| self.class.serialize_lock_status(f)}
43
58
  lines.each do |line|
@@ -2,7 +2,8 @@ module Vim
2
2
  module Flavor
3
3
  module ShellUtility
4
4
  def sh script
5
- output = send(:`, script)
5
+ output = IO.popen(['bash', '-c', script], 'r', &:read)
6
+
6
7
  if $? == 0
7
8
  output
8
9
  else