Class: FPM::Fry::Inspector
- Inherits:
-
Object
- Object
- FPM::Fry::Inspector
- Defined in:
- lib/fpm/fry/inspector.rb
Overview
An inspector allows a plugin to gather information about the image used to build a package.
Class Method Summary collapse
Instance Method Summary collapse
-
#exists?(path) ⇒ true, false
Checks if file exists at path.
-
#link_target(path) ⇒ String?
Determines the target of a link.
-
#read(path) {|entry| ... } ⇒ Object
Gets whatever is at path.
-
#read_content(path) ⇒ String
Gets the file content at path.
Class Method Details
.for_image(client, image) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/fpm/fry/inspector.rb', line 51 def self.for_image(client, image) container = client.create(image) begin yield new(client, container) ensure client.destroy(container) end end |
Instance Method Details
#exists?(path) ⇒ true, false
Checks if file exists at path
43 44 45 46 47 48 49 |
# File 'lib/fpm/fry/inspector.rb', line 43 def exists?(path) client.read(container,path) do return true end rescue FPM::Fry::Client::FileNotFound return false end |
#link_target(path) ⇒ String?
Determines the target of a link
34 35 36 |
# File 'lib/fpm/fry/inspector.rb', line 34 def link_target(path) return client.link_target(container, path) end |
#read(path) {|entry| ... } ⇒ Object
Gets whatever is at path. This once if path is a file. And all subfiles if it’s a directory. Usually read_content is better.
24 25 26 |
# File 'lib/fpm/fry/inspector.rb', line 24 def read(path, &block) return client.read(container, path, &block) end |
#read_content(path) ⇒ String
Gets the file content at path.
12 13 14 |
# File 'lib/fpm/fry/inspector.rb', line 12 def read_content(path) return client.read_content(container, path) end |