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
-
#list ⇒ Object
Shows available packages.
- #remove(package) ⇒ Object
- #show(package) ⇒ Object
-
#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
61 62 63 |
# File 'lib/providers/provider.rb', line 61 def install(*packages) puts "Dummy implementation. Should install: #{packages.join(",")}" end |
#list ⇒ Object
Shows available packages
57 58 59 |
# File 'lib/providers/provider.rb', line 57 def list return [] end |
#remove(package) ⇒ Object
69 70 71 |
# File 'lib/providers/provider.rb', line 69 def remove(package) # do nothing end |
#show(package) ⇒ Object
65 66 67 |
# File 'lib/providers/provider.rb', line 65 def show(package) [] end |
#update ⇒ Object
Updates package index
51 52 53 |
# File 'lib/providers/provider.rb', line 51 def update true end |