vim-flavor 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/features/.nav +1 -0
- data/features/step_definitions/flavor_steps.rb +1 -1
- data/features/step_definitions/lockfile_steps.rb +4 -0
- data/features/support/env.rb +1 -1
- data/features/testing_vim_plugins/dependencies.feature +7 -7
- data/features/testing_vim_plugins/failures.feature +8 -8
- data/features/testing_vim_plugins/specifying_test_scripts.feature +57 -0
- data/features/testing_vim_plugins/typical_usage.feature +4 -4
- data/lib/vim-flavor/cli.rb +5 -4
- data/lib/vim-flavor/env.rb +26 -0
- data/lib/vim-flavor/facade.rb +5 -3
- data/lib/vim-flavor/flavor.rb +2 -4
- data/lib/vim-flavor/version.rb +2 -2
- data/lib/vim-flavor.rb +1 -0
- metadata +5 -2
data/.travis.yml
CHANGED
data/features/.nav
CHANGED
@@ -48,7 +48,7 @@ Given /^a repository "([^"]*)" from offline cache$/ do |repo_name|
|
|
48
48
|
repository_path = make_repo_path(repo_name).sub(expand('$tmp/'), '')
|
49
49
|
sh <<-"END"
|
50
50
|
{
|
51
|
-
git clone 'vendor/#{repo_name}' '#{current_dir}/#{repository_path}'
|
51
|
+
git clone --quiet --no-checkout 'vendor/#{repo_name}' '#{current_dir}/#{repository_path}'
|
52
52
|
} >/dev/null
|
53
53
|
END
|
54
54
|
end
|
@@ -41,6 +41,10 @@ Then /^(?:a|the) lockfile is (?:created|updated) with:$/ do |content|
|
|
41
41
|
}
|
42
42
|
end
|
43
43
|
|
44
|
+
Then /^(?:a|the) lockfile is (?:created|updated) and matches with:$/ do |content|
|
45
|
+
check_file_content('.'.to_lockfile_path, /#{content}/, true)
|
46
|
+
end
|
47
|
+
|
44
48
|
Then /^(?:a|the) lockfile is not created$/ do
|
45
49
|
steps %Q{
|
46
50
|
Then a file named "#{'.'.to_lockfile_path}" should not exist
|
data/features/support/env.rb
CHANGED
@@ -74,7 +74,7 @@ end
|
|
74
74
|
|
75
75
|
Aruba.configure do |config|
|
76
76
|
config.before_cmd do |cmd|
|
77
|
-
set_env '
|
77
|
+
set_env 'VIM_FLAVOR_HOME', variable_table['home']
|
78
78
|
set_env 'VIM_FLAVOR_GITHUB_URI_PREFIX', expand('file://$tmp/repos/')
|
79
79
|
set_env 'VIM_FLAVOR_GITHUB_URI_SUFFIX', ''
|
80
80
|
end
|
@@ -36,11 +36,11 @@ Feature: Dependencies
|
|
36
36
|
"""
|
37
37
|
-------- Preparing dependencies
|
38
38
|
Checking versions...
|
39
|
-
Use kana/vim-textobj-user ... 0
|
40
|
-
Use kana/vim-vspec ... 1
|
39
|
+
Use kana/vim-textobj-user ... 0\.\d+(\.\d+)?
|
40
|
+
Use kana/vim-vspec ... 1\.\d+(\.\d+)?
|
41
41
|
Deploying plugins...
|
42
|
-
kana/vim-textobj-user 0
|
43
|
-
kana/vim-vspec 1
|
42
|
+
kana/vim-textobj-user 0\.\d+(\.\d+)? ... done
|
43
|
+
kana/vim-vspec 1\.\d+(\.\d+)? ... done
|
44
44
|
Completed.
|
45
45
|
-------- Testing a Vim plugin
|
46
46
|
Files=0, Tests=0, \d+ wallclock secs .*
|
@@ -50,10 +50,10 @@ Feature: Dependencies
|
|
50
50
|
Files=1, Tests=1, \d+ wallclock secs .*
|
51
51
|
Result: PASS
|
52
52
|
"""
|
53
|
-
And a lockfile is created with:
|
53
|
+
And a lockfile is created and matches with:
|
54
54
|
"""
|
55
|
-
kana/vim-textobj-user (0
|
56
|
-
kana/vim-vspec (1
|
55
|
+
kana/vim-textobj-user \(0\.\d+(\.\d+)?\)
|
56
|
+
kana/vim-vspec \(1\.\d+(\.\d+)?\)
|
57
57
|
"""
|
58
58
|
And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
|
59
59
|
And a dependency "kana/vim-textobj-user" is stored in ".vim-flavor/deps"
|
@@ -29,18 +29,18 @@ Feature: Failures
|
|
29
29
|
"""
|
30
30
|
-------- Preparing dependencies
|
31
31
|
Checking versions...
|
32
|
-
Use kana/vim-vspec ... 1
|
32
|
+
Use kana/vim-vspec ... 1\.\d+(\.\d+)?
|
33
33
|
Deploying plugins...
|
34
|
-
kana/vim-vspec 1
|
34
|
+
kana/vim-vspec 1\.\d+(\.\d+)? ... done
|
35
35
|
Completed.
|
36
36
|
-------- Testing a Vim plugin
|
37
37
|
Files=0, Tests=0, 0 wallclock secs (.*)
|
38
38
|
Result: NOTESTS
|
39
39
|
t/basics.vim ..\s
|
40
|
-
not ok 1 - g:foo is equal to 5
|
41
|
-
# Expected g:foo == 5
|
42
|
-
# Actual value: 3
|
43
|
-
# Expected value: 5
|
40
|
+
not ok 1 - g:foo is equal to 5
|
41
|
+
# Expected g:foo == 5
|
42
|
+
# Actual value: 3
|
43
|
+
# Expected value: 5
|
44
44
|
Failed 1/1 subtests
|
45
45
|
|
46
46
|
Test Summary Report
|
@@ -54,8 +54,8 @@ Feature: Failures
|
|
54
54
|
"""
|
55
55
|
:in `test':
|
56
56
|
"""
|
57
|
-
And a lockfile with:
|
57
|
+
And a lockfile is created and matches with:
|
58
58
|
"""
|
59
|
-
kana/vim-vspec (1
|
59
|
+
kana/vim-vspec \(1\.\d+(\.\d+)?\)
|
60
60
|
"""
|
61
61
|
And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
Feature: Specifying test scripts
|
2
|
+
In order to run test scripts not in the standard `t` directory,
|
3
|
+
As a lazy Vim user,
|
4
|
+
I want to specify test scripts to be run,
|
5
|
+
like `vim-flavor test FILES-OR-DIRECTOREIS`.
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given a repository "kana/vim-vspec" from offline cache
|
9
|
+
|
10
|
+
Scenario: Running test scripts in non-standard location
|
11
|
+
Given a flavorfile with:
|
12
|
+
"""ruby
|
13
|
+
# No dependency
|
14
|
+
"""
|
15
|
+
And a file named "plugin/foo.vim" with:
|
16
|
+
"""vim
|
17
|
+
let g:foo = 3
|
18
|
+
"""
|
19
|
+
And a file named "spec/basics.vim" with:
|
20
|
+
"""vim
|
21
|
+
runtime! plugin/foo.vim
|
22
|
+
describe 'g:foo'
|
23
|
+
it 'is equal to 3'
|
24
|
+
Expect g:foo == 3
|
25
|
+
end
|
26
|
+
end
|
27
|
+
"""
|
28
|
+
And an executable file named "spec/sh.t" with:
|
29
|
+
"""bash
|
30
|
+
#!/bin/bash
|
31
|
+
echo 'ok 1'
|
32
|
+
echo '1..1'
|
33
|
+
"""
|
34
|
+
When I run `vim-flavor test spec`
|
35
|
+
Then it should pass with regexp:
|
36
|
+
"""
|
37
|
+
-------- Preparing dependencies
|
38
|
+
Checking versions...
|
39
|
+
Use kana/vim-vspec ... 1\.\d+(\.\d+)?
|
40
|
+
Deploying plugins...
|
41
|
+
kana/vim-vspec 1\.\d+(\.\d+)? ... done
|
42
|
+
Completed.
|
43
|
+
-------- Testing a Vim plugin
|
44
|
+
spec/sh.t .. ok
|
45
|
+
All tests successful.
|
46
|
+
Files=1, Tests=1, \d+ wallclock secs .*
|
47
|
+
Result: PASS
|
48
|
+
spec/basics.vim .. ok
|
49
|
+
All tests successful.
|
50
|
+
Files=1, Tests=1, \d+ wallclock secs .*
|
51
|
+
Result: PASS
|
52
|
+
"""
|
53
|
+
And a lockfile is created and matches with:
|
54
|
+
"""
|
55
|
+
kana/vim-vspec \(1\.\d+(\.\d+)?\)
|
56
|
+
"""
|
57
|
+
And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
|
@@ -38,9 +38,9 @@ Feature: Typical usage
|
|
38
38
|
"""
|
39
39
|
-------- Preparing dependencies
|
40
40
|
Checking versions...
|
41
|
-
Use kana/vim-vspec ... 1
|
41
|
+
Use kana/vim-vspec ... 1\.\d+(\.\d+)?
|
42
42
|
Deploying plugins...
|
43
|
-
kana/vim-vspec 1
|
43
|
+
kana/vim-vspec 1\.\d+(\.\d+)? ... done
|
44
44
|
Completed.
|
45
45
|
-------- Testing a Vim plugin
|
46
46
|
t/sh.t .. ok
|
@@ -52,8 +52,8 @@ Feature: Typical usage
|
|
52
52
|
Files=1, Tests=1, \d+ wallclock secs .*
|
53
53
|
Result: PASS
|
54
54
|
"""
|
55
|
-
And a lockfile is created with:
|
55
|
+
And a lockfile is created and matches with:
|
56
56
|
"""
|
57
|
-
kana/vim-vspec (1
|
57
|
+
kana/vim-vspec \(1\.\d+(\.\d+)?\)
|
58
58
|
"""
|
59
59
|
And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
|
data/lib/vim-flavor/cli.rb
CHANGED
@@ -25,9 +25,10 @@ module Vim
|
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
28
|
-
desc 'test
|
29
|
-
|
30
|
-
|
28
|
+
desc 'test [FILES or DIRS]',
|
29
|
+
'Test a Vim plugin in the current working directory.'
|
30
|
+
def test(*files_or_dirs)
|
31
|
+
Facade.new().test(files_or_dirs)
|
31
32
|
end
|
32
33
|
|
33
34
|
desc 'version', 'Show the current version.'
|
@@ -37,7 +38,7 @@ module Vim
|
|
37
38
|
|
38
39
|
no_tasks do
|
39
40
|
def default_vimfiles_path
|
40
|
-
|
41
|
+
Env::home.to_vimfiles_path
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Vim
|
2
|
+
module Flavor
|
3
|
+
class Env
|
4
|
+
class << self
|
5
|
+
def home
|
6
|
+
@home ||=
|
7
|
+
ENV['VIM_FLAVOR_HOME'] ||
|
8
|
+
ENV['HOME']
|
9
|
+
end
|
10
|
+
|
11
|
+
def github_uri_prefix
|
12
|
+
@github_uri_prefix ||=
|
13
|
+
ENV['VIM_FLAVOR_GITHUB_URI_PREFIX'] ||
|
14
|
+
'git://github.com/'
|
15
|
+
end
|
16
|
+
|
17
|
+
def github_uri_suffix
|
18
|
+
@github_uri_suffix ||=
|
19
|
+
ENV['VIM_FLAVOR_GITHUB_URI_SUFFIX'] ||
|
20
|
+
'.git'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/lib/vim-flavor/facade.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'shellwords'
|
2
3
|
|
3
4
|
module Vim
|
4
5
|
module Flavor
|
@@ -11,7 +12,7 @@ module Vim
|
|
11
12
|
install_or_upgrade(:upgrade, vimfiles_path)
|
12
13
|
end
|
13
14
|
|
14
|
-
def test()
|
15
|
+
def test(files_or_dirs)
|
15
16
|
trace "-------- Preparing dependencies\n"
|
16
17
|
|
17
18
|
flavorfile = FlavorFile.load_or_new(Dir.getwd().to_flavorfile_path)
|
@@ -36,9 +37,10 @@ module Vim
|
|
36
37
|
"#{deps_path}/#{f.repo_name.zap}"
|
37
38
|
}
|
38
39
|
succeeded = system %Q{
|
39
|
-
prove --ext '.t' #{prove_options} &&
|
40
|
+
prove --ext '.t' #{prove_options} #{files_or_dirs.shelljoin} &&
|
40
41
|
prove --ext '.vim' #{prove_options} \
|
41
|
-
--exec '#{vspec} #{Dir.getwd()} #{plugin_paths.join(' ')}'
|
42
|
+
--exec '#{vspec} #{Dir.getwd()} #{plugin_paths.join(' ')}' \
|
43
|
+
#{files_or_dirs.shelljoin}
|
42
44
|
}
|
43
45
|
exit(1) unless succeeded
|
44
46
|
end
|
data/lib/vim-flavor/flavor.rb
CHANGED
@@ -35,7 +35,7 @@ module Vim
|
|
35
35
|
|
36
36
|
def cached_repo_path
|
37
37
|
@cached_repo_path ||=
|
38
|
-
"#{
|
38
|
+
"#{Env::home.to_stash_path}/repos/#{@repo_name.zap}"
|
39
39
|
end
|
40
40
|
|
41
41
|
def make_deployment_path(flavors_path)
|
@@ -43,9 +43,7 @@ module Vim
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.github_repo_uri(user, repo)
|
46
|
-
|
47
|
-
s = (ENV['VIM_FLAVOR_GITHUB_URI_SUFFIX'] ||= '.git')
|
48
|
-
"#{p}#{user}/#{repo}#{s}"
|
46
|
+
"#{Env::github_uri_prefix}#{user}/#{repo}#{Env::github_uri_suffix}"
|
49
47
|
end
|
50
48
|
|
51
49
|
def repo_uri
|
data/lib/vim-flavor/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vim
|
2
2
|
module Flavor
|
3
|
-
VERSION = '1.1.
|
3
|
+
VERSION = '1.1.3'
|
4
4
|
|
5
5
|
class Version < Gem::Version
|
6
6
|
attr_accessor :original_tag_name
|
@@ -11,7 +11,7 @@ module Vim
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.normalize_tag_name(tag_name)
|
14
|
-
tag_name.sub(/^v/, '')
|
14
|
+
tag_name.to_s.sub(/^v/, '')
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.correct?(tag_name)
|
data/lib/vim-flavor.rb
CHANGED
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.3
|
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-11-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parslet
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- features/testing_vim_plugins/README.md
|
140
140
|
- features/testing_vim_plugins/dependencies.feature
|
141
141
|
- features/testing_vim_plugins/failures.feature
|
142
|
+
- features/testing_vim_plugins/specifying_test_scripts.feature
|
142
143
|
- features/testing_vim_plugins/typical_usage.feature
|
143
144
|
- features/typical_usage/README.md
|
144
145
|
- features/typical_usage/deploy_to_arbitrary_place.feature
|
@@ -151,6 +152,7 @@ files:
|
|
151
152
|
- lib/vim-flavor.rb
|
152
153
|
- lib/vim-flavor/cli.rb
|
153
154
|
- lib/vim-flavor/enumerableextension.rb
|
155
|
+
- lib/vim-flavor/env.rb
|
154
156
|
- lib/vim-flavor/facade.rb
|
155
157
|
- lib/vim-flavor/flavor.rb
|
156
158
|
- lib/vim-flavor/flavorfile.rb
|
@@ -225,6 +227,7 @@ test_files:
|
|
225
227
|
- features/testing_vim_plugins/README.md
|
226
228
|
- features/testing_vim_plugins/dependencies.feature
|
227
229
|
- features/testing_vim_plugins/failures.feature
|
230
|
+
- features/testing_vim_plugins/specifying_test_scripts.feature
|
228
231
|
- features/testing_vim_plugins/typical_usage.feature
|
229
232
|
- features/typical_usage/README.md
|
230
233
|
- features/typical_usage/deploy_to_arbitrary_place.feature
|