Class: Vim::Jar::Plugin::Git
- Inherits:
-
Object
- Object
- Vim::Jar::Plugin::Git
- Includes:
- Installer::Git
- Defined in:
- lib/vim-jar/plugin/git.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#target_path ⇒ Object
readonly
Returns the value of attribute target_path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(url, args = {}) ⇒ Git
constructor
A new instance of Git.
- #install ⇒ Object
- #uninstall ⇒ Object
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
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/vim-jar/plugin/git.rb', line 7 def name @name end |
#target_path ⇒ Object (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 |
#url ⇒ Object (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
#config ⇒ Object
35 36 37 |
# File 'lib/vim-jar/plugin/git.rb', line 35 def config ::Vim::Jar::Config.instance end |
#install ⇒ Object
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 |
#uninstall ⇒ Object
31 32 33 |
# File 'lib/vim-jar/plugin/git.rb', line 31 def uninstall uninstall_for(self.name) end |