routes.rb 5.7 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
Robert Speicher 已提交
29 30 31 32 33
  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 已提交
34
  get 'help/system_hooks' => 'help#system_hooks'
R
Robert Speicher 已提交
35 36
  get 'help/markdown'     => 'help#markdown'
  get 'help/ssh'          => 'help#ssh'
37
  get 'help/raketasks'    => 'help#raketasks'
38
  get 'help/public_access'  => 'help#public_access'
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
R
Robert Speicher 已提交
72 73
    resources :team_members, only: [:edit, :update, :destroy]
    resources :hooks, only: [:index, :create, :destroy] do
V
Valeriy Sizov 已提交
74 75
      get :test
    end
76
    resource :logs, only: [:show]
R
Robert Speicher 已提交
77 78
    resource :resque, controller: 'resque', only: [:show]
    root to: "dashboard#index"
G
gitlabhq 已提交
79 80
  end

81
  get "errors/githost"
R
randx 已提交
82 83 84 85

  #
  # Profile Area
  #
86 87 88 89 90 91 92 93 94 95 96 97
  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 已提交
98

99
  resources :keys
D
Dmitriy Zaporozhets 已提交
100

R
randx 已提交
101 102 103
  #
  # Dashboard Area
  #
R
Robert Speicher 已提交
104 105 106
  get "dashboard"                => "dashboard#index"
  get "dashboard/issues"         => "dashboard#issues"
  get "dashboard/merge_requests" => "dashboard#merge_requests"
G
gitlabhq 已提交
107

R
randx 已提交
108 109 110 111 112 113 114 115 116 117

  #
  # Groups Area
  #
  resources :groups, constraints: { id: /[^\/]+/ }, only: [:show] do
    member do
      get :issues
      get :merge_requests
      get :search
      get :people
A
Andrey Kumanyaev 已提交
118
      post :team_members
R
randx 已提交
119 120 121
    end
  end

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

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

126 127 128
  #
  # Project Area
  #
129
  resources :projects, constraints: { id: /[a-zA-Z.0-9_\-\/]+/ }, except: [:new, :create, :index], path: "/" do
N
Nihad Abbasov 已提交
130
    member do
G
gitlabhq 已提交
131
      get "wall"
V
Valery Sizov 已提交
132
      get "graph"
133
      get "files"
G
gitlabhq 已提交
134
    end
G
gitlabhq 已提交
135

D
Dmitriy Zaporozhets 已提交
136 137 138 139 140 141 142 143 144
    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 已提交
145
    resources :wikis, only: [:show, :edit, :destroy, :create] do
D
Dmitriy Zaporozhets 已提交
146 147 148 149
      collection do
        get :pages
      end

V
Valery Sizov 已提交
150
      member do
151
        get "history"
V
Valery Sizov 已提交
152 153
      end
    end
V
Valery Sizov 已提交
154

155 156
    resource :repository do
      member do
D
Dmitriy Zaporozhets 已提交
157 158
        get "branches"
        get "tags"
R
randx 已提交
159
        get "stats"
160
        get "archive"
D
Dmitriy Zaporozhets 已提交
161 162
      end
    end
163

D
Dmitriy Zaporozhets 已提交
164 165 166 167 168 169
    resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
      member do
        get :test
      end
    end

M
miks 已提交
170
    resources :deploy_keys
R
Robert Speicher 已提交
171
    resources :protected_branches, only: [:index, :create, :destroy]
M
miks 已提交
172

173
    resources :refs, only: [] do
174
      collection do
G
gitlabhq 已提交
175 176 177
        get "switch"
      end

178
      member do
179 180
        # tree viewer logs
        get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
R
randx 已提交
181
        get "logs_tree/:path" => "refs#logs_tree",
R
Robert Speicher 已提交
182 183 184 185
          as: :logs_file,
          constraints: {
            id:   /[a-zA-Z.0-9\/_\-]+/,
            path: /.*/
R
randx 已提交
186
          }
G
gitlabhq 已提交
187
      end
G
gitlabhq 已提交
188
    end
G
gitlabhq 已提交
189

D
Dmitriy Zaporozhets 已提交
190
    resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do
191
      member do
192
        get :diffs
R
randx 已提交
193
        get :automerge
V
Valery Sizov 已提交
194
        get :automerge_check
195
        get :ci_status
196
      end
197

198
      collection do
199 200 201
        get :branch_from
        get :branch_to
      end
202
    end
203 204 205

    resources :snippets do
      member do
R
randx 已提交
206 207 208 209
        get "raw"
      end
    end

R
Robert Speicher 已提交
210
    resources :hooks, only: [:index, :create, :destroy] do
211
      member do
212 213 214
        get :test
      end
    end
215 216


R
Robert Speicher 已提交
217
    resources :team, controller: 'team_members', only: [:index]
D
Dmitriy Zaporozhets 已提交
218
    resources :milestones, except: [:destroy]
R
Robert Speicher 已提交
219
    resources :labels, only: [:index]
D
Dmitriy Zaporozhets 已提交
220
    resources :issues, except: [:destroy] do
V
VSizov 已提交
221
      collection do
222
        post  :sort
R
randx 已提交
223
        post  :bulk_update
224
        get   :search
A
Adam Leonard 已提交
225
      end
V
VSizov 已提交
226
    end
R
Robert Speicher 已提交
227

D
Dmitriy Zaporozhets 已提交
228 229 230 231 232 233 234 235 236 237
    resources :team_members do
      collection do

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

R
Robert Speicher 已提交
238
    resources :notes, only: [:index, :create, :destroy] do
239 240 241 242
      collection do
        post :preview
      end
    end
G
gitlabhq 已提交
243
  end
R
Robert Speicher 已提交
244 245

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