Class: VimPK::Commands::Install
- Inherits:
-
Object
- Object
- VimPK::Commands::Install
- Includes:
- VimPK::Colorizer
- Defined in:
- lib/vimpk/commands/install.rb
Instance Attribute Summary collapse
-
#dest ⇒ Object
readonly
Returns the value of attribute dest.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(package, options) ⇒ Install
constructor
A new instance of Install.
Constructor Details
#initialize(package, options) ⇒ Install
Returns a new instance of Install.
8 9 10 11 12 13 14 15 16 |
# File 'lib/vimpk/commands/install.rb', line 8 def initialize(package, ) @package = package || raise(ArgumentError, "Package name is required") @path = .path @pack = .pack || .default_pack @type = .type || .default_type @dest = File.join(@path, @pack, @type, File.basename(@package)) @source = "https://github.com/#{package}.git" @git = Git end |
Instance Attribute Details
#dest ⇒ Object (readonly)
Returns the value of attribute dest.
6 7 8 |
# File 'lib/vimpk/commands/install.rb', line 6 def dest @dest end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 |
# File 'lib/vimpk/commands/install.rb', line 18 def call raise PackageExistsError, "Package #{@package} already exists at #{@dest}" if File.exist?(@dest) Git.clone(@source, @dest, dir: @path) end |