class RubyYacht::WebServer::DSL

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`.

Public Class Methods

new(server_type, name=:web) click to toggle source

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.

# 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

Public Instance Methods

check_required_attributes() click to toggle source

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.

# File lib/ruby_yacht/dsl/web_server.rb, line 81
def check_required_attributes
  super
  check_server_type @server_type, :web
end
domain() click to toggle source

You can call ‘domain ’test.com’‘ to tell the web server to create subdomains under test.com.

# File lib/ruby_yacht/dsl/web_server.rb, line 60
add_attribute :domain
port() click to toggle source

You can call ‘port 8080` to set the server’s ‘port`. It defaults to 80.

# File lib/ruby_yacht/dsl/web_server.rb, line 70
add_attribute :port, 80
server_type() click to toggle source

You can call ‘server_type :foo` to set the app’s ‘server_type`.

# File lib/ruby_yacht/dsl/web_server.rb, line 65
add_attribute :server_type