routes.rb 6.5 KB
Newer Older
D
sidekiq  
Dmitriy Zaporozhets 已提交
1 2
require 'sidekiq/web'

G
gitlabhq 已提交
3
Gitlab::Application.routes.draw do
4 5 6
  #
  # Search
  #
7
  get 'search' => "search#show"
V
Valery Sizov 已提交
8

9 10 11 12
  # API
  require 'api'
  mount Gitlab::API => '/api'

D
sidekiq  
Dmitriy Zaporozhets 已提交
13 14
  constraint = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin? }
  constraints constraint do
15
    mount Sidekiq::Web, at: "/admin/sidekiq", as: :sidekiq
D
sidekiq  
Dmitriy Zaporozhets 已提交
16
  end
A
Ariejan de Vroom 已提交
17

18 19
  # Enable Grack support
  mount Grack::Bundle.new({
20 21 22 23
    git_path:     Gitlab.config.git.bin_path,
    project_root: Gitlab.config.gitolite.repos_path,
    upload_pack:  Gitlab.config.gitolite.upload_pack,
    receive_pack: Gitlab.config.gitolite.receive_pack
24
  }), at: '/', constraints: lambda { |request| /[-\/\w\.-]+\.git\//.match(request.path_info) }
25

26 27 28
  #
  # Help
  #
R
Riyad Preukschas 已提交
29 30 31 32
  get 'help'                => 'help#index'
  get 'help/api'            => 'help#api'
  get 'help/markdown'       => 'help#markdown'
  get 'help/permissions'    => 'help#permissions'
33
  get 'help/public_access'  => 'help#public_access'
R
Riyad Preukschas 已提交
34 35 36 37 38
  get 'help/raketasks'      => 'help#raketasks'
  get 'help/ssh'            => 'help#ssh'
  get 'help/system_hooks'   => 'help#system_hooks'
  get 'help/web_hooks'      => 'help#web_hooks'
  get 'help/workflow'       => 'help#workflow'
39

40 41 42 43 44 45 46 47
  #
  # Public namespace
  #
  namespace :public do
    resources :projects, only: [:index]
    root to: "projects#index"
  end

48 49 50
  #
  # Admin Area
  #
N
Nihad Abbasov 已提交
51
  namespace :admin do
52 53
    resources :users do
      member do
D
Dmitriy Zaporozhets 已提交
54
        put :team_update
55 56
        put :block
        put :unblock
D
Dmitriy Zaporozhets 已提交
57 58
      end
    end
59 60 61
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
        put :project_update
A
Andrey Kumanyaev 已提交
62
        put :project_teams_update
63
        delete :remove_project
64 65
      end
    end
66
    resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do
67
      member do
68 69 70 71
        get :team
        put :team_update
      end
    end
A
Andrey Kumanyaev 已提交
72
    resources :teams do #, constraints: { id: /[^\/]+/ } do end
73 74
      scope module: :teams do
        resources :members, only: [:edit, :update, :destroy, :new, :create]
75
        resources :projects, only: [:edit, :update, :destroy, :new, :create]
76
      end
A
Andrey Kumanyaev 已提交
77
    end
R
Robert Speicher 已提交
78 79
    resources :team_members, only: [:edit, :update, :destroy]
    resources :hooks, only: [:index, :create, :destroy] do
V
Valeriy Sizov 已提交
80 81
      get :test
    end
82
    resource :logs, only: [:show]
R
Robert Speicher 已提交
83 84
    resource :resque, controller: 'resque', only: [:show]
    root to: "dashboard#index"
G
gitlabhq 已提交
85 86
  end

87
  get "errors/githost"
R
randx 已提交
88 89 90 91

  #
  # Profile Area
  #
92 93 94 95 96 97 98 99 100 101 102 103
  resource :profile, only: [:show, :update] do
    member do
      get :account
      get :history
      get :token
      get :design

      put :update_password
      put :reset_private_token
      put :update_username
    end
  end
R
Robert Speicher 已提交
104

105
  resources :keys
106
  match "/u/:username" => "users#show", as: :user, constraints: { username: /.*/ }
D
Dmitriy Zaporozhets 已提交
107 108


D
Dmitriy Zaporozhets 已提交
109

R
randx 已提交
110 111 112
  #
  # Dashboard Area
  #
R
Robert Speicher 已提交
113 114 115
  get "dashboard"                => "dashboard#index"
  get "dashboard/issues"         => "dashboard#issues"
  get "dashboard/merge_requests" => "dashboard#merge_requests"
G
gitlabhq 已提交
116

R
randx 已提交
117 118 119 120

  #
  # Groups Area
  #
D
Dmitriy Zaporozhets 已提交
121
  resources :groups, constraints: { id: /[^\/]+/ }, only: [:show, :new, :create] do
R
randx 已提交
122 123 124 125 126
    member do
      get :issues
      get :merge_requests
      get :search
      get :people
A
Andrey Kumanyaev 已提交
127
      post :team_members
R
randx 已提交
128 129 130
    end
  end

131 132 133 134 135 136 137 138 139
  resources :teams do
    member do
      get :issues
      get :merge_requests
      get :search
      post :delegate_projects
      delete :relegate_project
      put :update_access
    end
A
Andrey Kumanyaev 已提交
140 141
    scope module: :teams do
      resources :members
A
Andrey Kumanyaev 已提交
142
      resources :projects, only: [:index, :show] do
A
Andrey Kumanyaev 已提交
143 144
      end
    end
145 146 147 148 149
    collection do
      get :search
    end
  end

R
Robert Speicher 已提交
150
  resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
151

M
Marin Jankovski 已提交
152
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations }
G
gitlabhq 已提交
153

154 155 156
  #
  # Project Area
  #
157
  resources :projects, constraints: { id: /[a-zA-Z.0-9_\-\/]+/ }, except: [:new, :create, :index], path: "/" do
N
Nihad Abbasov 已提交
158
    member do
G
gitlabhq 已提交
159
      get "wall"
V
Valery Sizov 已提交
160
      get "graph"
161
      get "files"
G
gitlabhq 已提交
162
    end
G
gitlabhq 已提交
163

D
Dmitriy Zaporozhets 已提交
164 165 166 167 168 169 170 171 172
    resources :tree,    only: [:show, :edit, :update], constraints: {id: /.+/}
    resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
    resources :commits, only: [:show], constraints: {id: /.+/}
    resources :compare, only: [:index, :create]
    resources :blame,   only: [:show], constraints: {id: /.+/}
    resources :blob,    only: [:show], constraints: {id: /.+/}
    match "/compare/:from...:to" => "compare#show", as: "compare",
                    :via => [:get, :post], constraints: {from: /.+/, to: /.+/}

R
Robert Speicher 已提交
173
    resources :wikis, only: [:show, :edit, :destroy, :create] do
D
Dmitriy Zaporozhets 已提交
174 175 176 177
      collection do
        get :pages
      end

V
Valery Sizov 已提交
178
      member do
179
        get "history"
V
Valery Sizov 已提交
180 181
      end
    end
V
Valery Sizov 已提交
182

183 184
    resource :repository do
      member do
D
Dmitriy Zaporozhets 已提交
185 186
        get "branches"
        get "tags"
R
randx 已提交
187
        get "stats"
188
        get "archive"
D
Dmitriy Zaporozhets 已提交
189 190
      end
    end
191

D
Dmitriy Zaporozhets 已提交
192 193 194 195 196 197
    resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
      member do
        get :test
      end
    end

M
miks 已提交
198
    resources :deploy_keys
R
Robert Speicher 已提交
199
    resources :protected_branches, only: [:index, :create, :destroy]
M
miks 已提交
200

201
    resources :refs, only: [] do
202
      collection do
G
gitlabhq 已提交
203 204 205
        get "switch"
      end

206
      member do
207 208
        # tree viewer logs
        get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
R
randx 已提交
209
        get "logs_tree/:path" => "refs#logs_tree",
R
Robert Speicher 已提交
210 211 212 213
          as: :logs_file,
          constraints: {
            id:   /[a-zA-Z.0-9\/_\-]+/,
            path: /.*/
R
randx 已提交
214
          }
G
gitlabhq 已提交
215
      end
G
gitlabhq 已提交
216
    end
G
gitlabhq 已提交
217

D
Dmitriy Zaporozhets 已提交
218
    resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do
219
      member do
220
        get :diffs
R
randx 已提交
221
        get :automerge
V
Valery Sizov 已提交
222
        get :automerge_check
223
        get :ci_status
224
      end
225

226
      collection do
227 228 229
        get :branch_from
        get :branch_to
      end
230
    end
231 232 233

    resources :snippets do
      member do
R
randx 已提交
234 235 236 237
        get "raw"
      end
    end

R
Robert Speicher 已提交
238
    resources :hooks, only: [:index, :create, :destroy] do
239
      member do
240 241 242
        get :test
      end
    end
243 244


R
Robert Speicher 已提交
245
    resources :team, controller: 'team_members', only: [:index]
D
Dmitriy Zaporozhets 已提交
246
    resources :milestones, except: [:destroy]
R
Robert Speicher 已提交
247
    resources :labels, only: [:index]
D
Dmitriy Zaporozhets 已提交
248
    resources :issues, except: [:destroy] do
V
VSizov 已提交
249
      collection do
250
        post  :sort
R
randx 已提交
251
        post  :bulk_update
252
        get   :search
A
Adam Leonard 已提交
253
      end
V
VSizov 已提交
254
    end
R
Robert Speicher 已提交
255

D
Dmitriy Zaporozhets 已提交
256 257 258 259 260 261 262 263 264 265
    resources :team_members do
      collection do

        # Used for import team
        # from another project
        get :import
        post :apply_import
      end
    end

R
Robert Speicher 已提交
266
    resources :notes, only: [:index, :create, :destroy] do
267 268 269 270
      collection do
        post :preview
      end
    end
G
gitlabhq 已提交
271
  end
R
Robert Speicher 已提交
272 273

  root to: "dashboard#index"
G
gitlabhq 已提交
274
end