diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-04-29 16:25:03 +0200 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-05-20 15:58:36 -0500 |
commit | e166a8022a3f239938a1449a0a8ce3485f309766 (patch) | |
tree | af9f612f599b01f5736e7b439f9579d77658f156 /lib/api/gitignores.rb | |
parent | 56eb42007ae8c3c390b35bf336884b3bad3591c5 (diff) | |
download | gitlab-ce-e166a8022a3f239938a1449a0a8ce3485f309766.tar.gz |
Backend for a gitignores dropdown
Diffstat (limited to 'lib/api/gitignores.rb')
-rw-r--r-- | lib/api/gitignores.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/api/gitignores.rb b/lib/api/gitignores.rb new file mode 100644 index 00000000000..1af9ba6b316 --- /dev/null +++ b/lib/api/gitignores.rb @@ -0,0 +1,29 @@ +module API + class Gitignores < Grape::API + + # Get the list of the available gitignore templates + # + # Example Request: + # GET /gitignores + get 'gitignores' do + present Gitlab::Gitignore.all, with: Entities::GitignoresList + end + + # Get the text for a specific gitignore + # + # Parameters: + # key (required) - The key of a license + # + # Example Request: + # GET /gitignores/elixir + # + get 'gitignores/:key' do + required_attributes! [:key] + + gitignore = Gitlab::Gitignore.find(params[:key]) + not_found!('.gitignore') unless gitignore + + present gitignore, with: Entities::Gitignore + end + end +end |