Class: Packages::Conan::CreatePackageFileService
- Inherits:
-
Object
- Object
- Packages::Conan::CreatePackageFileService
- Defined in:
- app/services/packages/conan/create_package_file_service.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(package, file, params) ⇒ CreatePackageFileService
constructor
A new instance of CreatePackageFileService.
Constructor Details
#initialize(package, file, params) ⇒ CreatePackageFileService
Returns a new instance of CreatePackageFileService.
8 9 10 11 12 |
# File 'app/services/packages/conan/create_package_file_service.rb', line 8 def initialize(package, file, params) @package = package @file = file @params = params end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'app/services/packages/conan/create_package_file_service.rb', line 6 def file @file end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
6 7 8 |
# File 'app/services/packages/conan/create_package_file_service.rb', line 6 def package @package end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'app/services/packages/conan/create_package_file_service.rb', line 6 def params @params end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/packages/conan/create_package_file_service.rb', line 14 def execute package_file = package.package_files.build( file: file, size: params['file.size'], file_name: params[:file_name], file_sha1: params['file.sha1'], file_md5: params['file.md5'], conan_file_metadatum_attributes: { recipe_revision: params[:recipe_revision], package_revision: params[:package_revision], conan_package_reference: params[:conan_package_reference], conan_file_type: params[:conan_file_type] } ) if params[:build].present? package_file.package_file_build_infos << package_file.package_file_build_infos.build(pipeline: params[:build].pipeline) end package_file.save! package_file end |