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_name(project) ⇒ Object

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

Parameters

  • project: RubyYacht::Project The project the app is running in.

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

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

#database(project) ⇒ Object

This method gets the database that the app connects to.

Parameters

  • project: RubyYacht::Project The project the app is running in.

Returns

RubyYacht::Database


47
48
49
# File 'lib/ruby_yacht/dsl/app.rb', line 47

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