Class: VRundler::VimZipBundle
- Inherits:
-
Object
- Object
- VRundler::VimZipBundle
show all
- Includes:
- BasicBundle
- Defined in:
- lib/vrundler/vim_zip_bundle.rb
Instance Attribute Summary collapse
Attributes included from BasicBundle
#completion_block
Instance Method Summary
collapse
#after_download, #delete_existing_folder, #dont_delete, #run_extra, #unpack
Constructor Details
Returns a new instance of VimZipBundle.
8
9
10
11
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 8
def initialize(name, id)
@name = name
@id = id
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5
6
7
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 5
def id
@id
end
|
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 5
def name
@name
end
|
Instance Method Details
#bundle_specific_unpack ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 35
def bundle_specific_unpack
puts " Downloading zip: [#{name}]"
folder_name = Bundles.bundle_folder(name)
FileUtils.mkdir_p(folder_name)
Dir.chdir(folder_name) do
command = create_unzip_command
`#{command}`
`unzip #{zip_file}` if windows?
`gunzip #{zip_file}` if linux?
`rm #{zip_file}` if windows? || linux?
end
end
|
#create_unzip_command ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 21
def create_unzip_command
command = "curl #{url}"
if windows? || linux?
command += " > #{zip_file}"
else
command += " | tar -xv"
end
end
|
#linux? ⇒ Boolean
17
18
19
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 17
def linux?
RUBY_PLATFORM =~ /linux/
end
|
#url ⇒ Object
52
53
54
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 52
def url
"http://www.vim.org/scripts/download_script.php?src_id=#{id}"
end
|
#windows? ⇒ Boolean
13
14
15
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 13
def windows?
RUBY_PLATFORM =~ /(mingw|cyg)/
end
|
#zip_file ⇒ Object
31
32
33
|
# File 'lib/vrundler/vim_zip_bundle.rb', line 31
def zip_file
"#{name}.zip"
end
|