Class: UffizziCore::ComposeFile::TemplateService

Inherits:
Object
  • Object
show all
Defined in:
app/services/uffizzi_core/compose_file/template_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(cli_form, project, user) ⇒ TemplateService

Returns a new instance of TemplateService.



4
5
6
7
8
9
10
# File 'app/services/uffizzi_core/compose_file/template_service.rb', line 4

def initialize(cli_form, project, user)
  @project = project
  @user = user
  @compose_dependencies = cli_form.compose_dependencies
  @compose_data = cli_form.compose_data
  @compose_repositories = cli_form.compose_repositories
end

Instance Method Details

#create_template(compose_file_form) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/uffizzi_core/compose_file/template_service.rb', line 12

def create_template(compose_file_form)
  compose_file_template_form = build_compose_file_template_form(compose_file_form)
  return compose_file_template_form.errors if compose_file_template_form.invalid?

  template_form = build_template_form(compose_file_form, compose_file_template_form)
  return template_form.errors if template_form.invalid?

  template_form.save

  nil
end