Module: Ronin::Platform
Public Visibility
Public Class Method Summary
| add(options = {}, &block) {|overlay| ... } |
Adds a new overlay to the overlay cache. Returns: Overlay |
|---|---|
| extension(name, &block) {|ext| ... } |
Loads an extension into the extension cache, if it has yet to be. Returns: Extension |
| extension_names |
Returns: Array |
| extensions |
The extension cache. Returns: ExtensionCache |
| has_extension?(name) |
Searches for the extension with the specified name, in all. Returns: Boolean |
| install(options = {}, &block) {|overlay| ... } |
Installs an overlay into the OverlayCache::CACHE_DIR and adds it. Returns: Overlay |
| load_overlays(path = OverlayCache::CACHE_FILE) |
Load the overlay cache. Returns: OverlayCache |
| overlays |
Returns: OverlayCache |
| reload! |
Reloads the overlay cache and the extension cache. Returns: Boolean |
| remove(name, &block) {|overlay| ... } |
Removes an overlay from the overlay cache, but leaves the contents. |
| uninstall(name, &block) |
Uninstalls an overlay from the overlay cache, and deletes the. |
| update(&block) |
Updates all previously installed overlays within the overlay cache. |
Public Class Method Details
add
Adds a new overlay to the overlay cache.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/ronin/platform/platform.rb', line 92 def Platform.add(={},&block) path = [:path] unless path raise(ArgumentError,":path must be passed to Platform.add",caller) end path = path.to_s unless File.directory?(path) raise(OverlayNotFound,"overlay #{path.dump} cannot be found",caller) end media = [:media] uri = [:uri] = Overlay.new(path,media,uri) Platform..add() do || ObjectCache.cache(.objects_dir) end block.call() if block return end |
extension
Loads an extension into the extension cache, if it has yet to be loaded.
287 288 289 290 291 292 |
# File 'lib/ronin/platform/platform.rb', line 287 def Platform.extension(name,&block) ext = Platform.extensions[name] block.call(ext) if block return ext end |
extension_names
233 234 235 |
# File 'lib/ronin/platform/platform.rb', line 233 def Platform.extension_names Platform..extensions end |
extensions
The extension cache.
262 263 264 |
# File 'lib/ronin/platform/platform.rb', line 262 def Platform.extensions @@ronin_extension_cache ||= ExtensionCache.new end |
has_extension?
Searches for the extension with the specified name, in all overlays within the overlay cache.
248 249 250 |
# File 'lib/ronin/platform/platform.rb', line 248 def Platform.has_extension?(name) Platform..has_extension?(name) end |
install
Installs an overlay into the OverlayCache::CACHE_DIR and adds it to the overlay cache.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/ronin/platform/platform.rb', line 145 def Platform.install(={},&block) unless [:uri] raise(ArgumentError,":uri must be passed to Platform.install",caller) end uri = [:uri].to_s host = (URI(uri).host || 'localhost') host_dir = File.join(OverlayCache::CACHE_DIR,host) = .merge(:into => host_dir) Repertoire.checkout() do |repo| return Platform.add( :path => repo.path, :media => repo.media_name, :uri => uri, &block ) end end |
load_overlays
Load the overlay cache.
47 48 49 |
# File 'lib/ronin/platform/platform.rb', line 47 def Platform.(path=OverlayCache::CACHE_FILE) = OverlayCache.new(path) end |
overlays
56 57 58 |
# File 'lib/ronin/platform/platform.rb', line 56 def Platform. ||= OverlayCache.new end |
reload!
Reloads the overlay cache and the extension cache.
300 301 302 |
# File 'lib/ronin/platform/platform.rb', line 300 def Platform.reload! Platform..reload! && Platform.extensions.reload! end |
remove
Removes an overlay from the overlay cache, but leaves the contents of the overlay intact.
199 200 201 202 |
# File 'lib/ronin/platform/platform.rb', line 199 def Platform.remove(name,&block) Platform..remove(name,&block) return nil end |
uninstall
Uninstalls an overlay from the overlay cache, and deletes the contents of the overlay.
219 220 221 222 223 224 225 226 |
# File 'lib/ronin/platform/platform.rb', line 219 def Platform.uninstall(name,&block) Platform..uninstall(name) do || ObjectCache.clean(.objects_dir) end block.call() if block return nil end |
update
Updates all previously installed overlays within the overlay cache.
172 173 174 175 176 177 178 179 |
# File 'lib/ronin/platform/platform.rb', line 172 def Platform.update(&block) Platform..update do || ObjectCache.mirror(.objects_dir) end block.call if block return nil end |