Class: Devup::ServiceDotenv

Inherits:
Object
  • Object
show all
Defined in:
lib/devup/service_dotenv.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, project: nil) ⇒ ServiceDotenv

Returns a new instance of ServiceDotenv.



5
6
7
8
# File 'lib/devup/service_dotenv.rb', line 5

def initialize(service, project: nil)
  @service = service
  @project = project
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



3
4
5
# File 'lib/devup/service_dotenv.rb', line 3

def project
  @project
end

#serviceObject (readonly)

Returns the value of attribute service.



3
4
5
# File 'lib/devup/service_dotenv.rb', line 3

def service
  @service
end

Instance Method Details

#textObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/devup/service_dotenv.rb', line 10

def text
  res = []

  res << "# #{service.name}"

  if has_ports?
    res << host_env
    res << ports_env
  else
    res << "# no exposed ports"
  end

  res.join "\n"
end