Class: Rip::DirPackage
- Defined in:
- lib/rip/packages/dir_package.rb
Instance Attribute Summary
Attributes inherited from Package
Instance Method Summary collapse
- #exists? ⇒ Boolean
- #fetch! ⇒ Object
-
#initialize(source, *args) ⇒ DirPackage
constructor
A new instance of DirPackage.
- #name ⇒ Object
- #version ⇒ Object
Methods inherited from Package
#cache_name, #cache_path, #dependencies, #dependencies!, #fetch, #files!, for, handles, #installed?, #packages_path, #run_hook, #to_s, #ui, #unpack
Methods included from PackageAPI
#cached?, #dependencies!, #files!, #meta_package?, #unpack!
Methods included from Memoize
included, #memoize, #method_added
Constructor Details
#initialize(source, *args) ⇒ DirPackage
Returns a new instance of DirPackage.
7 8 9 10 |
# File 'lib/rip/packages/dir_package.rb', line 7 def initialize(source, *args) super @source = File.(source) end |
Instance Method Details
#exists? ⇒ Boolean
12 13 14 |
# File 'lib/rip/packages/dir_package.rb', line 12 def exists? File.directory? source end |
#fetch! ⇒ Object
29 30 31 32 |
# File 'lib/rip/packages/dir_package.rb', line 29 def fetch! FileUtils.rm_rf cache_path FileUtils.cp_r "#{source}/.", cache_path end |
#name ⇒ Object
17 18 19 |
# File 'lib/rip/packages/dir_package.rb', line 17 def name File.basename(source) end |
#version ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rip/packages/dir_package.rb', line 21 def version if name.match(/-((?:\d+\.?)+\d+)$/) $1 else "unversioned" end end |