Class: RubyYacht::Project::DSL
- Inherits:
-
Object
- Object
- RubyYacht::Project::DSL
- Extended by:
- DSL::Base::ClassMethods
- Includes:
- DSL::Base
- Defined in:
- lib/ruby_yacht/dsl/project.rb
Overview
This class provides a DSL for configuring a project.
You can access this inside RubyYacht::Configuration::DSL by calling project. It will create a RubyYacht::Project.
Class Method Summary collapse
-
.custom_attribute_method ⇒ Object
This method gets the attribute that server types can use to specify custom attributes for this DSL type.
Instance Method Summary collapse
-
#app ⇒ Object
:method: app.
-
#check_out_locally ⇒ Object
:method: check_out_locally.
-
#database ⇒ Object
:method: database.
-
#dns_server ⇒ Object
:method: dns_server.
-
#domain ⇒ Object
:method: domain You can call ‘domain ’test.com’‘ to set the project’s
domainto test.com. -
#initialize(name) ⇒ DSL
constructor
This initializer creates a new project.
-
#load_app_initializers ⇒ Object
This method loads the special DSL methods for defining apps of a certain type.
-
#repository ⇒ Object
:method: repository You can call ‘repository ’github.com’‘ to set the project’s
repositorytogithub.com. -
#system_prefix ⇒ Object
:method: system_prefix You can call ‘system_prefix ’my-apps’‘ to set the projects system_prefix` to
my-apps.
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_required_attributes, #create_object, #load_custom_attributes, #run
Constructor Details
#initialize(name) ⇒ DSL
This initializer creates a new project.
### Parameters
-
*name: String* The name of the project
62 63 64 65 66 |
# File 'lib/ruby_yacht/dsl/project.rb', line 62 def initialize(name) @name = name.to_sym load_custom_attributes load_app_initializers end |
Class Method Details
.custom_attribute_method ⇒ Object
This method gets the attribute that server types can use to specify custom attributes for this DSL type.
This DSL uses project_attributes.
152 153 154 |
# File 'lib/ruby_yacht/dsl/project.rb', line 152 def self.custom_attribute_method :project_attributes end |
Instance Method Details
#app ⇒ Object
:method: app
You can call ‘app ’mars’‘ to add an app called mars. This takes a block for configuring the app, which allows you to call methods in RubyYacht::App::DSL
107 |
# File 'lib/ruby_yacht/dsl/project.rb', line 107 add_object_list :app, RubyYacht::App::DSL |
#check_out_locally ⇒ Object
:method: check_out_locally
You can call check_out_locally to set the project’s check_out_locally flag to true. The default is false.
99 |
# File 'lib/ruby_yacht/dsl/project.rb', line 99 add_boolean :check_out_locally |
#database ⇒ Object
:method: database
You can call database to configure a database for the project. This takes a block for configuring the database, which allows you to call methods in RubyYacht::Database::DSL
115 |
# File 'lib/ruby_yacht/dsl/project.rb', line 115 add_object_list :database, RubyYacht::Database::DSL |
#dns_server ⇒ Object
:method: dns_server
You can call dns_server to configure the DNS for the project. This takes a block for configuring the DNS , which allows you to call methods in RubyYacht::DnsServer::DSL
This is optional.
125 |
# File 'lib/ruby_yacht/dsl/project.rb', line 125 add_object :dns_server, RubyYacht::DnsServer::DSL, required: false |
#domain ⇒ Object
:method: domain You can call ‘domain ’test.com’‘ to set the project’s domain to test.com
80 |
# File 'lib/ruby_yacht/dsl/project.rb', line 80 add_attribute :domain |
#load_app_initializers ⇒ Object
This method loads the special DSL methods for defining apps of a certain type.
For the app type with the name foo, this will create a foo_app method on the DSL that builds an app with the type foo.
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/ruby_yacht/dsl/project.rb', line 134 def load_app_initializers RubyYacht.configuration.server_types.each do |server_type| method_name = "#{server_type.name}_#{server_type.container_type}" define_singleton_method method_name do |name, &block| self.public_send( server_type.container_type, name, server_type.name, &block ) end end end |
#repository ⇒ Object
:method: repository You can call ‘repository ’github.com’‘ to set the project’s repository to github.com
86 |
# File 'lib/ruby_yacht/dsl/project.rb', line 86 add_attribute :repository |
#system_prefix ⇒ Object
:method: system_prefix You can call ‘system_prefix ’my-apps’‘ to set the projects system_prefix` to my-apps
74 |
# File 'lib/ruby_yacht/dsl/project.rb', line 74 add_attribute :system_prefix |