vim-flavor 1.1.2 → 1.1.3

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.
data/.travis.yml CHANGED
@@ -1,4 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ - 2.0.0
5
+ before_script:
6
+ - git config --global 'user.name' 'Travis CI'
7
+ - git config --global 'user.email' 'user@example.com'
4
8
  script: rake test
data/features/.nav CHANGED
@@ -15,4 +15,5 @@
15
15
  - typical_usage.feature
16
16
  - dependencies.feature
17
17
  - failures.feature
18
+ - specifying_test_scripts.feature
18
19
  - version_tag_format.feature
@@ -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
@@ -74,7 +74,7 @@ end
74
74
 
75
75
  Aruba.configure do |config|
76
76
  config.before_cmd do |cmd|
77
- set_env 'HOME', variable_table['home']
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.3.12
40
- Use kana/vim-vspec ... 1.1.0
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.3.12 ... done
43
- kana/vim-vspec 1.1.0 ... done
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.3.12)
56
- kana/vim-vspec (1.1.0)
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.1.0
32
+ Use kana/vim-vspec ... 1\.\d+(\.\d+)?
33
33
  Deploying plugins...
34
- kana/vim-vspec 1.1.0 ... done
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\r
41
- # Expected g:foo == 5\r
42
- # Actual value: 3\r
43
- # Expected value: 5\r
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.1.0)
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.1.0
41
+ Use kana/vim-vspec ... 1\.\d+(\.\d+)?
42
42
  Deploying plugins...
43
- kana/vim-vspec 1.1.0 ... done
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.1.0)
57
+ kana/vim-vspec \(1\.\d+(\.\d+)?\)
58
58
  """
59
59
  And a dependency "kana/vim-vspec" is stored in ".vim-flavor/deps"
@@ -25,9 +25,10 @@ module Vim
25
25
  )
26
26
  end
27
27
 
28
- desc 'test', 'Test a Vim plugin in the current working directory.'
29
- def test
30
- Facade.new().test()
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
- ENV['HOME'].to_vimfiles_path
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
+
@@ -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
@@ -35,7 +35,7 @@ module Vim
35
35
 
36
36
  def cached_repo_path
37
37
  @cached_repo_path ||=
38
- "#{ENV['HOME'].to_stash_path}/repos/#{@repo_name.zap}"
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
- p = (ENV['VIM_FLAVOR_GITHUB_URI_PREFIX'] ||= 'git://github.com/')
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
@@ -1,6 +1,6 @@
1
1
  module Vim
2
2
  module Flavor
3
- VERSION = '1.1.2'
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
@@ -5,6 +5,7 @@ module Vim
5
5
  module Flavor
6
6
  [
7
7
  :CLI,
8
+ :Env,
8
9
  :Facade,
9
10
  :Flavor,
10
11
  :FlavorFile,
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.2
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-03-02 00:00:00.000000000 Z
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