Class: DotCloud::DSL
Instance Method Summary collapse
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #namespace(name, &block) ⇒ Object (also: #application)
- #run ⇒ Object
- #service(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
19 20 21 22 |
# File 'lib/dotcloud/dsl.rb', line 19 def initialize @current_namespace = nil @namespaces = {} end |
Instance Method Details
#namespace(name, &block) ⇒ Object Also known as: application
24 25 26 27 28 29 |
# File 'lib/dotcloud/dsl.rb', line 24 def namespace(name, &block) @current_namespace = Namespace.new @namespaces[name.to_s] = @current_namespace yield @current_namespace = nil end |
#run ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dotcloud/dsl.rb', line 37 def run namespace_str = Host.instance.namespace namespace = @namespaces[namespace_str] unless namespace puts "No namespace '#{namespace_str}' found" return end service_str = Host.instance.service service = namespace[service_str] unless service puts "No service '#{service_str}' found in namespace '#{namespace_str}'" return end service.call end |