summaryrefslogtreecommitdiff
path: root/app/models/release.rb
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2018-12-21 15:13:23 +0100
committerShinya Maeda <shinya@gitlab.com>2018-12-31 12:05:56 +0900
commitb9aac409a5dfcdd1410c37ffb6eb30264d0b2784 (patch)
treeb72c9ee86f5c7c20760df006bbca0500b2de48a0 /app/models/release.rb
parent1ea2d9faa518f6b769b05a71a1f93b4ea0226bc1 (diff)
downloadgitlab-ce-b9aac409a5dfcdd1410c37ffb6eb30264d0b2784.tar.gz
Expose assets in releases API
Diffstat (limited to 'app/models/release.rb')
-rw-r--r--app/models/release.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/release.rb b/app/models/release.rb
index a4272dd63aa..06ed77f9079 100644
--- a/app/models/release.rb
+++ b/app/models/release.rb
@@ -17,4 +17,17 @@ class Release < ActiveRecord::Base
git_tag = repository.find_tag(tag)
repository.commit(git_tag.dereferenced_target)
end
+
+ def sources_formats
+ @sources_formats ||= %w(zip tar.gz tar.bz2 tar).freeze
+ end
+
+ # TODO: placeholder for frontend API compatibility
+ def links
+ []
+ end
+
+ def assets_count
+ links.size + sources_formats.size
+ end
end