Module: RubyYacht

Defined in:
lib/ruby_yacht.rb,
lib/ruby_yacht/dsl/app.rb,
lib/ruby_yacht/dsl/dsl.rb,
lib/ruby_yacht/plugins.rb,
lib/ruby_yacht/dsl/hook.rb,
lib/ruby_yacht/dsl/project.rb,
lib/ruby_yacht/dsl/database.rb,
lib/ruby_yacht/dsl/dns_server.rb,
lib/ruby_yacht/dsl/web_server.rb,
lib/ruby_yacht/dsl/server_type.rb,
lib/ruby_yacht/dsl/configuration.rb

Overview

This module groups together all the libraries for this gem.

Defined Under Namespace

Modules: DSL, Plugins, Runner Classes: App, Configuration, Database, DnsServer, Hook, Project, ServerType, WebServer

Class Method Summary collapse

Class Method Details

.configurationObject

This method gets the current configuration for the system.



259
260
261
# File 'lib/ruby_yacht/dsl/configuration.rb', line 259

def self.configuration
  @configuration ||= Configuration.new
end

.configure(&block) ⇒ Object

This method adds configuration for the system.

If you pass a block to this method, it will be evaluated using the methods in RubyYacht::Configuration::DSL.

Any projects you define in that block will be added to the current list of projects.



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/ruby_yacht/dsl/configuration.rb', line 242

def self.configure(&block)
  new_configuration = Configuration::DSL.new.run(block).create_object
  %w(projects hooks).each do |field|
    self.configuration.send("#{field}=", self.configuration.send(field) + new_configuration.send(field))
  end

  self.configuration.local_config = self.configuration.local_config.merge(new_configuration.local_config)

  new_configuration.server_types.each do |type|
    if self.configuration.server_types.any? { |existing| existing.name == type.name }
      raise "Server type already registered: #{type.name}"
    end
    self.configuration.server_types << type
  end
end