Class: RubyYacht::WebServer::DSL
- Inherits:
-
Object
- Object
- RubyYacht::WebServer::DSL
- Extended by:
- DSL::Base::ClassMethods
- Includes:
- DSL::Base
- Defined in:
- lib/ruby_yacht/dsl/web_server.rb
Overview
This class provide's the DSL for configuring a web server.
Inside of the project configuration, you can call web_server [name]
to
add a web server, and then pass it a block to configure the server, which
will allow you to call these DSL methods.
You can also call web_server
with no argument, which will give it the
name web
.
Instance Method Summary collapse
-
#check_required_attributes ⇒ Object
This method checks that all of the required attributes have been set on the object.
-
#domain ⇒ Object
:method: domain You can call
domain 'test.com'
to tell the web server to create subdomains under test.com. -
#initialize(server_type, name = :web) ⇒ DSL
constructor
This initializer starts the DSL for the server.
-
#port ⇒ Object
:method: port You can call
port 8080
to set the server'sport
. -
#server_type ⇒ Object
:method: server_type You can call
server_type :foo
to set the app'sserver_type
.
Methods included from DSL::Base::ClassMethods
add_attribute, add_boolean, add_generic_attribute, add_list, add_object, add_object_list, all_attributes, copied_attributes, created_type, creates_object, custom_attribute_method, default_values, required_attributes
Methods included from DSL::Base
#check_server_type, #copy_local_config, #create_object, #load_custom_attributes, #run
Constructor Details
#initialize(server_type, name = :web) ⇒ DSL
This initializer starts the DSL for the server.
Parameters
- server_type: Symbol The type of server this is.
- name: String The name of the server.
48 49 50 51 52 |
# File 'lib/ruby_yacht/dsl/web_server.rb', line 48 def initialize(server_type, name=:web) @server_type = server_type @name = name.to_sym load_custom_attributes end |
Instance Method Details
#check_required_attributes ⇒ Object
This method checks that all of the required attributes have been set on the object.
If they haven't, this will raise an exception.
It also checks that the server type has been defined in the configuration.
81 82 83 84 |
# File 'lib/ruby_yacht/dsl/web_server.rb', line 81 def check_required_attributes super check_server_type @server_type, :web end |
#domain ⇒ Object
:method: domain
You can call domain 'test.com'
to tell the web server to create
subdomains under test.com.
60 |
# File 'lib/ruby_yacht/dsl/web_server.rb', line 60 add_attribute :domain |
#port ⇒ Object
:method: port
You can call port 8080
to set the server's port
. It defaults to 80.
70 |
# File 'lib/ruby_yacht/dsl/web_server.rb', line 70 add_attribute :port, 80 |
#server_type ⇒ Object
:method: server_type
You can call server_type :foo
to set the app's server_type
.
65 |
# File 'lib/ruby_yacht/dsl/web_server.rb', line 65 add_attribute :server_type |