Commit 4aca61e8a60cae56a7cceec7d66fd7aa4138c274
1 parent
4c1f435a
Exists in
master
and in
4 other branches
install grape and mount Gitlab::API
Showing
4 changed files
with
37 additions
and
21 deletions
Show diff stats
Gemfile
| ... | ... | @@ -17,6 +17,7 @@ gem "omniauth-ldap", :git => "https://github.com/gitlabhq/omniauth-ldap.git", |
| 17 | 17 | gem 'yaml_db', :git => "https://github.com/gitlabhq/yaml_db.git" |
| 18 | 18 | gem "linguist", "~> 1.0.0", :git => "https://github.com/gitlabhq/linguist.git" |
| 19 | 19 | |
| 20 | +gem "grape" | |
| 20 | 21 | gem "stamp" |
| 21 | 22 | gem "kaminari" |
| 22 | 23 | gem "haml-rails" | ... | ... |
Gemfile.lock
| ... | ... | @@ -162,6 +162,12 @@ GEM |
| 162 | 162 | gherkin (2.11.0) |
| 163 | 163 | json (>= 1.4.6) |
| 164 | 164 | git (1.2.5) |
| 165 | + grape (0.2.0) | |
| 166 | + hashie (~> 1.2) | |
| 167 | + multi_json | |
| 168 | + multi_xml | |
| 169 | + rack | |
| 170 | + rack-mount | |
| 165 | 171 | haml (3.1.6) |
| 166 | 172 | haml-rails (0.3.4) |
| 167 | 173 | actionpack (~> 3.0) |
| ... | ... | @@ -223,6 +229,8 @@ GEM |
| 223 | 229 | rack (1.4.1) |
| 224 | 230 | rack-cache (1.2) |
| 225 | 231 | rack (>= 0.4) |
| 232 | + rack-mount (0.8.3) | |
| 233 | + rack (>= 1.0.0) | |
| 226 | 234 | rack-protection (1.2.0) |
| 227 | 235 | rack |
| 228 | 236 | rack-ssl (1.3.2) |
| ... | ... | @@ -373,6 +381,7 @@ DEPENDENCIES |
| 373 | 381 | foreman |
| 374 | 382 | git |
| 375 | 383 | gitolite! |
| 384 | + grape | |
| 376 | 385 | grit! |
| 377 | 386 | haml-rails |
| 378 | 387 | httparty | ... | ... |
config/routes.rb
| ... | ... | @@ -4,6 +4,10 @@ Gitlab::Application.routes.draw do |
| 4 | 4 | # |
| 5 | 5 | get 'search' => "search#show" |
| 6 | 6 | |
| 7 | + # API | |
| 8 | + require 'api' | |
| 9 | + mount Gitlab::API => '/api' | |
| 10 | + | |
| 7 | 11 | # Optionally, enable Resque here |
| 8 | 12 | require 'resque/server' |
| 9 | 13 | mount Resque::Server.new, at: '/info/resque' |
| ... | ... | @@ -20,15 +24,15 @@ Gitlab::Application.routes.draw do |
| 20 | 24 | # Admin Area |
| 21 | 25 | # |
| 22 | 26 | namespace :admin do |
| 23 | - resources :users do | |
| 24 | - member do | |
| 27 | + resources :users do | |
| 28 | + member do | |
| 25 | 29 | put :team_update |
| 26 | 30 | put :block |
| 27 | 31 | put :unblock |
| 28 | 32 | end |
| 29 | 33 | end |
| 30 | - resources :projects, :constraints => { :id => /[^\/]+/ } do | |
| 31 | - member do | |
| 34 | + resources :projects, :constraints => { :id => /[^\/]+/ } do | |
| 35 | + member do | |
| 32 | 36 | get :team |
| 33 | 37 | put :team_update |
| 34 | 38 | end |
| ... | ... | @@ -79,12 +83,12 @@ Gitlab::Application.routes.draw do |
| 79 | 83 | |
| 80 | 84 | resources :wikis, :only => [:show, :edit, :destroy, :create] do |
| 81 | 85 | member do |
| 82 | - get "history" | |
| 86 | + get "history" | |
| 83 | 87 | end |
| 84 | 88 | end |
| 85 | 89 | |
| 86 | - resource :repository do | |
| 87 | - member do | |
| 90 | + resource :repository do | |
| 91 | + member do | |
| 88 | 92 | get "branches" |
| 89 | 93 | get "tags" |
| 90 | 94 | get "archive" |
| ... | ... | @@ -94,14 +98,14 @@ Gitlab::Application.routes.draw do |
| 94 | 98 | resources :deploy_keys |
| 95 | 99 | resources :protected_branches, :only => [:index, :create, :destroy] |
| 96 | 100 | |
| 97 | - resources :refs, :only => [], :path => "/" do | |
| 98 | - collection do | |
| 101 | + resources :refs, :only => [], :path => "/" do | |
| 102 | + collection do | |
| 99 | 103 | get "switch" |
| 100 | 104 | end |
| 101 | 105 | |
| 102 | - member do | |
| 106 | + member do | |
| 103 | 107 | get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ } |
| 104 | - get "blob", | |
| 108 | + get "blob", | |
| 105 | 109 | :constraints => { |
| 106 | 110 | :id => /[a-zA-Z.0-9\/_\-]+/, |
| 107 | 111 | :path => /.*/ |
| ... | ... | @@ -126,32 +130,32 @@ Gitlab::Application.routes.draw do |
| 126 | 130 | end |
| 127 | 131 | end |
| 128 | 132 | |
| 129 | - resources :merge_requests do | |
| 130 | - member do | |
| 133 | + resources :merge_requests do | |
| 134 | + member do | |
| 131 | 135 | get :diffs |
| 132 | 136 | get :automerge |
| 133 | 137 | get :automerge_check |
| 134 | 138 | end |
| 135 | 139 | |
| 136 | - collection do | |
| 140 | + collection do | |
| 137 | 141 | get :branch_from |
| 138 | 142 | get :branch_to |
| 139 | 143 | end |
| 140 | 144 | end |
| 141 | - | |
| 142 | - resources :snippets do | |
| 143 | - member do | |
| 145 | + | |
| 146 | + resources :snippets do | |
| 147 | + member do | |
| 144 | 148 | get "raw" |
| 145 | 149 | end |
| 146 | 150 | end |
| 147 | 151 | |
| 148 | - resources :hooks, :only => [:index, :create, :destroy] do | |
| 149 | - member do | |
| 152 | + resources :hooks, :only => [:index, :create, :destroy] do | |
| 153 | + member do | |
| 150 | 154 | get :test |
| 151 | 155 | end |
| 152 | 156 | end |
| 153 | - resources :commits do | |
| 154 | - collection do | |
| 157 | + resources :commits do | |
| 158 | + collection do | |
| 155 | 159 | get :compare |
| 156 | 160 | end |
| 157 | 161 | end | ... | ... |