vimbrew 0.0.1.a.2 → 0.0.1.a.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/lib/vimbrew/downloaders.rb +1 -0
- data/lib/vimbrew/downloaders/vim_org.rb +48 -0
- data/lib/vimbrew/recipe.rb +1 -0
- data/lib/vimbrew/version.rb +1 -1
- metadata +4 -3
data/lib/vimbrew/downloaders.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
class Vimbrew::Downloaders::VimOrg < Vimbrew::Downloaders::Abstract
|
2
|
+
|
3
|
+
def initialize(url, options={})
|
4
|
+
@id = File.basename(url.path)
|
5
|
+
@id, @type = @id.split('.', 2)
|
6
|
+
end
|
7
|
+
|
8
|
+
def fetch_into(shell, dst)
|
9
|
+
@shell = shell
|
10
|
+
dst.dirname.mkpath
|
11
|
+
dst.rmtree rescue nil
|
12
|
+
|
13
|
+
tmp_dst = dst.dirname + (dst.basename.to_s + '.vimbrew_tmp')
|
14
|
+
tmp_dst.rmtree rescue nil
|
15
|
+
tmp_dst.mkpath
|
16
|
+
|
17
|
+
plugin_dir = nil
|
18
|
+
|
19
|
+
Dir.chdir(tmp_dst) do
|
20
|
+
sh("wget -O #{@id}.#{@type} http://www.vim.org/scripts/download_script.php?src_id=#{@id}")
|
21
|
+
|
22
|
+
download = tmp_dst.children.first
|
23
|
+
case @type
|
24
|
+
when 'vim'
|
25
|
+
(tmp_dst + 'tmp/plugin').mkpath
|
26
|
+
download.rename(tmp_dst + 'tmp/plugin' + download.basename.to_s)
|
27
|
+
plugin_dir = tmp_dst + 'tmp'
|
28
|
+
when 'zip'
|
29
|
+
sh("unzip #{download}")
|
30
|
+
download.unlink
|
31
|
+
plugin_dir = tmp_dst.children.first
|
32
|
+
when 'tar.gz'
|
33
|
+
sh("tar xzf #{download}")
|
34
|
+
download.unlink
|
35
|
+
plugin_dir = tmp_dst.children.first
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
plugin_dir.rename(dst) if plugin_dir and plugin_dir.directory?
|
40
|
+
ensure
|
41
|
+
tmp_dst.rmtree rescue nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def version
|
45
|
+
@id.to_s
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
data/lib/vimbrew/recipe.rb
CHANGED
data/lib/vimbrew/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimbrew
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 123
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 1
|
10
10
|
- a
|
11
|
-
-
|
12
|
-
version: 0.0.1.a.
|
11
|
+
- 3
|
12
|
+
version: 0.0.1.a.3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Simon Menke
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/vimbrew/commands.rb
|
57
57
|
- lib/vimbrew/downloaders/abstract.rb
|
58
58
|
- lib/vimbrew/downloaders/git.rb
|
59
|
+
- lib/vimbrew/downloaders/vim_org.rb
|
59
60
|
- lib/vimbrew/downloaders.rb
|
60
61
|
- lib/vimbrew/environment.rb
|
61
62
|
- lib/vimbrew/recipe.rb
|