routes.rb 5.3 KB
Newer Older
G
gitlabhq 已提交
1
Gitlab::Application.routes.draw do
2 3 4
  #
  # Search
  #
5
  get 'search' => "search#show"
V
Valery Sizov 已提交
6

7 8 9 10
  # API
  require 'api'
  mount Gitlab::API => '/api'

A
Ariejan de Vroom 已提交
11
  # Optionally, enable Resque here
D
Dmitriy Zaporozhets 已提交
12
  require 'resque/server'
13
  mount Resque::Server => '/info/resque', as: 'resque'
A
Ariejan de Vroom 已提交
14

15 16
  # Enable Grack support
  mount Grack::Bundle.new({
17 18 19 20
    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
21
  }), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ }
22

23 24 25
  #
  # Help
  #
R
Robert Speicher 已提交
26 27 28 29 30
  get 'help'              => 'help#index'
  get 'help/permissions'  => 'help#permissions'
  get 'help/workflow'     => 'help#workflow'
  get 'help/api'          => 'help#api'
  get 'help/web_hooks'    => 'help#web_hooks'
V
Valeriy Sizov 已提交
31
  get 'help/system_hooks' => 'help#system_hooks'
R
Robert Speicher 已提交
32 33
  get 'help/markdown'     => 'help#markdown'
  get 'help/ssh'          => 'help#ssh'
34
  get 'help/raketasks'    => 'help#raketasks'
35

36 37 38
  #
  # Admin Area
  #
N
Nihad Abbasov 已提交
39
  namespace :admin do
40 41
    resources :users do
      member do
D
Dmitriy Zaporozhets 已提交
42
        put :team_update
43 44
        put :block
        put :unblock
D
Dmitriy Zaporozhets 已提交
45 46
      end
    end
47 48 49
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
        put :project_update
50
        delete :remove_project
51 52
      end
    end
53
    resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do
54
      member do
55 56 57 58
        get :team
        put :team_update
      end
    end
R
Robert Speicher 已提交
59 60
    resources :team_members, only: [:edit, :update, :destroy]
    resources :hooks, only: [:index, :create, :destroy] do
V
Valeriy Sizov 已提交
61 62
      get :test
    end
63
    resource :logs, only: [:show]
R
Robert Speicher 已提交
64 65
    resource :resque, controller: 'resque', only: [:show]
    root to: "dashboard#index"
G
gitlabhq 已提交
66 67
  end

68
  get "errors/githost"
R
randx 已提交
69 70 71 72

  #
  # Profile Area
  #
73 74 75 76 77 78 79 80 81 82 83 84
  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 已提交
85

86
  resources :keys
D
Dmitriy Zaporozhets 已提交
87

R
randx 已提交
88 89 90
  #
  # Dashboard Area
  #
R
Robert Speicher 已提交
91 92 93
  get "dashboard"                => "dashboard#index"
  get "dashboard/issues"         => "dashboard#issues"
  get "dashboard/merge_requests" => "dashboard#merge_requests"
G
gitlabhq 已提交
94

R
randx 已提交
95 96 97 98 99 100 101 102 103 104 105 106 107

  #
  # Groups Area
  #
  resources :groups, constraints: { id: /[^\/]+/ }, only: [:show] do
    member do
      get :issues
      get :merge_requests
      get :search
      get :people
    end
  end

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

R
Robert Speicher 已提交
110
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks }
G
gitlabhq 已提交
111

112 113 114
  #
  # Project Area
  #
115
  resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create, :index], path: "/" do
N
Nihad Abbasov 已提交
116
    member do
G
gitlabhq 已提交
117
      get "wall"
V
Valery Sizov 已提交
118
      get "graph"
119
      get "files"
G
gitlabhq 已提交
120
    end
G
gitlabhq 已提交
121

R
Robert Speicher 已提交
122
    resources :wikis, only: [:show, :edit, :destroy, :create] do
D
Dmitriy Zaporozhets 已提交
123 124 125 126
      collection do
        get :pages
      end

V
Valery Sizov 已提交
127
      member do
128
        get "history"
V
Valery Sizov 已提交
129 130
      end
    end
V
Valery Sizov 已提交
131

132 133
    resource :repository do
      member do
D
Dmitriy Zaporozhets 已提交
134 135
        get "branches"
        get "tags"
R
randx 已提交
136
        get "stats"
137
        get "archive"
D
Dmitriy Zaporozhets 已提交
138 139
      end
    end
140

D
Dmitriy Zaporozhets 已提交
141 142 143 144 145 146
    resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
      member do
        get :test
      end
    end

M
miks 已提交
147
    resources :deploy_keys
R
Robert Speicher 已提交
148
    resources :protected_branches, only: [:index, :create, :destroy]
M
miks 已提交
149

R
Robert Speicher 已提交
150
    resources :refs, only: [], path: "/" do
151
      collection do
G
gitlabhq 已提交
152 153 154
        get "switch"
      end

155
      member do
156 157
        # tree viewer logs
        get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
R
randx 已提交
158
        get "logs_tree/:path" => "refs#logs_tree",
R
Robert Speicher 已提交
159 160 161 162
          as: :logs_file,
          constraints: {
            id:   /[a-zA-Z.0-9\/_\-]+/,
            path: /.*/
R
randx 已提交
163
          }
G
gitlabhq 已提交
164
      end
G
gitlabhq 已提交
165
    end
G
gitlabhq 已提交
166

D
Dmitriy Zaporozhets 已提交
167
    resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do
168
      member do
169
        get :diffs
R
randx 已提交
170
        get :automerge
V
Valery Sizov 已提交
171
        get :automerge_check
172
        get :ci_status
173
      end
174

175
      collection do
176 177 178
        get :branch_from
        get :branch_to
      end
179
    end
180 181 182

    resources :snippets do
      member do
R
randx 已提交
183 184 185 186
        get "raw"
      end
    end

R
Robert Speicher 已提交
187
    resources :hooks, only: [:index, :create, :destroy] do
188
      member do
189 190 191
        get :test
      end
    end
192

193
    resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
R
Robert Speicher 已提交
194
    resources :commits, only: [:show], constraints: {id: /.+/}
195
    resources :compare, only: [:index, :create]
196 197
    resources :blame,   only: [:show], constraints: {id: /.+/}
    resources :blob,    only: [:show], constraints: {id: /.+/}
V
Valeriy Sizov 已提交
198
    resources :tree,    only: [:show, :edit, :update], constraints: {id: /.+/}
199 200
    match "/compare/:from...:to" => "compare#show", as: "compare",
                    :via => [:get, :post], constraints: {from: /.+/, to: /.+/}
201

R
Robert Speicher 已提交
202
    resources :team, controller: 'team_members', only: [:index]
D
Dmitriy Zaporozhets 已提交
203
    resources :milestones, except: [:destroy]
R
Robert Speicher 已提交
204
    resources :labels, only: [:index]
D
Dmitriy Zaporozhets 已提交
205
    resources :issues, except: [:destroy] do
V
VSizov 已提交
206
      collection do
207
        post  :sort
R
randx 已提交
208
        post  :bulk_update
209
        get   :search
A
Adam Leonard 已提交
210
      end
V
VSizov 已提交
211
    end
R
Robert Speicher 已提交
212

D
Dmitriy Zaporozhets 已提交
213 214 215 216 217 218 219 220 221 222
    resources :team_members do
      collection do

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

R
Robert Speicher 已提交
223
    resources :notes, only: [:index, :create, :destroy] do
224 225 226 227
      collection do
        post :preview
      end
    end
G
gitlabhq 已提交
228
  end
R
Robert Speicher 已提交
229 230

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