vim-flavor 0.0.1 → 0.0.2
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/README.md +198 -0
- data/lib/vim-flavor/version.rb +1 -1
- data/lib/vim-flavor.rb +12 -3
- data/spec/facade_spec.rb +43 -58
- data/spec/flavor_spec.rb +20 -32
- data/spec/flavorfile_spec.rb +1 -0
- data/spec/lockfile_spec.rb +4 -5
- data/spec/spec_helper.rb +25 -2
- data/spec/versionconstraint_spec.rb +1 -0
- metadata +3 -3
- data/README.asciidoc +0 -142
data/README.md
ADDED
@@ -0,0 +1,198 @@
|
|
1
|
+
# vim-flavor, a tool to manage your favorite Vim plugins
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
## Set up the tool for a new-style plugin management
|
7
|
+
|
8
|
+
### Requirements
|
9
|
+
|
10
|
+
* [Git](http://git-scm.com/) 1.7.9 or later
|
11
|
+
* [Ruby](http://www.ruby-lang.org/) 1.9.2 or later
|
12
|
+
* Recommendation: Use [RVM](http://beginrescueend.com/) or other tools
|
13
|
+
for ease of installation across different envinronments.
|
14
|
+
* [Vim](http://www.vim.org/) 7.3 or later
|
15
|
+
* Note that Vim should be compiled as normal, big or huge version
|
16
|
+
to use most of plugins.
|
17
|
+
|
18
|
+
|
19
|
+
### Supported platforms
|
20
|
+
|
21
|
+
* Unix-like environments such as Linux, Mac OS X, etc.
|
22
|
+
* Though Microsoft Windows is not directly supported,
|
23
|
+
it is possible to manage Vim plugins via Cygwin or other environments.
|
24
|
+
|
25
|
+
|
26
|
+
### Installation steps
|
27
|
+
|
28
|
+
gem install vim-flavor
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
## Typical usage
|
34
|
+
|
35
|
+
### Start using vim-flavor
|
36
|
+
|
37
|
+
cd $YOUR_REPOSITORY_FOR_DOTFILES
|
38
|
+
|
39
|
+
cat >VimFlavor <<'END'
|
40
|
+
# * Declare using git://github.com/kana/vim-textobj-indent.git
|
41
|
+
# * vim-flavor fetches git://github.com/$USER/$REPO.git
|
42
|
+
# if the argument is written in '$USER/$REPO' format.
|
43
|
+
# * kana/vim-textobj-indent requires kana/vim-textobj-user.
|
44
|
+
# Such dependencies are automatically installed
|
45
|
+
# if the flavored plugin declares its dependencies with VimFlavor file.
|
46
|
+
# (FIXME: Resolving dependencies will be implemented later.)
|
47
|
+
flavor 'kana/vim-textobj-indent'
|
48
|
+
|
49
|
+
# * Declare using git://github.com/vim-scripts/fakeclip.git
|
50
|
+
# * vim-flavor fetches git://github.com/vim-scripts/$REPO.git
|
51
|
+
# if the argument is written in '$REPO' format.
|
52
|
+
flavor 'fakeclip'
|
53
|
+
|
54
|
+
# * Declare using git://github.com/kana/vim-altr.git
|
55
|
+
# * vim-flavor fetches the URI
|
56
|
+
# if the argument seems to be a URI.
|
57
|
+
flavor 'git://github.com/kana/vim-altr.git'
|
58
|
+
|
59
|
+
# * Declare using kana/vim-smartchr 0.1.0 or later and older than 0.2.0.
|
60
|
+
flavor 'kana/vim-smartchr', '~> 0.1.0'
|
61
|
+
|
62
|
+
# * Declare using kana/vim-smartword 0.1 or later and older than 1.0.
|
63
|
+
flavor 'kana/vim-smartword', '~> 0.1'
|
64
|
+
|
65
|
+
# * Declare using kana/vim-smarttill 0.1.0 or later.
|
66
|
+
flavor 'kana/vim-smarttill', '>= 0.1.0'
|
67
|
+
END
|
68
|
+
|
69
|
+
# Fetch the plugins declared in the VimFlavor,
|
70
|
+
# create VimFlavor.lock for a snapshot of all plugins and versions,
|
71
|
+
# then install the plugins and a bootstrap script into ~/.vim etc.
|
72
|
+
vim-flavor install
|
73
|
+
|
74
|
+
# Add the following line into the first line of your vimrc:
|
75
|
+
#
|
76
|
+
# runtime flavors/bootstrap.vim
|
77
|
+
vim vimrc
|
78
|
+
|
79
|
+
git add VimFlavor VimFlavor.lock vimrc
|
80
|
+
git commit -m 'Use vim-flavor to manage my favorite Vim plugins'
|
81
|
+
|
82
|
+
|
83
|
+
### Upgrade all plugins to the latest version
|
84
|
+
|
85
|
+
vim-flavor upgrade
|
86
|
+
|
87
|
+
git add VimFlavor.lock
|
88
|
+
git commit -m 'Upgrade my favorite Vim plugins'
|
89
|
+
|
90
|
+
|
91
|
+
### Add more plugins into your dotfile repository
|
92
|
+
|
93
|
+
cat >>VimFlavor <<'END'
|
94
|
+
|
95
|
+
flavor 'kana/vim-operator-replace'
|
96
|
+
|
97
|
+
END
|
98
|
+
|
99
|
+
# Fetch newly added plugins,
|
100
|
+
# update VimFlavor.lock for the plugins,
|
101
|
+
# then install the plugins into ~/.vim etc.
|
102
|
+
vim-flavor install
|
103
|
+
|
104
|
+
git add VimFlavor VimFlavor.lock
|
105
|
+
git commit -m 'Use kana/vim-operator-replace'
|
106
|
+
|
107
|
+
|
108
|
+
### Remove plugins from your dotfile repository
|
109
|
+
|
110
|
+
# Remove declarations of unused plugins from VimFlavor.
|
111
|
+
sed -i~ -e '/vim-smartchr/d' VimFlavor
|
112
|
+
|
113
|
+
# Update VimFlavor.lock for the removed plugins,
|
114
|
+
# then clean up the plugins from ~/.vim etc.
|
115
|
+
vim-flavor install
|
116
|
+
|
117
|
+
git add VimFlavor VimFlavor.lock
|
118
|
+
git commit -m 'Farewell kana/vim-smartchr'
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
### Install plugins into a non-standard directory
|
123
|
+
|
124
|
+
vim-flavor install --vimfiles-path=/cygdrive/c/Users/kana/vimfiles
|
125
|
+
|
126
|
+
|
127
|
+
### Farewell to vim-flavor
|
128
|
+
|
129
|
+
rm -r ~/.vim-flavor
|
130
|
+
rm -r ~/.vim/flavors # or ~/vimfiles/flavors etc.
|
131
|
+
|
132
|
+
cd $YOUR_REPOSITORY_FOR_DOTFILES
|
133
|
+
rm VimFlavor VimFlavor.lock
|
134
|
+
git commit -am 'Farewell to vim-flavor'
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
## Philosophy
|
140
|
+
|
141
|
+
I know that there are several implementations for the same purpose and many
|
142
|
+
users love them, but all of them do not meet my taste. That's why I wrote
|
143
|
+
vim-flavor. The philosofy on vim-flavor is as follows:
|
144
|
+
|
145
|
+
Whole configuration including *versions of plugins* should be under a version
|
146
|
+
control system. All of existing implementations do not manage versions of
|
147
|
+
plugins. This means that *it's not possible to use the same configuration
|
148
|
+
across multiple environments* (the only one exception is using
|
149
|
+
[pathogen](https://github.com/tpope/vim-pathogen) with Git submodules,
|
150
|
+
but you'll find it's painful to manually manage many plugins).
|
151
|
+
|
152
|
+
There should be a standard way to describe proper dependencies of plugins to
|
153
|
+
install dependencies without explicit declarations. Most of existing
|
154
|
+
implementations do not resolve dependencies automatically (the only one
|
155
|
+
exception is
|
156
|
+
[vim-addon-manager](https://github.com/MarcWeber/vim-addon-manager), but it
|
157
|
+
doesn't take care about required versions). The configuration file formats of
|
158
|
+
vim-flavor are also used to describe dependencies of plugins with required
|
159
|
+
versions. This means that vim-flavor installs plugins and their dependencies
|
160
|
+
automatically (unfortunately this feature is not implemented yet, but it'll be
|
161
|
+
available soon).
|
162
|
+
|
163
|
+
Any software should have enough and reproducable test cases.
|
164
|
+
But existing implementations such as
|
165
|
+
[vundle](https://github.com/gmarik/vundle) and
|
166
|
+
[neobundle](https://github.com/Shougo/neobundle.vim) are not developed so.
|
167
|
+
It's horrible for me.
|
168
|
+
|
169
|
+
Installation steps should be small, be reproducable, and not affect existing
|
170
|
+
envinronment as less as possible. Most of existing implementations require to
|
171
|
+
manually tweak `~/.vim` etc. It's painful to set up such stuffs manually
|
172
|
+
because a vimfiles path is varied on each platform.
|
173
|
+
|
174
|
+
Finally, a tool and files deployed by the tool should be uninstalled easily.
|
175
|
+
[Vimana](https://github.com/c9s/Vimana) does not meet this because it directly
|
176
|
+
puts files into `~/.vim/colors` etc and it doesn't provide `uninstall`
|
177
|
+
command.
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
## License
|
183
|
+
|
184
|
+
vim-flavor is released under the terms of so-called MIT/X license.
|
185
|
+
See the LICENSE file for the details.
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
## Author
|
191
|
+
|
192
|
+
* [Kana Natsuno](http://whileimautomaton.net/)
|
193
|
+
(also known as [@kana1](http://twitter.com/kana1))
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<!-- vim: set expandtab shiftwidth=4 softtabstop=4 textwidth=78 : -->
|
data/lib/vim-flavor/version.rb
CHANGED
data/lib/vim-flavor.rb
CHANGED
@@ -61,8 +61,17 @@ module Vim
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
|
65
|
-
|
64
|
+
class << self
|
65
|
+
@@dot_path = File.expand_path('~/.vim-flavor')
|
66
|
+
|
67
|
+
def dot_path
|
68
|
+
@@dot_path
|
69
|
+
end
|
70
|
+
|
71
|
+
def dot_path= path
|
72
|
+
@@dot_path = path
|
73
|
+
end
|
74
|
+
end
|
66
75
|
|
67
76
|
class Flavor
|
68
77
|
@@properties = [
|
@@ -94,7 +103,7 @@ module Vim
|
|
94
103
|
|
95
104
|
def cached_repo_path
|
96
105
|
@cached_repo_path ||=
|
97
|
-
"#{
|
106
|
+
"#{Vim::Flavor.dot_path}/repos/#{zapped_repo_dir_name}"
|
98
107
|
end
|
99
108
|
|
100
109
|
def make_deploy_path(vimfiles_path)
|
data/spec/facade_spec.rb
CHANGED
@@ -15,8 +15,9 @@ describe Vim::Flavor::Facade do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '#load' do
|
18
|
+
with_temporary_directory
|
19
|
+
|
18
20
|
before :each do
|
19
|
-
@tmp_path = "#{Vim::Flavor::DOT_PATH}/tmp"
|
20
21
|
@facade = described_class.new()
|
21
22
|
@facade.flavorfile_path = "#{@tmp_path}/VimFlavor"
|
22
23
|
@facade.lockfile_path = "#{@tmp_path}/VimFlavor.lock"
|
@@ -38,7 +39,6 @@ describe Vim::Flavor::Facade do
|
|
38
39
|
@flavor2d = @flavor2.dup()
|
39
40
|
@flavor2d.locked_version = Gem::Version.create('4.5.6')
|
40
41
|
|
41
|
-
FileUtils.mkdir_p(@tmp_path)
|
42
42
|
File.open(@facade.flavorfile_path, 'w') do |f|
|
43
43
|
f.write(<<-'END')
|
44
44
|
flavor 'kana/vim-smartinput'
|
@@ -58,10 +58,6 @@ describe Vim::Flavor::Facade do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
after :each do
|
62
|
-
FileUtils.rm_rf([Vim::Flavor::DOT_PATH], :secure => true)
|
63
|
-
end
|
64
|
-
|
65
61
|
it 'should load both files' do
|
66
62
|
@facade.load()
|
67
63
|
|
@@ -184,16 +180,19 @@ describe Vim::Flavor::Facade do
|
|
184
180
|
end
|
185
181
|
|
186
182
|
describe '#create_vim_script_for_bootstrap' do
|
183
|
+
with_temporary_directory
|
184
|
+
|
187
185
|
before :each do
|
188
186
|
@facade = described_class.new()
|
189
|
-
@home_path =
|
187
|
+
@home_path =
|
188
|
+
if File.symlink?(@tmp_path)
|
189
|
+
File.readlink(@tmp_path)
|
190
|
+
else
|
191
|
+
@tmp_path
|
192
|
+
end
|
190
193
|
@vimfiles_path = "#{@home_path}/.vim"
|
191
194
|
end
|
192
195
|
|
193
|
-
after :each do
|
194
|
-
FileUtils.rm_rf([Vim::Flavor::DOT_PATH], :secure => true)
|
195
|
-
end
|
196
|
-
|
197
196
|
it 'should create a bootstrap script into a given vimfiles path' do
|
198
197
|
bootstrap_path = "#{@vimfiles_path.to_flavors_path()}/bootstrap.vim"
|
199
198
|
|
@@ -213,34 +212,40 @@ describe Vim::Flavor::Facade do
|
|
213
212
|
done
|
214
213
|
vim -u NONE -i NONE -e -s -c '
|
215
214
|
set nocompatible verbose=1
|
215
|
+
let vimfiles_path = split(&runtimepath, ",")[0]
|
216
216
|
source #{@vimfiles_path}/flavors/bootstrap.vim
|
217
|
-
|
217
|
+
for path in split(&runtimepath, ",")
|
218
|
+
if stridx(path, vimfiles_path) == 0
|
219
|
+
echo substitute(path, vimfiles_path, "!", "")
|
220
|
+
endif
|
221
|
+
endfor
|
218
222
|
qall!
|
219
223
|
' 2>&1
|
220
224
|
}
|
221
225
|
rtps =
|
222
226
|
_rtp.
|
223
|
-
|
224
|
-
|
225
|
-
select {|p| p.start_with?(@home_path)}
|
227
|
+
split(/[\r\n]/).
|
228
|
+
select {|p| p != ''}
|
226
229
|
rtps.should == [
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
230
|
+
'!',
|
231
|
+
'!/flavors/bar',
|
232
|
+
'!/flavors/baz',
|
233
|
+
'!/flavors/foo',
|
234
|
+
'!/flavors/foo/after',
|
235
|
+
'!/flavors/baz/after',
|
236
|
+
'!/flavors/bar/after',
|
237
|
+
'!/after',
|
235
238
|
]
|
236
239
|
end
|
237
240
|
end
|
238
241
|
|
239
242
|
describe '#deploy_flavors' do
|
243
|
+
with_temporary_directory
|
244
|
+
|
240
245
|
before :each do
|
241
246
|
@facade = described_class.new()
|
242
247
|
|
243
|
-
@test_repo_path = "#{
|
248
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
244
249
|
|
245
250
|
@flavor = Vim::Flavor::Flavor.new()
|
246
251
|
@flavor.repo_name = '@test_repo_path'
|
@@ -249,14 +254,10 @@ describe Vim::Flavor::Facade do
|
|
249
254
|
|
250
255
|
@flavors = [@flavor]
|
251
256
|
|
252
|
-
@vimfiles_path = "#{
|
257
|
+
@vimfiles_path = "#{@tmp_path}/vimfiles"
|
253
258
|
@bootstrap_path = "#{@vimfiles_path.to_flavors_path()}/bootstrap.vim"
|
254
259
|
end
|
255
260
|
|
256
|
-
after :each do
|
257
|
-
FileUtils.rm_rf([Vim::Flavor::DOT_PATH], :secure => true)
|
258
|
-
end
|
259
|
-
|
260
261
|
it 'should replace a given path with given flavors' do
|
261
262
|
create_a_test_repo(@test_repo_path)
|
262
263
|
@flavors.each do |f|
|
@@ -293,23 +294,19 @@ describe Vim::Flavor::Facade do
|
|
293
294
|
end
|
294
295
|
|
295
296
|
describe '#save_lockfile' do
|
297
|
+
with_temporary_directory
|
298
|
+
|
296
299
|
before :each do
|
297
|
-
@tmp_path = "#{Vim::Flavor::DOT_PATH}/tmp"
|
298
300
|
@facade = described_class.new()
|
299
301
|
@facade.flavorfile_path = "#{@tmp_path}/VimFlavor"
|
300
302
|
@facade.lockfile_path = "#{@tmp_path}/VimFlavor.lock"
|
301
303
|
|
302
|
-
FileUtils.mkdir_p(@tmp_path)
|
303
304
|
File.open(@facade.flavorfile_path, 'w') do |f|
|
304
305
|
f.write(<<-'END')
|
305
306
|
END
|
306
307
|
end
|
307
308
|
end
|
308
309
|
|
309
|
-
after :each do
|
310
|
-
clean_up_stashed_stuffs()
|
311
|
-
end
|
312
|
-
|
313
310
|
it 'should save locked flavors' do
|
314
311
|
@facade.load()
|
315
312
|
|
@@ -342,15 +339,15 @@ describe Vim::Flavor::Facade do
|
|
342
339
|
end
|
343
340
|
|
344
341
|
describe '#complete_locked_flavors' do
|
342
|
+
with_temporary_directory
|
343
|
+
|
345
344
|
before :each do
|
346
|
-
@test_repo_path = "#{
|
347
|
-
@tmp_path = "#{Vim::Flavor::DOT_PATH}/tmp"
|
345
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
348
346
|
@facade = described_class.new()
|
349
347
|
@facade.flavorfile_path = "#{@tmp_path}/VimFlavor"
|
350
348
|
@facade.lockfile_path = "#{@tmp_path}/VimFlavor.lock"
|
351
349
|
|
352
350
|
create_a_test_repo(@test_repo_path)
|
353
|
-
FileUtils.mkdir_p(@tmp_path)
|
354
351
|
File.open(@facade.flavorfile_path, 'w') do |f|
|
355
352
|
f.write(<<-"END")
|
356
353
|
flavor 'file://#{@test_repo_path}', '~> 1.1.1'
|
@@ -358,10 +355,6 @@ describe Vim::Flavor::Facade do
|
|
358
355
|
end
|
359
356
|
end
|
360
357
|
|
361
|
-
after :each do
|
362
|
-
clean_up_stashed_stuffs()
|
363
|
-
end
|
364
|
-
|
365
358
|
it 'should complete flavors if they are not locked' do
|
366
359
|
@facade.load()
|
367
360
|
|
@@ -456,16 +449,16 @@ describe Vim::Flavor::Facade do
|
|
456
449
|
end
|
457
450
|
|
458
451
|
describe '#install' do
|
452
|
+
with_temporary_directory
|
453
|
+
|
459
454
|
before :each do
|
460
|
-
@test_repo_path = "#{
|
461
|
-
@
|
462
|
-
@vimfiles_path = "#{Vim::Flavor::DOT_PATH}/vimfiles"
|
455
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
456
|
+
@vimfiles_path = "#{@tmp_path}/vimfiles"
|
463
457
|
@facade = described_class.new()
|
464
458
|
@facade.flavorfile_path = "#{@tmp_path}/VimFlavor"
|
465
459
|
@facade.lockfile_path = "#{@tmp_path}/VimFlavor.lock"
|
466
460
|
|
467
461
|
create_a_test_repo(@test_repo_path)
|
468
|
-
FileUtils.mkdir_p(@tmp_path)
|
469
462
|
File.open(@facade.flavorfile_path, 'w') do |f|
|
470
463
|
f.write(<<-"END")
|
471
464
|
flavor 'file://#{@test_repo_path}', '~> 1.1.1'
|
@@ -473,10 +466,6 @@ describe Vim::Flavor::Facade do
|
|
473
466
|
end
|
474
467
|
end
|
475
468
|
|
476
|
-
after :each do
|
477
|
-
clean_up_stashed_stuffs()
|
478
|
-
end
|
479
|
-
|
480
469
|
it 'should install Vim plugins according to VimFlavor' do
|
481
470
|
File.exists?(@facade.lockfile_path).should be_false
|
482
471
|
File.exists?(@vimfiles_path).should be_false
|
@@ -509,16 +498,16 @@ describe Vim::Flavor::Facade do
|
|
509
498
|
end
|
510
499
|
|
511
500
|
describe '#upgrade' do
|
501
|
+
with_temporary_directory
|
502
|
+
|
512
503
|
before :each do
|
513
|
-
@test_repo_path = "#{
|
514
|
-
@
|
515
|
-
@vimfiles_path = "#{Vim::Flavor::DOT_PATH}/vimfiles"
|
504
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
505
|
+
@vimfiles_path = "#{@tmp_path}/vimfiles"
|
516
506
|
@facade = described_class.new()
|
517
507
|
@facade.flavorfile_path = "#{@tmp_path}/VimFlavor"
|
518
508
|
@facade.lockfile_path = "#{@tmp_path}/VimFlavor.lock"
|
519
509
|
|
520
510
|
create_a_test_repo(@test_repo_path)
|
521
|
-
FileUtils.mkdir_p(@tmp_path)
|
522
511
|
File.open(@facade.flavorfile_path, 'w') do |f|
|
523
512
|
f.write(<<-"END")
|
524
513
|
flavor 'file://#{@test_repo_path}', '~> 1.1.1'
|
@@ -526,10 +515,6 @@ describe Vim::Flavor::Facade do
|
|
526
515
|
end
|
527
516
|
end
|
528
517
|
|
529
|
-
after :each do
|
530
|
-
clean_up_stashed_stuffs()
|
531
|
-
end
|
532
|
-
|
533
518
|
it 'should upgrade Vim plugins according to VimFlavor' do
|
534
519
|
File.exists?(@facade.lockfile_path).should be_false
|
535
520
|
File.exists?(@vimfiles_path).should be_false
|
data/spec/flavor_spec.rb
CHANGED
@@ -20,8 +20,10 @@ describe Vim::Flavor::Flavor do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#clone' do
|
23
|
+
with_temporary_directory
|
24
|
+
|
23
25
|
before :each do
|
24
|
-
@test_repo_path = "#{
|
26
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
25
27
|
|
26
28
|
@flavor = described_class.new()
|
27
29
|
@flavor.repo_name = '@test_repo_path'
|
@@ -29,10 +31,6 @@ describe Vim::Flavor::Flavor do
|
|
29
31
|
@flavor.locked_version = '1.0.0'
|
30
32
|
end
|
31
33
|
|
32
|
-
after :each do
|
33
|
-
clean_up_stashed_stuffs()
|
34
|
-
end
|
35
|
-
|
36
34
|
it 'should clone the repository into a given path' do
|
37
35
|
create_a_test_repo(@test_repo_path)
|
38
36
|
|
@@ -45,8 +43,10 @@ describe Vim::Flavor::Flavor do
|
|
45
43
|
end
|
46
44
|
|
47
45
|
describe '#fetch' do
|
46
|
+
with_temporary_directory
|
47
|
+
|
48
48
|
before :each do
|
49
|
-
@test_repo_path = "#{
|
49
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
50
50
|
|
51
51
|
@flavor = described_class.new()
|
52
52
|
@flavor.repo_name = '@test_repo_path'
|
@@ -54,10 +54,6 @@ describe Vim::Flavor::Flavor do
|
|
54
54
|
@flavor.locked_version = '1.0.0'
|
55
55
|
end
|
56
56
|
|
57
|
-
after :each do
|
58
|
-
clean_up_stashed_stuffs()
|
59
|
-
end
|
60
|
-
|
61
57
|
it 'should fail if the repository is not cloned yet' do
|
62
58
|
expect {
|
63
59
|
@flavor.fetch()
|
@@ -87,22 +83,20 @@ describe Vim::Flavor::Flavor do
|
|
87
83
|
end
|
88
84
|
|
89
85
|
describe '#deploy' do
|
86
|
+
with_temporary_directory
|
87
|
+
|
90
88
|
before :each do
|
91
|
-
@test_repo_path = "#{
|
89
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
92
90
|
|
93
91
|
@flavor = described_class.new()
|
94
92
|
@flavor.repo_name = '@test_repo_path'
|
95
93
|
@flavor.repo_uri = @test_repo_path
|
96
94
|
@flavor.locked_version = '1.0.0'
|
97
95
|
|
98
|
-
@vimfiles_path = "#{
|
96
|
+
@vimfiles_path = "#{@tmp_path}/vimfiles"
|
99
97
|
@deploy_path = @flavor.make_deploy_path(@vimfiles_path)
|
100
98
|
end
|
101
99
|
|
102
|
-
after :each do
|
103
|
-
clean_up_stashed_stuffs()
|
104
|
-
end
|
105
|
-
|
106
100
|
it 'should deploy files of a locked version to a given path' do
|
107
101
|
create_a_test_repo(@test_repo_path)
|
108
102
|
@flavor.clone()
|
@@ -179,22 +173,20 @@ describe Vim::Flavor::Flavor do
|
|
179
173
|
end
|
180
174
|
|
181
175
|
describe '#undeploy' do
|
176
|
+
with_temporary_directory
|
177
|
+
|
182
178
|
before :each do
|
183
|
-
@test_repo_path = "#{
|
179
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
184
180
|
|
185
181
|
@flavor = described_class.new()
|
186
182
|
@flavor.repo_name = '@test_repo_path'
|
187
183
|
@flavor.repo_uri = @test_repo_path
|
188
184
|
@flavor.locked_version = '1.0.0'
|
189
185
|
|
190
|
-
@vimfiles_path = "#{
|
186
|
+
@vimfiles_path = "#{@tmp_path}/vimfiles"
|
191
187
|
@deploy_path = @flavor.make_deploy_path(@vimfiles_path)
|
192
188
|
end
|
193
189
|
|
194
|
-
after :each do
|
195
|
-
clean_up_stashed_stuffs()
|
196
|
-
end
|
197
|
-
|
198
190
|
it 'should remove deployed files' do
|
199
191
|
create_a_test_repo(@test_repo_path)
|
200
192
|
@flavor.clone()
|
@@ -209,8 +201,10 @@ describe Vim::Flavor::Flavor do
|
|
209
201
|
end
|
210
202
|
|
211
203
|
describe '#list_versions' do
|
204
|
+
with_temporary_directory
|
205
|
+
|
212
206
|
before :each do
|
213
|
-
@test_repo_path = "#{
|
207
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
214
208
|
|
215
209
|
@flavor = described_class.new()
|
216
210
|
@flavor.repo_name = '@test_repo_path'
|
@@ -218,10 +212,6 @@ describe Vim::Flavor::Flavor do
|
|
218
212
|
@flavor.locked_version = '1.0.0'
|
219
213
|
end
|
220
214
|
|
221
|
-
after :each do
|
222
|
-
clean_up_stashed_stuffs()
|
223
|
-
end
|
224
|
-
|
225
215
|
it 'should list tags as versions' do
|
226
216
|
create_a_test_repo(@test_repo_path)
|
227
217
|
@flavor.clone()
|
@@ -236,8 +226,10 @@ describe Vim::Flavor::Flavor do
|
|
236
226
|
end
|
237
227
|
|
238
228
|
describe '#update_locked_version' do
|
229
|
+
with_temporary_directory
|
230
|
+
|
239
231
|
before :each do
|
240
|
-
@test_repo_path = "#{
|
232
|
+
@test_repo_path = "#{@tmp_path}/test/origin"
|
241
233
|
|
242
234
|
@flavor = described_class.new()
|
243
235
|
@flavor.repo_name = '@test_repo_path'
|
@@ -245,10 +237,6 @@ describe Vim::Flavor::Flavor do
|
|
245
237
|
@flavor.locked_version = nil
|
246
238
|
end
|
247
239
|
|
248
|
-
after :each do
|
249
|
-
clean_up_stashed_stuffs()
|
250
|
-
end
|
251
|
-
|
252
240
|
it 'should update locked_version according to version_contraint' do
|
253
241
|
create_a_test_repo(@test_repo_path)
|
254
242
|
@flavor.clone()
|
data/spec/flavorfile_spec.rb
CHANGED
data/spec/lockfile_spec.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'spec_helper'
|
3
4
|
require 'vim-flavor'
|
4
5
|
|
5
6
|
describe Vim::Flavor::LockFile do
|
6
|
-
|
7
|
-
@lockfile_path = "#{Vim::Flavor::DOT_PATH}/VimFlavor.lock"
|
8
|
-
end
|
7
|
+
with_temporary_directory
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
before :each do
|
10
|
+
@lockfile_path = "#{@tmp_path}/VimFlavor.lock"
|
12
11
|
end
|
13
12
|
|
14
13
|
it 'should be initialized with a given path and no flavor' do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'tmpdir'
|
5
|
+
require 'vim-flavor'
|
3
6
|
|
4
7
|
def create_a_test_repo(path)
|
5
8
|
system(<<-"END")
|
@@ -35,6 +38,26 @@ def update_a_test_repo(path)
|
|
35
38
|
END
|
36
39
|
end
|
37
40
|
|
38
|
-
def
|
39
|
-
|
41
|
+
def create_temporary_directory()
|
42
|
+
Dir.mktmpdir()
|
43
|
+
end
|
44
|
+
|
45
|
+
def remove_temporary_directory(path)
|
46
|
+
FileUtils.remove_entry_secure(path)
|
47
|
+
end
|
48
|
+
|
49
|
+
def with_temporary_directory()
|
50
|
+
before :each do
|
51
|
+
@tmp_path = create_temporary_directory()
|
52
|
+
|
53
|
+
@original_dot_path = Vim::Flavor.dot_path
|
54
|
+
@dot_path = "#{@tmp_path}/.vim-flavor"
|
55
|
+
Vim::Flavor.dot_path = @dot_path
|
56
|
+
end
|
57
|
+
|
58
|
+
after :each do
|
59
|
+
Vim::Flavor.dot_path = @original_dot_path
|
60
|
+
|
61
|
+
remove_temporary_directory(@tmp_path)
|
62
|
+
end
|
40
63
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: vim-flavor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kana Natsuno
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-27 00:00:00 +09:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -49,7 +49,7 @@ files:
|
|
49
49
|
- Gemfile
|
50
50
|
- Gemfile.lock
|
51
51
|
- LICENSE
|
52
|
-
- README.
|
52
|
+
- README.md
|
53
53
|
- Rakefile
|
54
54
|
- bin/vim-flavor
|
55
55
|
- lib/vim-flavor.rb
|
data/README.asciidoc
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
= vim-flavor: a tool to manage your favorite Vim plugins
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
== Set up the utility for a new-style plugin management
|
7
|
-
|
8
|
-
=== Requirements
|
9
|
-
|
10
|
-
* Git 1.7.9 or later
|
11
|
-
* Ruby 1.9.2 or later
|
12
|
-
* Vim 7.3 or later
|
13
|
-
|
14
|
-
|
15
|
-
=== Supported platforms
|
16
|
-
|
17
|
-
* Unix-like environments such as Linux, Mac OS X, etc.
|
18
|
-
* Though Microsoft Windows is not directly supported,
|
19
|
-
it is possible to manage Vim plugins via Cygwin or other environments.
|
20
|
-
|
21
|
-
|
22
|
-
=== Installation steps
|
23
|
-
|
24
|
-
----
|
25
|
-
gem install vim-flavor
|
26
|
-
----
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
== Start using vim-flavor
|
32
|
-
|
33
|
-
----
|
34
|
-
cd $YOUR_REPOSITORY_FOR_DOTFILES
|
35
|
-
|
36
|
-
cat >VimFlavor <<'END'
|
37
|
-
# * Declare using git://github.com/kana/vim-textobj-indent.git
|
38
|
-
# * vim-flavor fetches a plugin from git://github.com/$USER/$REPO.git
|
39
|
-
# if the argument is written in '$USER/$REPO' format.
|
40
|
-
# * kana/vim-textobj-indent requires kana/vim-textobj-user.
|
41
|
-
# Such dependencies are automatically installed
|
42
|
-
# if the flavored plugin declares its dependencies with VimFlavor file.
|
43
|
-
# (FIXME: Resolving dependencies will be implemented later.)
|
44
|
-
flavor 'kana/vim-textobj-indent'
|
45
|
-
|
46
|
-
# * Declare using git://github.com/vim-scripts/fakeclip.git
|
47
|
-
# * vim-flavor fetches a plugin from git://github.com/vim-scripts/$REPO.git
|
48
|
-
# if the argument is written in '$REPO' format.
|
49
|
-
flavor 'fakeclip'
|
50
|
-
|
51
|
-
# * Declare using git://github.com/kana/vim-altr.git
|
52
|
-
# * vim-flavor fetches a plugin from the URI
|
53
|
-
# if the argument seems to be a URI.
|
54
|
-
flavor 'git://github.com/kana/vim-altr.git'
|
55
|
-
|
56
|
-
# * Declare using kana/vim-smartchr 0.1.0 or later and older than 0.2.0.
|
57
|
-
flavor 'kana/vim-smartchr', '~> 0.1.0'
|
58
|
-
|
59
|
-
# * Declare using kana/vim-smartword 0.1 or later and older than 1.0.
|
60
|
-
flavor 'kana/vim-smartword', '~> 0.1'
|
61
|
-
|
62
|
-
# * Declare using kana/vim-smarttill 0.1.0 or later.
|
63
|
-
flavor 'kana/vim-smarttill', '>= 0.1.0'
|
64
|
-
END
|
65
|
-
|
66
|
-
# Fetch the plugins declared in the VimFlavor,
|
67
|
-
# create VimFlavor.lock for a snapshot of all plugins and versions,
|
68
|
-
# then install the plugins and a bootstrap script into ~/.vim etc.
|
69
|
-
vim-flavor install
|
70
|
-
|
71
|
-
# Add the following line into the first line of your vimrc:
|
72
|
-
#
|
73
|
-
# runtime flavors/bootstrap.vim
|
74
|
-
vim vimrc
|
75
|
-
|
76
|
-
git add VimFlavor VimFlavor.lock vimrc
|
77
|
-
git commit -m 'Use vim-flavor to manage my favorite Vim plugins'
|
78
|
-
----
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
== Upgrade all plugins to the latest version
|
84
|
-
|
85
|
-
----
|
86
|
-
vim-flavor upgrade
|
87
|
-
|
88
|
-
git add VimFlavor.lock
|
89
|
-
git commit -m 'Upgrade my favorite Vim plugins'
|
90
|
-
----
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
== Add more plugins into your dotfile repository
|
96
|
-
|
97
|
-
----
|
98
|
-
cat >>VimFlavor <<'END'
|
99
|
-
|
100
|
-
flavor 'kana/vim-operator-replace'
|
101
|
-
|
102
|
-
END
|
103
|
-
|
104
|
-
# Fetch newly added plugins,
|
105
|
-
# update VimFlavor.lock for the plugins,
|
106
|
-
# then install the plugins into ~/.vim etc.
|
107
|
-
vim-flavor install
|
108
|
-
|
109
|
-
git add VimFlavor VimFlavor.lock
|
110
|
-
git commit -m 'Use kana/vim-operator-replace'
|
111
|
-
----
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
== Remove plugins from your dotfile repository
|
117
|
-
|
118
|
-
----
|
119
|
-
# Remove declarations of unused plugins from VimFlavor.
|
120
|
-
sed -i~ -e '/vim-smartchr/d' VimFlavor
|
121
|
-
|
122
|
-
# Update VimFlavor.lock for the removed plugins,
|
123
|
-
# then clean up the plugins from ~/.vim etc.
|
124
|
-
vim-flavor install
|
125
|
-
|
126
|
-
git add VimFlavor VimFlavor.lock
|
127
|
-
git commit -m 'Farewell kana/vim-smartchr'
|
128
|
-
----
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
== Install plugins into a non-standard directory
|
134
|
-
|
135
|
-
----
|
136
|
-
vim-flavor install --vimfiles-path=/cygdrive/c/Users/kana/vimfiles
|
137
|
-
----
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
// vim: filetype=asciidoc
|