Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
68237290
Commit
68237290
authored
Aug 11, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create maven package in one transaction
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
ffea496b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
ee/app/models/packages/package.rb
ee/app/models/packages/package.rb
+3
-1
ee/app/services/packages/create_maven_package_service.rb
ee/app/services/packages/create_maven_package_service.rb
+9
-12
No files found.
ee/app/models/packages/package.rb
View file @
68237290
...
...
@@ -2,7 +2,9 @@
class
Packages::Package
<
ActiveRecord
::
Base
belongs_to
:project
has_many
:package_files
has_one
:maven_metadatum
has_one
:maven_metadatum
,
inverse_of: :package
accepts_nested_attributes_for
:maven_metadatum
validates
:project
,
presence:
true
validates
:name
,
presence:
true
...
...
ee/app/services/packages/create_maven_package_service.rb
View file @
68237290
...
...
@@ -2,22 +2,19 @@
module
Packages
class
CreateMavenPackageService
<
BaseService
def
execute
package
=
project
.
packages
.
create!
(
name:
params
[
:name
],
version:
params
[
:version
]
)
app_group
,
_
,
app_name
=
params
[
:name
].
rpartition
(
'/'
)
app_group
.
tr!
(
'/'
,
'.'
)
package
.
create_maven_metadatum!
(
project
.
packages
.
create!
(
name:
params
[
:name
],
version:
params
[
:version
],
maven_metadatum_attributes:
{
path:
params
[
:path
],
app_group:
app_group
,
app_name:
app_name
,
app_version:
params
[
:version
]
}
)
package
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment