vim-flavor 0.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.
@@ -0,0 +1,40 @@
1
+ require 'bundler/setup'
2
+ require 'fileutils'
3
+
4
+ def create_a_test_repo(path)
5
+ system(<<-"END")
6
+ {
7
+ mkdir -p #{path.inspect}
8
+ cd #{path.inspect}
9
+ git init
10
+ mkdir autoload doc plugin
11
+ touch autoload/foo.vim doc/foo.txt plugin/foo.vim
12
+ git add autoload doc plugin
13
+ git commit -am 'Commit foo'
14
+ for version in '1.0.0' '1.1.1' '1.1.2' '1.2.1' '1.2.2'
15
+ do
16
+ echo "*foo* $version" >doc/foo.txt
17
+ git commit -am 'Update foo'
18
+ git tag -a -m "Version $version" "$version"
19
+ done
20
+ } >/dev/null
21
+ END
22
+ end
23
+
24
+ def update_a_test_repo(path)
25
+ system(<<-"END")
26
+ {
27
+ cd #{path.inspect} &&
28
+ for version in '1.0.9' '1.1.9' '1.2.9' '1.3.9'
29
+ do
30
+ echo "*foo* $version" >doc/foo.txt
31
+ git commit -am 'Update foo'
32
+ git tag -a -m "Version $version" "$version"
33
+ done
34
+ } >/dev/null
35
+ END
36
+ end
37
+
38
+ def clean_up_stashed_stuffs()
39
+ FileUtils.rm_rf([Vim::Flavor::DOT_PATH], :secure => true)
40
+ end
@@ -0,0 +1,11 @@
1
+ require 'bundler/setup'
2
+ require 'spec_helper'
3
+ require 'vim-flavor'
4
+
5
+ describe Vim::Flavor::StringExtension do
6
+ describe '#to_flavors_path' do
7
+ it 'should return a flavors path from a vimfiles path' do
8
+ '~/.vim'.to_flavors_path().should == '~/.vim/flavors'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,137 @@
1
+ require 'bundler/setup'
2
+ require 'vim-flavor'
3
+
4
+ describe Vim::Flavor::VersionConstraint do
5
+ before :all do
6
+ @base_version_s = '1.2'
7
+ @backward_compatible_versions = [
8
+ '1.2.4',
9
+ '1.2.10',
10
+ '1.3.5',
11
+ '1.10.100',
12
+ ]
13
+ @backward_incompatible_versions = [
14
+ '2.0',
15
+ '3000',
16
+ ]
17
+ @old_versions = [
18
+ '1.1.1',
19
+ '1.1',
20
+ '0.2.4',
21
+ ]
22
+ end
23
+
24
+ it 'should accept ">=" operator' do
25
+ vc = described_class.new('>= 0.0.0')
26
+ vc.base_version.should == Gem::Version.create('0.0.0')
27
+ vc.operator.should == '>='
28
+ end
29
+
30
+ it 'should accept "~>" operator' do
31
+ vc = described_class.new('~> 1.2.3')
32
+ vc.base_version.should == Gem::Version.create('1.2.3')
33
+ vc.operator.should == '~>'
34
+ end
35
+
36
+ it 'should not accept unknown operators' do
37
+ expect {
38
+ described_class.new('?? 6.6.6')
39
+ }.to raise_error(RuntimeError)
40
+ end
41
+
42
+ it 'should not accept invalid format' do
43
+ expect {
44
+ described_class.new('6.6.6')
45
+ }.to raise_error(RuntimeError)
46
+ end
47
+
48
+ describe '#==' do
49
+ it 'should compare instances by their properties' do
50
+ vc_gc1 = described_class.new('~> 1')
51
+ vc_ge1 = described_class.new('>= 1')
52
+ vc_ge1d = described_class.new('>= 1')
53
+ vc_ge2 = described_class.new('>= 2')
54
+
55
+ vc_ge1.should == vc_ge1d
56
+ vc_ge1.should_not == vc_gc1
57
+ vc_ge1.should_not == vc_ge2
58
+ end
59
+ end
60
+
61
+ describe '>=' do
62
+ it 'should be compatible with backward-compatible versions' do
63
+ vc = described_class.new('>= ' + @base_version_s)
64
+ @backward_compatible_versions.each do |v|
65
+ vc.compatible?(v).should be_true
66
+ end
67
+ end
68
+
69
+ it 'should be compatible with backward-incompatible versions' do
70
+ vc = described_class.new('>= ' + @base_version_s)
71
+ @backward_incompatible_versions.each do |v|
72
+ vc.compatible?(v).should be_true
73
+ end
74
+ end
75
+
76
+ it 'should not be compatible with any older versions' do
77
+ vc = described_class.new('>= ' + @base_version_s)
78
+ @old_versions.each do |v|
79
+ vc.compatible?(v).should be_false
80
+ end
81
+ end
82
+ end
83
+
84
+ describe '~>' do
85
+ it 'should be compatible with backward-compatible versions' do
86
+ vc = described_class.new('~> ' + @base_version_s)
87
+ @backward_compatible_versions.each do |v|
88
+ vc.compatible?(v).should be_true
89
+ end
90
+ end
91
+
92
+ it 'should not be compatible with backward-incompatible versions' do
93
+ vc = described_class.new('~> ' + @base_version_s)
94
+ @backward_incompatible_versions.each do |v|
95
+ vc.compatible?(v).should be_false
96
+ end
97
+ end
98
+
99
+ it 'should not be compatible with any older versions' do
100
+ vc = described_class.new('~> ' + @base_version_s)
101
+ @old_versions.each do |v|
102
+ vc.compatible?(v).should be_false
103
+ end
104
+ end
105
+ end
106
+
107
+ describe 'find_the_best_version' do
108
+ it 'should find the best version from given versions' do
109
+ described_class.new('~> 1.2.3').find_the_best_version([
110
+ '1.2.3',
111
+ '1.2.6',
112
+ '1.2.9',
113
+ '1.3.0',
114
+ '2.0.0',
115
+ ].map {|vs| Gem::Version.create(vs)}).should ==
116
+ Gem::Version.create('1.2.9')
117
+
118
+ described_class.new('>= 0').find_the_best_version([
119
+ '1.2.3',
120
+ '1.2.6',
121
+ '1.2.9',
122
+ '1.3.0',
123
+ '2.0.0',
124
+ ].map {|vs| Gem::Version.create(vs)}).should ==
125
+ Gem::Version.create('2.0.0')
126
+ end
127
+ end
128
+
129
+ describe '#to_s' do
130
+ it 'should convert into a string representation' do
131
+ vc1 = described_class.new('~> 1.2.3')
132
+ described_class.new(vc1.to_s()).should == vc1
133
+ vc2 = described_class.new('>= 0')
134
+ described_class.new(vc2.to_s()).should == vc2
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/vim-flavor/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ['Kana Natsuno']
6
+ gem.email = ['dev@whileimautomaton.net']
7
+ gem.description = %q{See the README file.}
8
+ gem.summary = %q{A tool to manage your favorite Vim plugins}
9
+ gem.homepage = 'https://github.com/kana/vim-flavor'
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split(/\n/).map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split(/\n/)
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split(/\n/)
14
+ gem.name = 'vim-flavor'
15
+ gem.require_paths = ['lib']
16
+ gem.version = Vim::Flavor::VERSION
17
+
18
+ gem.add_development_dependency('rspec', '~> 2.8')
19
+ gem.add_development_dependency('thor', '~> 0.14.6')
20
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vim-flavor
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.0
6
+ platform: ruby
7
+ authors:
8
+ - Kana Natsuno
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-03-24 00:00:00 +09:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: "2.8"
25
+ type: :development
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: 0.14.6
36
+ type: :development
37
+ version_requirements: *id002
38
+ description: See the README file.
39
+ email:
40
+ - dev@whileimautomaton.net
41
+ executables:
42
+ - vim-flavor
43
+ extensions: []
44
+
45
+ extra_rdoc_files: []
46
+
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE
52
+ - README.asciidoc
53
+ - Rakefile
54
+ - bin/vim-flavor
55
+ - lib/vim-flavor.rb
56
+ - lib/vim-flavor/version.rb
57
+ - spec/cli_spec.rb
58
+ - spec/facade_spec.rb
59
+ - spec/flavor_spec.rb
60
+ - spec/flavorfile_spec.rb
61
+ - spec/lockfile_spec.rb
62
+ - spec/spec_helper.rb
63
+ - spec/stringextension_spec.rb
64
+ - spec/versionconstraint_spec.rb
65
+ - vim-flavor.gemspec
66
+ has_rdoc: true
67
+ homepage: https://github.com/kana/vim-flavor
68
+ licenses: []
69
+
70
+ post_install_message:
71
+ rdoc_options: []
72
+
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project:
90
+ rubygems_version: 1.6.2
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: A tool to manage your favorite Vim plugins
94
+ test_files:
95
+ - spec/cli_spec.rb
96
+ - spec/facade_spec.rb
97
+ - spec/flavor_spec.rb
98
+ - spec/flavorfile_spec.rb
99
+ - spec/lockfile_spec.rb
100
+ - spec/spec_helper.rb
101
+ - spec/stringextension_spec.rb
102
+ - spec/versionconstraint_spec.rb