vim-flavor 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.travis.yml +4 -0
- data/README.md +3 -174
- data/Rakefile +10 -0
- data/features/.nav +12 -0
- data/features/README.md +17 -0
- data/features/caching.feature +50 -0
- data/features/command_line/README.md +9 -0
- data/features/command_line/progress_messages.feature +44 -0
- data/features/flavorfile/README.md +9 -0
- data/features/flavorfile/comments.feature +24 -0
- data/features/flavorfile/repository_name.feature +53 -0
- data/features/flavorfile/version_constraint.feature +52 -0
- data/features/install_vim_flavor.md +42 -0
- data/features/philosophy.md +90 -0
- data/features/resolve_dependencies.feature +16 -0
- data/features/step_definitions/bootstrap_script_steps.rb +7 -0
- data/features/step_definitions/cli_steps.rb +34 -0
- data/features/step_definitions/directory_steps.rb +23 -0
- data/features/step_definitions/flavor_steps.rb +37 -0
- data/features/step_definitions/flavorfile_steps.rb +12 -0
- data/features/step_definitions/lockfile_steps.rb +13 -0
- data/features/support/env.rb +49 -0
- data/features/typical_usage/README.md +63 -0
- data/features/typical_usage/deploy_to_arbitrary_place.feature +24 -0
- data/features/typical_usage/install_vim_plugins.feature +26 -0
- data/features/typical_usage/uninstall_vim_plugins.feature +31 -0
- data/features/typical_usage/upgrade_vim_plugins.feature +27 -0
- data/features/uninstall_vim_flavor.md +16 -0
- data/features/version_lock.feature +26 -0
- data/lib/vim-flavor.rb +2 -12
- data/lib/vim-flavor/cli.rb +16 -12
- data/lib/vim-flavor/enumerableextension.rb +48 -0
- data/lib/vim-flavor/facade.rb +65 -102
- data/lib/vim-flavor/flavor.rb +70 -63
- data/lib/vim-flavor/flavorfile.rb +15 -47
- data/lib/vim-flavor/lockfile.rb +27 -44
- data/lib/vim-flavor/lockfileparser.rb +65 -0
- data/lib/vim-flavor/stringextension.rb +25 -1
- data/lib/vim-flavor/version.rb +1 -1
- data/lib/vim-flavor/versionconstraint.rb +12 -11
- data/spec/enumerableextension_spec.rb +100 -0
- data/spec/facade_spec.rb +49 -540
- data/spec/flavor_spec.rb +50 -250
- data/spec/flavorfile_spec.rb +34 -110
- data/spec/lockfile_spec.rb +79 -89
- data/spec/spec_helper.rb +0 -65
- data/spec/stringextension_spec.rb +10 -6
- data/spec/versionconstraint_spec.rb +37 -119
- data/vim-flavor.gemspec +3 -1
- metadata +135 -46
- data/spec/cli_spec.rb +0 -15
data/spec/lockfile_spec.rb
CHANGED
@@ -1,93 +1,83 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
require 'fileutils'
|
3
1
|
require 'spec_helper'
|
4
|
-
require '
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'should create PORO from flavors' do
|
86
|
-
described_class.poro_from_flavors(@flavors).should == @flavors_in_poro
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'should create flavors from PORO' do
|
90
|
-
described_class.flavors_from_poro(@flavors_in_poro).should == @flavors
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
module Vim
|
5
|
+
module Flavor
|
6
|
+
describe LockFile do
|
7
|
+
around :each do |example|
|
8
|
+
Dir.mktmpdir do |tmp_path|
|
9
|
+
@tmp_path = tmp_path
|
10
|
+
example.run
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def flavor(repo_name, locked_version)
|
15
|
+
f = Flavor.new()
|
16
|
+
f.repo_name = repo_name
|
17
|
+
f.locked_version = locked_version
|
18
|
+
f
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'has flavors sorted by repo_name' do
|
22
|
+
l = LockFile.new(@tmp_path.to_lockfile_path)
|
23
|
+
foo = flavor('foo', '1.2.3')
|
24
|
+
bar = flavor('bar', '2.3.4')
|
25
|
+
baz = flavor('baz', '3.4.5')
|
26
|
+
[foo, bar, baz].each do |f|
|
27
|
+
l.flavor_table[f.repo_name] = f
|
28
|
+
end
|
29
|
+
|
30
|
+
l.flavors.should == [bar, baz, foo]
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '::serialize_lock_status' do
|
34
|
+
it 'converts a flavor into an array of lines' do
|
35
|
+
LockFile.serialize_lock_status(flavor('foo', '1.2.3')).should ==
|
36
|
+
['foo (1.2.3)']
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#load' do
|
41
|
+
it 'loads locked information from a lockfile' do
|
42
|
+
File.open(@tmp_path.to_lockfile_path, 'w') do |io|
|
43
|
+
io.write(<<-'END')
|
44
|
+
foo (1.2.3)
|
45
|
+
bar (2.3.4)
|
46
|
+
baz (3.4.5)
|
47
|
+
END
|
48
|
+
end
|
49
|
+
|
50
|
+
l = LockFile.new(@tmp_path.to_lockfile_path)
|
51
|
+
l.flavor_table.should be_empty
|
52
|
+
|
53
|
+
l.load()
|
54
|
+
l.flavor_table['foo'].repo_name.should == 'foo'
|
55
|
+
l.flavor_table['foo'].locked_version.should == '1.2.3'
|
56
|
+
l.flavor_table['bar'].repo_name.should == 'bar'
|
57
|
+
l.flavor_table['bar'].locked_version.should == '2.3.4'
|
58
|
+
l.flavor_table['baz'].repo_name.should == 'baz'
|
59
|
+
l.flavor_table['baz'].locked_version.should == '3.4.5'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '::load_or_new' do
|
64
|
+
it 'creates a new instance then loads a lockfile' do
|
65
|
+
File.open(@tmp_path.to_lockfile_path, 'w') do |io|
|
66
|
+
io.write(<<-'END')
|
67
|
+
foo (1.2.3)
|
68
|
+
END
|
69
|
+
end
|
70
|
+
|
71
|
+
l = LockFile.load_or_new(@tmp_path.to_lockfile_path)
|
72
|
+
l.flavor_table['foo'].repo_name.should == 'foo'
|
73
|
+
l.flavor_table['foo'].locked_version.should == '1.2.3'
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'only creates a new instance if a given path does not exist' do
|
77
|
+
l = LockFile.load_or_new(@tmp_path.to_lockfile_path)
|
78
|
+
l.flavor_table.should be_empty
|
79
|
+
end
|
80
|
+
end
|
91
81
|
end
|
92
82
|
end
|
93
83
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,67 +1,2 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'tmpdir'
|
5
2
|
require 'vim-flavor'
|
6
|
-
|
7
|
-
def create_a_test_repo(path)
|
8
|
-
system(<<-"END")
|
9
|
-
{
|
10
|
-
mkdir -p #{path.inspect}
|
11
|
-
cd #{path.inspect}
|
12
|
-
git init
|
13
|
-
mkdir autoload doc plugin
|
14
|
-
touch autoload/foo.vim doc/foo.txt plugin/foo.vim
|
15
|
-
git add autoload doc plugin
|
16
|
-
git commit -am 'Commit foo'
|
17
|
-
for version in '1.0.0' '1.1.1' '1.1.2' '1.2.1' '1.2.2'
|
18
|
-
do
|
19
|
-
echo "*foo* $version" >doc/foo.txt
|
20
|
-
git commit -am 'Update foo'
|
21
|
-
git tag -a -m "Version $version" "$version"
|
22
|
-
done
|
23
|
-
for non_version in 'foo' 'bar' 'baz'
|
24
|
-
do
|
25
|
-
git tag -a -m "Non-version $non_version" "$non_version"
|
26
|
-
done
|
27
|
-
} >/dev/null
|
28
|
-
END
|
29
|
-
end
|
30
|
-
|
31
|
-
def update_a_test_repo(path)
|
32
|
-
system(<<-"END")
|
33
|
-
{
|
34
|
-
cd #{path.inspect} &&
|
35
|
-
for version in '1.0.9' '1.1.9' '1.2.9' '1.3.9'
|
36
|
-
do
|
37
|
-
echo "*foo* $version" >doc/foo.txt
|
38
|
-
git commit -am 'Update foo'
|
39
|
-
git tag -a -m "Version $version" "$version"
|
40
|
-
done
|
41
|
-
} >/dev/null
|
42
|
-
END
|
43
|
-
end
|
44
|
-
|
45
|
-
def create_temporary_directory()
|
46
|
-
Dir.mktmpdir()
|
47
|
-
end
|
48
|
-
|
49
|
-
def remove_temporary_directory(path)
|
50
|
-
FileUtils.remove_entry_secure(path)
|
51
|
-
end
|
52
|
-
|
53
|
-
def with_temporary_directory()
|
54
|
-
before :each do
|
55
|
-
@tmp_path = create_temporary_directory()
|
56
|
-
|
57
|
-
@original_dot_path = Vim::Flavor.dot_path
|
58
|
-
@dot_path = "#{@tmp_path}/.vim-flavor"
|
59
|
-
Vim::Flavor.dot_path = @dot_path
|
60
|
-
end
|
61
|
-
|
62
|
-
after :each do
|
63
|
-
Vim::Flavor.dot_path = @original_dot_path
|
64
|
-
|
65
|
-
remove_temporary_directory(@tmp_path)
|
66
|
-
end
|
67
|
-
end
|
@@ -1,11 +1,15 @@
|
|
1
|
-
require 'bundler/setup'
|
2
1
|
require 'spec_helper'
|
3
|
-
require 'vim-flavor'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
'
|
3
|
+
module Vim
|
4
|
+
module Flavor
|
5
|
+
describe StringExtension do
|
6
|
+
describe '#zap' do
|
7
|
+
it 'replace unsafe characters with "_"' do
|
8
|
+
'fakeclip'.zap.should == 'fakeclip'
|
9
|
+
'kana/vim-altr'.zap.should == 'kana_vim-altr'
|
10
|
+
'git://example.com/foo.git'.zap.should == 'git___example.com_foo.git'
|
11
|
+
end
|
12
|
+
end
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -1,138 +1,56 @@
|
|
1
|
-
require 'bundler/setup'
|
2
1
|
require 'spec_helper'
|
3
|
-
require 'vim-flavor'
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
'1.3.5',
|
12
|
-
'1.10.100',
|
13
|
-
]
|
14
|
-
@backward_incompatible_versions = [
|
15
|
-
'2.0',
|
16
|
-
'3000',
|
17
|
-
]
|
18
|
-
@old_versions = [
|
19
|
-
'1.1.1',
|
20
|
-
'1.1',
|
21
|
-
'0.2.4',
|
22
|
-
]
|
23
|
-
end
|
3
|
+
module Vim
|
4
|
+
module Flavor
|
5
|
+
describe VersionConstraint do
|
6
|
+
describe '#compatible?' do
|
7
|
+
describe '>=' do
|
8
|
+
subject {VersionConstraint.new('>= 1.2.3')}
|
24
9
|
|
25
|
-
|
26
|
-
vc = described_class.new('>= 0.0.0')
|
27
|
-
vc.base_version.should == Gem::Version.create('0.0.0')
|
28
|
-
vc.operator.should == '>='
|
29
|
-
end
|
10
|
+
it {should be_compatible '1.2.3'}
|
30
11
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
vc.operator.should == '~>'
|
35
|
-
end
|
12
|
+
it {should be_compatible '1.2.4'}
|
13
|
+
it {should be_compatible '1.3.3'}
|
14
|
+
it {should be_compatible '2.2.3'}
|
36
15
|
|
37
|
-
|
38
|
-
expect {
|
39
|
-
described_class.new('?? 6.6.6')
|
40
|
-
}.to raise_error(RuntimeError)
|
41
|
-
end
|
16
|
+
it {should be_compatible '1.3'}
|
42
17
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}.to raise_error(RuntimeError)
|
47
|
-
end
|
18
|
+
it {should_not be_compatible '1.2.2'}
|
19
|
+
it {should_not be_compatible '1.1.3'}
|
20
|
+
it {should_not be_compatible '0.2.3'}
|
48
21
|
|
49
|
-
|
50
|
-
|
51
|
-
vc_gc1 = described_class.new('~> 1')
|
52
|
-
vc_ge1 = described_class.new('>= 1')
|
53
|
-
vc_ge1d = described_class.new('>= 1')
|
54
|
-
vc_ge2 = described_class.new('>= 2')
|
22
|
+
it {should_not be_compatible '1.2'}
|
23
|
+
end
|
55
24
|
|
56
|
-
|
57
|
-
|
58
|
-
vc_ge1.should_not == vc_ge2
|
59
|
-
end
|
60
|
-
end
|
25
|
+
describe '~>' do
|
26
|
+
subject {VersionConstraint.new('~> 1.2.3')}
|
61
27
|
|
62
|
-
|
63
|
-
it 'should be compatible with backward-compatible versions' do
|
64
|
-
vc = described_class.new('>= ' + @base_version_s)
|
65
|
-
@backward_compatible_versions.each do |v|
|
66
|
-
vc.compatible?(v).should be_true
|
67
|
-
end
|
68
|
-
end
|
28
|
+
it {should be_compatible '1.2.3'}
|
69
29
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
vc.compatible?(v).should be_true
|
74
|
-
end
|
75
|
-
end
|
30
|
+
it {should be_compatible '1.2.4'}
|
31
|
+
it {should_not be_compatible '1.3.3'}
|
32
|
+
it {should_not be_compatible '2.2.3'}
|
76
33
|
|
77
|
-
|
78
|
-
vc = described_class.new('>= ' + @base_version_s)
|
79
|
-
@old_versions.each do |v|
|
80
|
-
vc.compatible?(v).should be_false
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
34
|
+
it {should_not be_compatible '1.3'}
|
84
35
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
@backward_compatible_versions.each do |v|
|
89
|
-
vc.compatible?(v).should be_true
|
90
|
-
end
|
91
|
-
end
|
36
|
+
it {should_not be_compatible '1.2.2'}
|
37
|
+
it {should_not be_compatible '1.1.3'}
|
38
|
+
it {should_not be_compatible '0.2.3'}
|
92
39
|
|
93
|
-
|
94
|
-
|
95
|
-
@backward_incompatible_versions.each do |v|
|
96
|
-
vc.compatible?(v).should be_false
|
40
|
+
it {should_not be_compatible '1.2'}
|
41
|
+
end
|
97
42
|
end
|
98
|
-
end
|
99
43
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
44
|
+
describe '#find_the_best_version' do
|
45
|
+
it 'returns the best version from given versions' do
|
46
|
+
VersionConstraint.new('>= 1.2.3').
|
47
|
+
find_the_best_version(['1.2.2', '1.2.3', '1.2.4', '1.3.3', '2.0']).
|
48
|
+
should == '2.0'
|
49
|
+
VersionConstraint.new('~> 1.2.3').
|
50
|
+
find_the_best_version(['1.2.2', '1.2.3', '1.2.4', '1.3.3', '2.0']).
|
51
|
+
should == '1.2.4'
|
52
|
+
end
|
104
53
|
end
|
105
54
|
end
|
106
55
|
end
|
107
|
-
|
108
|
-
describe 'find_the_best_version' do
|
109
|
-
it 'should find the best version from given versions' do
|
110
|
-
described_class.new('~> 1.2.3').find_the_best_version([
|
111
|
-
'1.2.3',
|
112
|
-
'1.2.6',
|
113
|
-
'1.2.9',
|
114
|
-
'1.3.0',
|
115
|
-
'2.0.0',
|
116
|
-
].map {|vs| Gem::Version.create(vs)}).should ==
|
117
|
-
Gem::Version.create('1.2.9')
|
118
|
-
|
119
|
-
described_class.new('>= 0').find_the_best_version([
|
120
|
-
'1.2.3',
|
121
|
-
'1.2.6',
|
122
|
-
'1.2.9',
|
123
|
-
'1.3.0',
|
124
|
-
'2.0.0',
|
125
|
-
].map {|vs| Gem::Version.create(vs)}).should ==
|
126
|
-
Gem::Version.create('2.0.0')
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe '#to_s' do
|
131
|
-
it 'should convert into a string representation' do
|
132
|
-
vc1 = described_class.new('~> 1.2.3')
|
133
|
-
described_class.new(vc1.to_s()).should == vc1
|
134
|
-
vc2 = described_class.new('>= 0')
|
135
|
-
described_class.new(vc2.to_s()).should == vc2
|
136
|
-
end
|
137
|
-
end
|
138
56
|
end
|
data/vim-flavor.gemspec
CHANGED
@@ -15,7 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ['lib']
|
16
16
|
gem.version = Vim::Flavor::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency('
|
18
|
+
gem.add_dependency('parslet', '~> 1.0')
|
19
|
+
gem.add_dependency('thor', '~> 0.14')
|
19
20
|
|
21
|
+
gem.add_development_dependency('cucumber', '~> 1.2')
|
20
22
|
gem.add_development_dependency('rspec', '~> 2.8')
|
21
23
|
end
|