Class: RubyYacht::App::DSL

Inherits:
Object
  • Object
show all
Extended by:
DSL::Base::ClassMethods
Includes:
DSL::Base
Defined in:
lib/ruby_yacht/dsl/app.rb

Overview

This class provide's the DSL for configuring an app.

Inside of the project configuration, you can call app [name] to add an app, and then pass it a block to configure the app, which will allow you to call these DSL methods.

Instance Method Summary collapse

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) ⇒ DSL

This initializer starts the DSL for the app.

Parameters

  • server_type: Symbol The type of server this is.
  • name: String The name of the app.


64
65
66
67
68
# File 'lib/ruby_yacht/dsl/app.rb', line 64

def initialize(server_type, name)
  @server_type = server_type
  @name = name.to_sym
  load_custom_attributes
end

Instance Method Details

#check_required_attributesObject

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.



102
103
104
105
# File 'lib/ruby_yacht/dsl/app.rb', line 102

def check_required_attributes
  super
  check_server_type @server_type, :app
end

#database_nameObject

:method: database_name You can call database 'foo' to tell the app to use the database server named foo.



81
# File 'lib/ruby_yacht/dsl/app.rb', line 81

add_attribute :database_name, nil, false

#portObject

:method: port You can call port 3000 to set the app's port. It defaults to 8080.



91
# File 'lib/ruby_yacht/dsl/app.rb', line 91

add_attribute :port, 8080

#repository_nameObject

:method: repository_name You can call repository_name 'foo/bar' to set the app's repository_name.



75
# File 'lib/ruby_yacht/dsl/app.rb', line 75

add_attribute :repository_name, nil, false

#server_typeObject

:method: server_type You can call server_type :foo to set the app's server_type.



86
# File 'lib/ruby_yacht/dsl/app.rb', line 86

add_attribute :server_type