routes.rb 4.83 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 13
  require 'resque/server'
  mount Resque::Server.new, at: '/info/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
  get 'help' => 'help#index'
27 28
  get 'help/permissions' => 'help#permissions'
  get 'help/workflow' => 'help#workflow'
randx's avatar
randx committed
29
  get 'help/api' => 'help#api'
30
  get 'help/web_hooks' => 'help#web_hooks'
Valeriy Sizov's avatar
Valeriy Sizov committed
31
  get 'help/system_hooks' => 'help#system_hooks'
randx's avatar
randx committed
32
  get 'help/markdown' => 'help#markdown'
33
  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
    resources :projects, :constraints => { :id => /[^\/]+/ } do
      member do
48 49 50 51
        get :team
        put :team_update
      end
    end
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
52
    resources :team_members, :only => [:edit, :update, :destroy]
gitlabhq's avatar
gitlabhq committed
53 54 55
    get 'mailer/preview_note'
    get 'mailer/preview_user_new'
    get 'mailer/preview_issue_new'
56

Valeriy Sizov's avatar
Valeriy Sizov committed
57 58 59
    resources :hooks, :only => [:index, :create, :destroy] do
      get :test
    end
60
    resource :logs
gleb's avatar
gleb committed
61
    resource :resque, :controller => 'resque'
randx's avatar
randx committed
62
    root :to => "dashboard#index"
gitlabhq's avatar
gitlabhq committed
63 64
  end

65
  get "errors/githost"
randx's avatar
randx committed
66 67 68 69

  #
  # Profile Area
  #
gitlabhq's avatar
gitlabhq committed
70 71
  get "profile/password", :to => "profile#password"
  put "profile/password", :to => "profile#password_update"
72
  get "profile/token", :to => "profile#token"
73
  put "profile/reset_private_token", :to => "profile#reset_private_token"
gitlabhq's avatar
gitlabhq committed
74
  get "profile", :to => "profile#show"
75 76
  get "profile/design", :to => "profile#design"
  put "profile/update", :to => "profile#update"
77
  resources :keys
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
78

randx's avatar
randx committed
79 80 81 82
  #
  # Dashboard Area
  #
  get "dashboard", :to => "dashboard#index"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
83 84
  get "dashboard/issues", :to => "dashboard#issues"
  get "dashboard/merge_requests", :to => "dashboard#merge_requests"
gitlabhq's avatar
gitlabhq committed
85

randx's avatar
randx committed
86
  resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create]
87

vsizov's avatar
vsizov committed
88
  devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks }
gitlabhq's avatar
gitlabhq committed
89

90 91 92
  #
  # Project Area
  #
93
  resources :projects, :constraints => { :id => /[^\/]+/ }, :except => [:new, :create, :index], :path => "/" do
Nihad Abbasov's avatar
Nihad Abbasov committed
94
    member do
gitlabhq's avatar
gitlabhq committed
95 96
      get "team"
      get "wall"
Valery Sizov's avatar
Valery Sizov committed
97
      get "graph"
98
      get "files"
gitlabhq's avatar
gitlabhq committed
99
    end
gitlabhq's avatar
gitlabhq committed
100

Valery Sizov's avatar
Valery Sizov committed
101
    resources :wikis, :only => [:show, :edit, :destroy, :create] do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
102 103 104 105
      collection do
        get :pages
      end

Valery Sizov's avatar
Valery Sizov committed
106
      member do
107
        get "history"
Valery Sizov's avatar
Valery Sizov committed
108 109
      end
    end
110

111 112
    resource :repository do
      member do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
113 114
        get "branches"
        get "tags"
115
        get "archive"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
116 117
      end
    end
118

miks's avatar
miks committed
119
    resources :deploy_keys
120
    resources :protected_branches, :only => [:index, :create, :destroy]
miks's avatar
miks committed
121

122 123
    resources :refs, :only => [], :path => "/" do
      collection do
gitlabhq's avatar
gitlabhq committed
124 125 126
        get "switch"
      end

127
      member do
gitlabhq's avatar
gitlabhq committed
128
        get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }
129 130
        get "logs_tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }

131
        get "blob",
gitlabhq's avatar
gitlabhq committed
132 133 134 135 136
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }

gitlabhq's avatar
gitlabhq committed
137

gitlabhq's avatar
gitlabhq committed
138 139 140 141
        # tree viewer
        get "tree/:path" => "refs#tree",
          :as => :tree_file,
          :constraints => {
gitlabhq's avatar
gitlabhq committed
142
            :id => /[a-zA-Z.0-9\/_\-]+/,
gitlabhq's avatar
gitlabhq committed
143 144
            :path => /.*/
          }
145

146 147 148 149 150 151 152 153
        # tree viewer
        get "logs_tree/:path" => "refs#logs_tree",
          :as => :logs_file,
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }

154 155 156 157 158 159 160
        # blame
        get "blame/:path" => "refs#blame",
          :as => :blame_file,
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }
gitlabhq's avatar
gitlabhq committed
161
      end
gitlabhq's avatar
gitlabhq committed
162
    end
gitlabhq's avatar
gitlabhq committed
163

164 165
    resources :merge_requests do
      member do
166
        get :diffs
randx's avatar
randx committed
167
        get :automerge
Valery Sizov's avatar
Valery Sizov committed
168
        get :automerge_check
randx's avatar
randx committed
169
        get :raw
170
      end
171

172
      collection do
173 174 175
        get :branch_from
        get :branch_to
      end
176
    end
177 178 179

    resources :snippets do
      member do
180 181 182 183
        get "raw"
      end
    end

184 185
    resources :hooks, :only => [:index, :create, :destroy] do
      member do
186 187 188
        get :test
      end
    end
189 190
    resources :commits do
      collection do
191 192
        get :compare
      end
193

194
      member do
195 196
        get :patch
      end
197
    end
gitlabhq's avatar
gitlabhq committed
198
    resources :team_members
199
    resources :milestones
randx's avatar
randx committed
200
    resources :labels, :only => [:index]
VSizov's avatar
VSizov committed
201
    resources :issues do
randx's avatar
randx committed
202

VSizov's avatar
VSizov committed
203
      collection do
204
        post  :sort
randx's avatar
randx committed
205
        post  :bulk_update
206
        get   :search
Adam Leonard's avatar
Adam Leonard committed
207
      end
VSizov's avatar
VSizov committed
208
    end
209 210 211 212 213
    resources :notes, :only => [:index, :create, :destroy] do
      collection do
        post :preview
      end
    end
gitlabhq's avatar
gitlabhq committed
214
  end
randx's avatar
randx committed
215
  root :to => "dashboard#index"
gitlabhq's avatar
gitlabhq committed
216
end