Class: LaPack::Provider
- Inherits:
-
Object
- Object
- LaPack::Provider
- Defined in:
- lib/providers/provider.rb
Overview
Base package provider. I.e. database wrapper.
Should know how to:
-
fetch packages index and manage
-
show package info
-
download, make & install packages
-
remove packages
-
keeps multiple versions
Direct Known Subclasses
Instance Method Summary collapse
-
#configure(params = {}) ⇒ Object
Configuration.
-
#init(dbdir) ⇒ Object
Initialization.
-
#initialize(env, name, params) ⇒ Provider
constructor
Initialization with LaENV instance.
-
#install(*packages) ⇒ Object
Install each package from
packages. -
#list ⇒ Object
Shows available packages.
-
#remove(package) ⇒ Object
Delete package from local store.
-
#show(package) ⇒ Object
Show
packagedetails. -
#update ⇒ Object
Updates package index.
Constructor Details
#initialize(env, name, params) ⇒ Provider
Initialization with LaENV instance
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/providers/provider.rb', line 17 def initialize(env, name, params) @name = name # Check if db dir exists @dbdir = File.join(env.dbs_store, name) if File.exists?(@dbdir) raise "Can't write to #{@dbdir}. Not a directory" unless File.directory?(@dbdir) else FileUtils.mkdir_p(@dbdir) end configure(params) init(@dbdir) end |
Instance Method Details
#configure(params = {}) ⇒ Object
Configuration
Accepts any parameters (params) for configuration as Hash
35 36 37 |
# File 'lib/providers/provider.rb', line 35 def configure(params = {}) true end |
#init(dbdir) ⇒ Object
Initialization
Uses dbdir argument for filesystem initialization No index update required there.
45 46 47 |
# File 'lib/providers/provider.rb', line 45 def init(dbdir) end |
#install(*packages) ⇒ Object
Install each package from packages
65 66 67 |
# File 'lib/providers/provider.rb', line 65 def install(*packages) puts "Dummy implementation. Should install: #{packages.join(",")}" end |
#list ⇒ Object
Shows available packages
58 59 60 |
# File 'lib/providers/provider.rb', line 58 def list return [] end |
#remove(package) ⇒ Object
Delete package from local store
79 80 81 |
# File 'lib/providers/provider.rb', line 79 def remove(package) # do nothing end |
#show(package) ⇒ Object
Show package details
72 73 74 |
# File 'lib/providers/provider.rb', line 72 def show(package) [] end |
#update ⇒ Object
Updates package index
51 52 53 |
# File 'lib/providers/provider.rb', line 51 def update true end |