Skip to content
Snippets Groups Projects
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 374cdda3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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'
 
Loading
Loading
@@ -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'
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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)
Loading
Loading
@@ -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)
Loading
Loading
@@ -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
Loading
Loading
---
title: Upgrade grape to 1.0
merge_request:
author:
type: other
Loading
Loading
@@ -290,7 +290,7 @@ module API
 
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
 
Loading
Loading
Loading
Loading
@@ -16,9 +16,9 @@ module API
case scope
when String
[scope]
when Hashie::Mash
when ::Hash
scope.values
when Hashie::Array
when ::Array
scope
else
['unknown']
Loading
Loading
Loading
Loading
@@ -57,7 +57,7 @@ module API
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
Loading
Loading
@@ -71,7 +71,7 @@ module API
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
 
Loading
Loading
@@ -102,7 +102,7 @@ module API
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
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ module 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']
Loading
Loading
Loading
Loading
@@ -59,7 +59,7 @@ module API
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
Loading
Loading
@@ -76,7 +76,7 @@ module API
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
 
Loading
Loading
@@ -111,7 +111,7 @@ module API
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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment