routes.rb 4.74 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.new, at: '/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
  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]
Valeriy Sizov's avatar
Valeriy Sizov committed
53 54 55
    resources :hooks, :only => [:index, :create, :destroy] do
      get :test
    end
56
    resource :logs
gleb's avatar
gleb committed
57
    resource :resque, :controller => 'resque'
randx's avatar
randx committed
58
    root :to => "dashboard#index"
gitlabhq's avatar
gitlabhq committed
59 60
  end

61
  get "errors/githost"
randx's avatar
randx committed
62 63 64 65

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

randx's avatar
randx committed
75 76 77 78
  #
  # Dashboard Area
  #
  get "dashboard", :to => "dashboard#index"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
79 80
  get "dashboard/issues", :to => "dashboard#issues"
  get "dashboard/merge_requests", :to => "dashboard#merge_requests"
gitlabhq's avatar
gitlabhq committed
81

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

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

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

Valery Sizov's avatar
Valery Sizov committed
97
    resources :wikis, :only => [:show, :edit, :destroy, :create] do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
98 99 100 101
      collection do
        get :pages
      end

Valery Sizov's avatar
Valery Sizov committed
102
      member do
103
        get "history"
Valery Sizov's avatar
Valery Sizov committed
104 105
      end
    end
106

107 108
    resource :repository do
      member do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
109 110
        get "branches"
        get "tags"
111
        get "archive"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
112 113
      end
    end
114

miks's avatar
miks committed
115
    resources :deploy_keys
116
    resources :protected_branches, :only => [:index, :create, :destroy]
miks's avatar
miks committed
117

118 119
    resources :refs, :only => [], :path => "/" do
      collection do
gitlabhq's avatar
gitlabhq committed
120 121 122
        get "switch"
      end

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

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

gitlabhq's avatar
gitlabhq committed
133

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

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

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

160 161
    resources :merge_requests do
      member do
162
        get :diffs
randx's avatar
randx committed
163
        get :automerge
Valery Sizov's avatar
Valery Sizov committed
164
        get :automerge_check
randx's avatar
randx committed
165
        get :raw
166
      end
167

168
      collection do
169 170 171
        get :branch_from
        get :branch_to
      end
172
    end
173 174 175

    resources :snippets do
      member do
176 177 178 179
        get "raw"
      end
    end

180 181
    resources :hooks, :only => [:index, :create, :destroy] do
      member do
182 183 184
        get :test
      end
    end
185 186
    resources :commits do
      collection do
187 188
        get :compare
      end
189

190
      member do
191 192
        get :patch
      end
193
    end
gitlabhq's avatar
gitlabhq committed
194
    resources :team_members
195
    resources :milestones
randx's avatar
randx committed
196
    resources :labels, :only => [:index]
VSizov's avatar
VSizov committed
197
    resources :issues do
randx's avatar
randx committed
198

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