Class: Vim::Jar::Plugin::Git

Inherits:
Object
  • Object
show all
Includes:
Installer::Git
Defined in:
lib/vim-jar/plugin/git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Installer::Git

#install_to, #remove_from_cache, #remove_ref_from_git_config, #remove_ref_from_gitmodules, #uninstall_for

Constructor Details

#initialize(url, args = {}) ⇒ Git

Returns a new instance of Git.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vim-jar/plugin/git.rb', line 9

def initialize(url, args={}) 
  if url !~ /(https|git):\/\/github\.com/
    raise InstallError.new("Not support this git repository #{url}.")
  end
  if url !~ /\.git$/ 
    raise InstallError.new("#{url} is not a valid github repository url.")
  end
  if url.split("/").last =~ /(.+?)\.git$/
    @name = $1
  else
    raise InstallError.new("#{url} is not a valid github repository url.")
  end
  @url = url
  @target_path = config.bundle_home.join(name)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/vim-jar/plugin/git.rb', line 7

def name
  @name
end

#target_pathObject (readonly)

Returns the value of attribute target_path.



7
8
9
# File 'lib/vim-jar/plugin/git.rb', line 7

def target_path
  @target_path
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/vim-jar/plugin/git.rb', line 7

def url
  @url
end

Instance Method Details

#configObject



35
36
37
# File 'lib/vim-jar/plugin/git.rb', line 35

def config 
  ::Vim::Jar::Config.instance
end

#installObject



25
26
27
28
29
# File 'lib/vim-jar/plugin/git.rb', line 25

def install
  if !File.exist?(target_path) 
    install_to(url, target_path) 
  end
end

#uninstallObject



31
32
33
# File 'lib/vim-jar/plugin/git.rb', line 31

def uninstall
  uninstall_for(self.name)
end