diff options
| author | ZJ van de Weg <zegerjan@gitlab.com> | 2016-05-25 14:41:25 +0200 |
|---|---|---|
| committer | ZJ van de Weg <zegerjan@gitlab.com> | 2016-05-25 14:41:25 +0200 |
| commit | 7ae536002ac981b3d18aae8851d8d70731db29dc (patch) | |
| tree | 5d0c660df87be8d8d7ac4c50bab9ce1c27cbd876 /lib/api | |
| parent | 20e6e0dbe609f7b0fdd480281223a1a98d645f34 (diff) | |
| parent | 318b22459bfff1cecfb1f38e381faaca3bc29bbb (diff) | |
| download | gitlab-ce-7ae536002ac981b3d18aae8851d8d70731db29dc.tar.gz | |
Merge branch 'master' into awardables
Diffstat (limited to 'lib/api')
| -rw-r--r-- | lib/api/api.rb | 1 | ||||
| -rw-r--r-- | lib/api/entities.rb | 9 | ||||
| -rw-r--r-- | lib/api/gitignores.rb | 29 | ||||
| -rw-r--r-- | lib/api/helpers.rb | 2 | ||||
| -rw-r--r-- | lib/api/runners.rb | 2 |
5 files changed, 41 insertions, 2 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 360fb41a721..6cd909f6115 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -58,5 +58,6 @@ module API mount ::API::Runners mount ::API::Licenses mount ::API::Subscriptions + mount ::API::Gitignores end end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index b99a8b3f09e..43e0ba388d0 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -408,6 +408,7 @@ module API class RunnerDetails < Runner expose :tag_list + expose :run_untagged expose :version, :revision, :platform, :architecture expose :contacted_at expose :token, if: lambda { |runner, options| options[:current_user].is_admin? || !runner.is_shared? } @@ -456,5 +457,13 @@ module API expose(:limitations) { |license| license.meta['limitations'] } expose :content end + + class GitignoresList < Grape::Entity + expose :name + end + + class Gitignore < Grape::Entity + expose :name, :content + end end end diff --git a/lib/api/gitignores.rb b/lib/api/gitignores.rb new file mode 100644 index 00000000000..270c9501dd2 --- /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: + # name (required) - The name of a license + # + # Example Request: + # GET /gitignores/Elixir + # + get 'gitignores/:name' do + required_attributes! [:name] + + gitignore = Gitlab::Gitignore.find(params[:name]) + not_found!('.gitignore') unless gitignore + + present gitignore, with: Entities::Gitignore + end + end +end diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index cadf9f98fe3..2aaa0557ea3 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -29,7 +29,7 @@ module API @current_user end - def sudo_identifier() + def sudo_identifier identifier ||= params[SUDO_PARAM] || env[SUDO_HEADER] # Regex for integers diff --git a/lib/api/runners.rb b/lib/api/runners.rb index 8ec91485b26..4faba9dc87b 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -49,7 +49,7 @@ module API runner = get_runner(params[:id]) authenticate_update_runner!(runner) - attrs = attributes_for_keys [:description, :active, :tag_list] + attrs = attributes_for_keys [:description, :active, :tag_list, :run_untagged] if runner.update(attrs) present runner, with: Entities::RunnerDetails, current_user: current_user else |
