routes.rb 5.05 KB
Newer Older
gitlabhq's avatar
gitlabhq committed
1
Gitlab::Application.routes.draw do
2 3 4
  #
  # Search
  #
5
  get 'search' => "search#show"
Valery Sizov's avatar
Valery Sizov committed
6

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

11
  # Optionally, enable Resque here
12
  require 'resque/server'
13
  mount Resque::Server => '/info/resque', as: 'resque'
Ariejan de Vroom's avatar
Ariejan de Vroom committed
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.git_base_path,
    upload_pack:  Gitlab.config.git_upload_pack,
    receive_pack: Gitlab.config.git_receive_pack
Saito's avatar
Saito committed
21
  }), at: '/:path', constraints: { path: /[\w-]+\.git/ }
22

23 24 25
  #
  # Help
  #
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'
Valeriy Sizov's avatar
Valeriy Sizov committed
31
  get 'help/system_hooks' => 'help#system_hooks'
32 33
  get 'help/markdown'     => 'help#markdown'
  get 'help/ssh'          => 'help#ssh'
34

35 36 37
  #
  # Admin Area
  #
Nihad Abbasov's avatar
Nihad Abbasov committed
38
  namespace :admin do
39 40
    resources :users do
      member do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
41
        put :team_update
42 43
        put :block
        put :unblock
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
44 45
      end
    end
46 47 48
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
        put :project_update
49
        delete :remove_project
50 51
      end
    end
52
    resources :projects, constraints: { id: /[^\/]+/ } do
53
      member do
54 55 56 57
        get :team
        put :team_update
      end
    end
58 59
    resources :team_members, only: [:edit, :update, :destroy]
    resources :hooks, only: [:index, :create, :destroy] do
Valeriy Sizov's avatar
Valeriy Sizov committed
60 61
      get :test
    end
62
    resource :logs, only: [:show]
63 64
    resource :resque, controller: 'resque', only: [:show]
    root to: "dashboard#index"
gitlabhq's avatar
gitlabhq committed
65 66
  end

67
  get "errors/githost"
randx's avatar
randx committed
68 69 70 71

  #
  # Profile Area
  #
72 73 74 75 76 77 78 79 80
  get "profile/account"             => "profile#account"
  get "profile/history"             => "profile#history"
  put "profile/password"            => "profile#password_update"
  get "profile/token"               => "profile#token"
  put "profile/reset_private_token" => "profile#reset_private_token"
  get "profile"                     => "profile#show"
  get "profile/design"              => "profile#design"
  put "profile/update"              => "profile#update"

81
  resources :keys
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
82

randx's avatar
randx committed
83 84 85
  #
  # Dashboard Area
  #
86 87 88
  get "dashboard"                => "dashboard#index"
  get "dashboard/issues"         => "dashboard#issues"
  get "dashboard/merge_requests" => "dashboard#merge_requests"
gitlabhq's avatar
gitlabhq committed
89

randx's avatar
randx committed
90 91 92 93 94 95 96 97 98 99 100 101 102

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

103
  resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
104

105
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks }
gitlabhq's avatar
gitlabhq committed
106

107 108 109
  #
  # Project Area
  #
110
  resources :projects, constraints: { id: /[^\/]+/ }, except: [:new, :create, :index], path: "/" do
Nihad Abbasov's avatar
Nihad Abbasov committed
111
    member do
gitlabhq's avatar
gitlabhq committed
112
      get "wall"
Valery Sizov's avatar
Valery Sizov committed
113
      get "graph"
114
      get "files"
gitlabhq's avatar
gitlabhq committed
115
    end
gitlabhq's avatar
gitlabhq committed
116

117
    resources :wikis, only: [:show, :edit, :destroy, :create] do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
118 119 120 121
      collection do
        get :pages
      end

Valery Sizov's avatar
Valery Sizov committed
122
      member do
123
        get "history"
Valery Sizov's avatar
Valery Sizov committed
124 125
      end
    end
126

127 128
    resource :repository do
      member do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
129 130
        get "branches"
        get "tags"
131
        get "archive"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
132 133
      end
    end
134

miks's avatar
miks committed
135
    resources :deploy_keys
136
    resources :protected_branches, only: [:index, :create, :destroy]
miks's avatar
miks committed
137

138
    resources :refs, only: [], path: "/" do
139
      collection do
gitlabhq's avatar
gitlabhq committed
140 141 142
        get "switch"
      end

143
      member do
144 145
        # tree viewer logs
        get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
146
        get "logs_tree/:path" => "refs#logs_tree",
147 148 149 150
          as: :logs_file,
          constraints: {
            id:   /[a-zA-Z.0-9\/_\-]+/,
            path: /.*/
151
          }
gitlabhq's avatar
gitlabhq committed
152
      end
gitlabhq's avatar
gitlabhq committed
153
    end
gitlabhq's avatar
gitlabhq committed
154

155 156
    resources :merge_requests do
      member do
157
        get :diffs
randx's avatar
randx committed
158
        get :automerge
Valery Sizov's avatar
Valery Sizov committed
159
        get :automerge_check
randx's avatar
randx committed
160
        get :raw
161
      end
162

163
      collection do
164 165 166
        get :branch_from
        get :branch_to
      end
167
    end
168 169 170

    resources :snippets do
      member do
171 172 173 174
        get "raw"
      end
    end

175
    resources :hooks, only: [:index, :create, :destroy] do
176
      member do
177 178 179
        get :test
      end
    end
180

181
    resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
Robert Speicher's avatar
Robert Speicher committed
182
    resources :commits, only: [:show], constraints: {id: /.+/}
183
    resources :compare, only: [:index, :create]
184 185
    resources :blame,   only: [:show], constraints: {id: /.+/}
    resources :blob,    only: [:show], constraints: {id: /.+/}
Valeriy Sizov's avatar
Valeriy Sizov committed
186
    resources :tree,    only: [:show, :edit, :update], constraints: {id: /.+/}
187 188
    match "/compare/:from...:to" => "compare#show", as: "compare",
                    :via => [:get, :post], constraints: {from: /.+/, to: /.+/}
189

190
    resources :team, controller: 'team_members', only: [:index]
gitlabhq's avatar
gitlabhq committed
191
    resources :team_members
192
    resources :milestones
193
    resources :labels, only: [:index]
VSizov's avatar
VSizov committed
194 195
    resources :issues do
      collection do
196
        post  :sort
randx's avatar
randx committed
197
        post  :bulk_update
198
        get   :search
Adam Leonard's avatar
Adam Leonard committed
199
      end
VSizov's avatar
VSizov committed
200
    end
Robert Speicher's avatar
Robert Speicher committed
201

202
    resources :notes, only: [:index, :create, :destroy] do
203 204 205 206
      collection do
        post :preview
      end
    end
gitlabhq's avatar
gitlabhq committed
207
  end
208 209

  root to: "dashboard#index"
gitlabhq's avatar
gitlabhq committed
210
end