Commit 4aca61e8a60cae56a7cceec7d66fd7aa4138c274

Authored by Nihad Abbasov
1 parent 4c1f435a

install grape and mount Gitlab::API

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