Class: RubyYacht::App

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_yacht/dsl/app.rb

Overview

This class models an app that's part of the local system.

See RubyYacht::App::DSL for information on configuring the app.

Defined Under Namespace

Classes: DSL

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#database_nameObject

The name of the database that this app uses as its data store.



23
24
25
# File 'lib/ruby_yacht/dsl/app.rb', line 23

def database_name
  @database_name
end

#nameObject

The name of the app



7
8
9
# File 'lib/ruby_yacht/dsl/app.rb', line 7

def name
  @name
end

#portObject

The port that the app listens on.



20
21
22
# File 'lib/ruby_yacht/dsl/app.rb', line 20

def port
  @port
end

#repository_nameObject

The name of the repository where the app's code is stored, relative To the project's repository domain.



11
12
13
# File 'lib/ruby_yacht/dsl/app.rb', line 11

def repository_name
  @repository_name
end

#server_typeObject

The type of app this is, which determines what hooks and scripts we run when building it.

For instance, this would be rails for a Rails app.



17
18
19
# File 'lib/ruby_yacht/dsl/app.rb', line 17

def server_type
  @server_type
end

Instance Method Details

#container_nameObject

This method gets the name of the image / container that this app will run in.



32
33
34
35
36
37
38
39
# File 'lib/ruby_yacht/dsl/app.rb', line 32

def container_name
  project = self.project
  if project.system_prefix == self.name
    return "#{project.system_prefix}"
  else
    return "#{project.system_prefix}-#{self.name}"
  end
end

#databaseObject

This method gets the database that the app connects to.

Returns

RubyYacht::Database



45
46
47
# File 'lib/ruby_yacht/dsl/app.rb', line 45

def database
  project.databases.find { |database| database.name == database_name }
end

#projectObject

The project that includes this app.



26
27
28
# File 'lib/ruby_yacht/dsl/app.rb', line 26

def project
  RubyYacht.configuration.projects.find { |project| project.apps.include?(self) }
end