Class: VRundler::VimScriptBundle

Inherits:
Object
  • Object
show all
Includes:
BasicBundle
Defined in:
lib/vrundler/vim_script_bundle.rb

Instance Attribute Summary collapse

Attributes included from BasicBundle

#completion_block

Instance Method Summary collapse

Methods included from BasicBundle

#after_download, #delete_existing_folder, #dont_delete, #run_extra, #unpack

Constructor Details

#initialize(name, type, id) ⇒ VimScriptBundle

Returns a new instance of VimScriptBundle.



9
10
11
12
13
# File 'lib/vrundler/vim_script_bundle.rb', line 9

def initialize(name, type, id)
  @name = name
  @script_type = type
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/vrundler/vim_script_bundle.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/vrundler/vim_script_bundle.rb', line 5

def name
  @name
end

#script_typeObject (readonly)

Returns the value of attribute script_type.



5
6
7
# File 'lib/vrundler/vim_script_bundle.rb', line 5

def script_type
  @script_type
end

Instance Method Details

#bundle_specific_unpackObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vrundler/vim_script_bundle.rb', line 15

def bundle_specific_unpack
  puts " Downloading script: [#{name}]"

  local_file = File.join(name, script_type, "#{name}.vim")

  FileUtils.mkdir_p(File.dirname(local_file))

  File.open(local_file, "w") do |file|
    file << open(url).read
  end
end

#urlObject



27
28
29
# File 'lib/vrundler/vim_script_bundle.rb', line 27

def url
  "http://www.vim.org/scripts/download_script.php?scr_id=#{self.id}"
end