[devdocsgjs/main: 1404/1867] Add support for retrieving tags from GitLab repos




commit 5780aeef6f9cd15c1e9e33e99456becbf9810e79
Author: Phil Scherer <pnscher evoforge org>
Date:   Tue Dec 22 22:23:40 2020 -0500

    Add support for retrieving tags from GitLab repos
    
    Implement and document a new utility method for getting tags from
    projects hosted on GitLab. This method supports GitLab.com as well as
    projects hosted on independent servers.

 docs/scraper-reference.md | 7 +++++++
 lib/docs/core/doc.rb      | 4 ++++
 2 files changed, 11 insertions(+)
---
diff --git a/docs/scraper-reference.md b/docs/scraper-reference.md
index e4b7272d..fc00876d 100644
--- a/docs/scraper-reference.md
+++ b/docs/scraper-reference.md
@@ -236,3 +236,10 @@ To make life easier, there are a few utility methods that you can use in `get_la
     Returns the date of the most recent commit in the default branch of the given repository.
 
     Example: [lib/docs/scrapers/reactivex.rb](../lib/docs/scrapers/reactivex.rb)
+
+### GitLab methods
+* `get_gitlab_tags(hostname, group, project, opts)`
+
+  Returns the list of tags on the given repository ([format](https://docs.gitlab.com/ee/api/tags.html)).
+
+  Example: [lib/docs/scrapers/gtk.rb](../lib/docs/scrapers/gtk.rb)
diff --git a/lib/docs/core/doc.rb b/lib/docs/core/doc.rb
index 3b67acb1..979e2c41 100644
--- a/lib/docs/core/doc.rb
+++ b/lib/docs/core/doc.rb
@@ -270,5 +270,9 @@ module Docs
       timestamp = commits[0]['commit']['author']['date']
       Date.iso8601(timestamp).to_time.to_i
     end
+
+    def get_gitlab_tags(hostname, group, project, opts)
+      fetch_json("https://#{hostname}/api/v4/projects/#{group}%2F#{project}/repository/tags";, opts)
+    end
   end
 end


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]