Unverified Commit dc8e1676 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg
Browse files

Upgrade grape to 1.0

Main feature was the deprication of the Hashie stuff, so the access by
calling keys as method is gone now.
parent 248b68324211
......@@ -16,7 +16,7 @@ gem 'mysql2', '~> 0.4.5', group: :mysql
gem 'pg', '~> 0.18.2', group: :postgres
gem 'rugged', '~> 0.26.0'
gem 'grape-route-helpers', '~> 2.0.0'
gem 'grape-route-helpers', '~> 2.1.0'
gem 'faraday', '~> 0.12'
......@@ -76,7 +76,7 @@ gem 'gollum-rugged_adapter', '~> 0.4.4', require: false
gem 'github-linguist', '~> 4.7.0', require: 'linguist'
# API
gem 'grape', '~> 0.19.2'
gem 'grape', '~> 1.0'
gem 'grape-entity', '~> 0.6.0'
gem 'rack-cors', '~> 0.4.0', require: 'rack/cors'
......
......@@ -342,12 +342,9 @@ GEM
signet (~> 0.7)
gpgme (2.0.13)
mini_portile2 (~> 2.1)
grape (0.19.2)
grape (1.0.0)
activesupport
builder
hashie (>= 2.1.0)
multi_json (>= 1.3.2)
multi_xml (>= 0.5.2)
mustermann-grape (~> 1.0.0)
rack (>= 1.3.0)
rack-accept
......@@ -355,9 +352,9 @@ GEM
grape-entity (0.6.0)
activesupport
multi_json (>= 1.3.2)
grape-route-helpers (2.0.0)
grape-route-helpers (2.1.0)
activesupport
grape (~> 0.16, >= 0.16.0)
grape (>= 0.16.0)
rake
grpc (1.4.0)
google-protobuf (~> 3.1)
......@@ -375,7 +372,7 @@ GEM
thor
tilt
hashdiff (0.3.4)
hashie (3.5.5)
hashie (3.5.6)
hashie-forbidden_attributes (0.1.1)
hashie (>= 3.0)
health_check (2.6.0)
......@@ -1035,9 +1032,9 @@ DEPENDENCIES
gon (~> 6.1.0)
google-api-client (~> 0.8.6)
gpgme
grape (~> 0.19.2)
grape (~> 1.0)
grape-entity (~> 0.6.0)
grape-route-helpers (~> 2.0.0)
grape-route-helpers (~> 2.1.0)
haml_lint (~> 0.26.0)
hamlit (~> 2.6.1)
hashie-forbidden_attributes
......
---
title: Upgrade grape to 1.0
merge_request:
author:
type: other
......@@ -290,7 +290,7 @@ def project_finder_params
def uploaded_file(field, uploads_path)
if params[field]
bad_request!("#{field} is not a file") unless params[field].respond_to?(:filename)
bad_request!("#{field} is not a file") unless params[field][:filename]
return params[field]
end
......
......@@ -16,9 +16,9 @@ class Jobs < Grape::API
case scope
when String
[scope]
when Hashie::Mash
when ::Hash
scope.values
when Hashie::Array
when ::Array
scope
else
['unknown']
......
......@@ -57,7 +57,7 @@ def render_response(template_type, template)
end
get "templates/licenses" do
options = {
featured: declared(params).popular.present? ? true : nil
featured: declared(params)[:popular].present? ? true : nil
}
licences = ::Kaminari.paginate_array(Licensee::License.all(options))
present paginate(licences), with: Entities::RepoLicense
......@@ -71,7 +71,7 @@ def render_response(template_type, template)
requires :name, type: String, desc: 'The name of the template'
end
get "templates/licenses/:name", requirements: { name: /[\w\.-]+/ } do
not_found!('License') unless Licensee::License.find(declared(params).name)
not_found!('License') unless Licensee::License.find(declared(params)[:name])
template = parsed_license_template
......@@ -102,7 +102,7 @@ def render_response(template_type, template)
requires :name, type: String, desc: 'The name of the template'
end
get "templates/#{template_type}/:name" do
new_template = klass.find(declared(params).name)
new_template = klass.find(declared(params)[:name])
render_response(template_type, new_template)
end
......
......@@ -16,7 +16,7 @@ class Builds < Grape::API
coerce_with: ->(scope) {
if scope.is_a?(String)
[scope]
elsif scope.is_a?(Hashie::Mash)
elsif scope.is_a?(::Hash)
scope.values
else
['unknown']
......
......@@ -59,7 +59,7 @@ def render_response(template_type, template)
end
get route do
options = {
featured: declared(params).popular.present? ? true : nil
featured: declared(params)[:popular].present? ? true : nil
}
present Licensee::License.all(options), with: ::API::Entities::RepoLicense
end
......@@ -76,7 +76,7 @@ def render_response(template_type, template)
requires :name, type: String, desc: 'The name of the template'
end
get route, requirements: { name: /[\w\.-]+/ } do
not_found!('License') unless Licensee::License.find(declared(params).name)
not_found!('License') unless Licensee::License.find(declared(params)[:name])
template = parsed_license_template
......@@ -111,7 +111,7 @@ def render_response(template_type, template)
requires :name, type: String, desc: 'The name of the template'
end
get route do
new_template = klass.find(declared(params).name)
new_template = klass.find(declared(params)[:name])
render_response(template_type, new_template)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment