From 3b548d925176791958a12324ab27ad457b110068 Mon Sep 17 00:00:00 2001 From: Kazuhiko Date: Tue, 26 Feb 2013 21:31:45 +0100 Subject: [PATCH 1/2] update grape to 0.3.1 for ruby 2.0 support. add grape-entity, that is split from grape 0.3.0. remove usage of deprecated error_format, that is removed in grape 0.2.3. --- Gemfile | 3 ++- Gemfile.lock | 7 +++++-- lib/api.rb | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 0eba7eb2..6652d1e3 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,8 @@ gem "pygments.rb", git: "https://github.com/gitlabhq/pygments.rb.git", branch: gem "github-linguist", "~> 2.3.4" , require: "linguist" # API -gem "grape", "~> 0.2.1" +gem "grape", "~> 0.3.1" +gem "grape-entity", "~> 0.2.0" # Format dates and times # based on human-friendly examples diff --git a/Gemfile.lock b/Gemfile.lock index 3ca39aea..93abf857 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -182,8 +182,9 @@ GEM pyu-ruby-sasl (~> 0.0.3.1) rubyntlm (~> 0.1.1) gitlab_yaml_db (1.0.0) - grape (0.2.2) + grape (0.3.1) activesupport + grape-entity (~> 0.2.0) hashie (~> 1.2) multi_json (>= 1.3.2) multi_xml @@ -191,6 +192,7 @@ GEM rack-accept rack-mount virtus + grape-entity (0.2.0) growl (1.0.3) guard (1.5.4) listen (>= 0.4.2) @@ -481,7 +483,8 @@ DEPENDENCIES gitlab_omniauth-ldap (= 1.0.2) gitlab_yaml_db (= 1.0.0) grack! - grape (~> 0.2.1) + grape (~> 0.3.1) + grape-entity (~> 0.2.0) grit! grit_ext! growl diff --git a/lib/api.rb b/lib/api.rb index d9dce7c7..da31a151 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -9,7 +9,6 @@ module Gitlab end format :json - error_format :json helpers APIHelpers mount Groups From 8d847b89d25951b57d843676bf9207f22c12597e Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Wed, 27 Feb 2013 06:00:33 -0800 Subject: [PATCH 2/2] API: fix commits pagination closes #2300 --- lib/api/projects.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 631ed535..10404b0d 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -292,7 +292,7 @@ module Gitlab authorize! :download_code, user_project page = params[:page] || 0 - per_page = params[:per_page] || 20 + per_page = params[:per_page].to_i || 20 ref = params[:ref_name] || user_project.try(:default_branch) || 'master' commits = user_project.repository.commits(ref, nil, per_page, page * per_page)