Class: Cartage::Rack
- Inherits:
-
Object
- Object
- Cartage::Rack
- Defined in:
- lib/cartage/rack.rb,
lib/cartage/rack/simple.rb
Overview
Cartage::Rack is a simple application that reads an application’s static release metadata and returns it as an (optionally filtered) application/json value, or as a text/plain string if called with .text or .txt.
Direct Known Subclasses
Defined Under Namespace
Constant Summary collapse
- VERSION =
:nodoc:
'2.0'
Class Method Summary collapse
-
.mount(root_path = nil) ⇒ Object
Creates a new instance of the Cartage::Rack::Simple application to the specified
root_path, orDir.pwd. -
.require_metadata(value = (arg = false; nil)) ⇒ Object
When
true, Cartage::Rack and Cartage::Rack::Simple will raise an exception if there is no metadata file (release-metadata.jsonorrelease_hashref). -
.Simple(root_path = nil) ⇒ Object
Generate and mount the simple metadata reporter, Cartage::Rack::Simple, for the application at
root_pathorDir.pwd.
Instance Method Summary collapse
-
#call(env) ⇒ Object
:nodoc:.
-
#initialize(root_path = nil, &filter) ⇒ Rack
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
Constructor Details
Class Method Details
.mount(root_path = nil) ⇒ Object
Creates a new instance of the Cartage::Rack::Simple application to the specified root_path, or Dir.pwd. This method has been deprecated.
8 9 10 11 12 13 |
# File 'lib/cartage/rack/simple.rb', line 8 def mount(root_path = nil) warn <<-warning Cartage::Rack.mount(path) is deprecated; use Cartage::Rack::Simple(path) instead. warning Simple(root_path) end |
.require_metadata(value = (arg = false; nil)) ⇒ Object
When true, Cartage::Rack and Cartage::Rack::Simple will raise an exception if there is no metadata file (release-metadata.json or release_hashref). May be explicitly turned off.
Defaults to true except in development or test environments (based on $RAILS_ENV and $RACK_ENV).
27 28 29 30 |
# File 'lib/cartage/rack.rb', line 27 def (value = (arg = false; nil)) # rubocop:disable Style/Semicolon @require_metadata = value unless arg == false @require_metadata || end |
Instance Method Details
#call(env) ⇒ Object
:nodoc:
43 44 45 46 |
# File 'lib/cartage/rack.rb', line 43 def call(env) #:nodoc: type, body = resolve_content(env) [ '200', { 'Content-Type' => type }, [ body ] ] end |
#inspect ⇒ Object
:nodoc:
48 49 50 |
# File 'lib/cartage/rack.rb', line 48 def inspect #:nodoc: "#{self.class} for #{@metadata.inspect}" end |