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.
-
#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'srepository
togithub.com
. -
#system_prefix ⇒ Object
:method: system_prefix You can call
system_prefix 'my-apps'
to set the projects system_prefixto
my-apps`. -
#web_server ⇒ Object
:method: web_server.
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, #check_server_type, #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
64 65 66 67 68 |
# File 'lib/ruby_yacht/dsl/project.rb', line 64 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
.
158 159 160 |
# File 'lib/ruby_yacht/dsl/project.rb', line 158 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
103 |
# File 'lib/ruby_yacht/dsl/project.rb', line 103 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.
95 |
# File 'lib/ruby_yacht/dsl/project.rb', line 95 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
111 |
# File 'lib/ruby_yacht/dsl/project.rb', line 111 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.
129 |
# File 'lib/ruby_yacht/dsl/project.rb', line 129 add_object :dns_server, RubyYacht::DnsServer::DSL, required: false |
#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
.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/ruby_yacht/dsl/project.rb', line 138 def load_app_initializers RubyYacht.configuration.server_types.each do |server_type| main_method = server_type.container_type.to_s main_method += "_server" if server_type.container_type == :web method_name = "#{server_type.name}_#{main_method}" define_singleton_method method_name do |*args, &block| self.public_send( main_method, server_type.name, *args, &block ) end end end |
#repository ⇒ Object
:method: repository
You can call repository 'github.com'
to set the project's repository
to github.com
82 |
# File 'lib/ruby_yacht/dsl/project.rb', line 82 add_attribute :repository |
#system_prefix ⇒ Object
:method: system_prefix
You can call system_prefix 'my-apps'
to set the projects
system_prefixto
my-apps`
76 |
# File 'lib/ruby_yacht/dsl/project.rb', line 76 add_attribute :system_prefix |
#web_server ⇒ Object
:method: web_server
You can call web_server
to configure a web server for the project.
This takes a block for configuring the server, which allows you to
call methods in RubyYacht::WebServer::DSL
119 |
# File 'lib/ruby_yacht/dsl/project.rb', line 119 add_object_list :web_server, RubyYacht::WebServer::DSL |