routes.rb 4.2 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 13
  require 'resque/server'
  mount Resque::Server.new, at: '/info/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.git_base_path,
    upload_pack:  Gitlab.config.git_upload_pack,
    receive_pack: Gitlab.config.git_receive_pack
S
Saito 已提交
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'
R
randx 已提交
29
  get 'help/api' => 'help#api'
30
  get 'help/web_hooks' => 'help#web_hooks'
31

32 33 34
  #
  # Admin Area
  #
N
Nihad Abbasov 已提交
35
  namespace :admin do
36 37
    resources :users do
      member do
D
Dmitriy Zaporozhets 已提交
38
        put :team_update
39 40
        put :block
        put :unblock
D
Dmitriy Zaporozhets 已提交
41 42
      end
    end
43 44
    resources :projects, :constraints => { :id => /[^\/]+/ } do
      member do
45 46 47 48
        get :team
        put :team_update
      end
    end
D
Dmitriy Zaporozhets 已提交
49
    resources :team_members, :only => [:edit, :update, :destroy]
G
gitlabhq 已提交
50 51 52 53
    get 'emails', :to => 'mailer#preview'
    get 'mailer/preview_note'
    get 'mailer/preview_user_new'
    get 'mailer/preview_issue_new'
54 55

    resource :logs
G
gleb 已提交
56
    resource :resque, :controller => 'resque'
R
randx 已提交
57
    root :to => "dashboard#index"
G
gitlabhq 已提交
58 59
  end

60
  get "errors/githost"
R
randx 已提交
61 62 63 64

  #
  # Profile Area
  #
G
gitlabhq 已提交
65 66
  get "profile/password", :to => "profile#password"
  put "profile/password", :to => "profile#password_update"
67
  get "profile/token", :to => "profile#token"
68
  put "profile/reset_private_token", :to => "profile#reset_private_token"
G
gitlabhq 已提交
69
  get "profile", :to => "profile#show"
70 71
  get "profile/design", :to => "profile#design"
  put "profile/update", :to => "profile#update"
72
  resources :keys
D
Dmitriy Zaporozhets 已提交
73

R
randx 已提交
74 75 76 77
  #
  # Dashboard Area
  #
  get "dashboard", :to => "dashboard#index"
D
Dmitriy Zaporozhets 已提交
78 79
  get "dashboard/issues", :to => "dashboard#issues"
  get "dashboard/merge_requests", :to => "dashboard#merge_requests"
G
gitlabhq 已提交
80

R
randx 已提交
81
  resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create]
82

V
vsizov 已提交
83
  devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks }
G
gitlabhq 已提交
84

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

V
Valery Sizov 已提交
96 97
    resources :wikis, :only => [:show, :edit, :destroy, :create] do
      member do
98
        get "history"
V
Valery Sizov 已提交
99 100
      end
    end
V
Valery Sizov 已提交
101

102 103
    resource :repository do
      member do
D
Dmitriy Zaporozhets 已提交
104 105
        get "branches"
        get "tags"
106
        get "archive"
D
Dmitriy Zaporozhets 已提交
107 108
      end
    end
109

M
miks 已提交
110
    resources :deploy_keys
111
    resources :protected_branches, :only => [:index, :create, :destroy]
M
miks 已提交
112

113 114
    resources :refs, :only => [], :path => "/" do
      collection do
G
gitlabhq 已提交
115 116 117
        get "switch"
      end

118
      member do
G
gitlabhq 已提交
119
        get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }
120
        get "blob",
G
gitlabhq 已提交
121 122 123 124 125
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }

G
gitlabhq 已提交
126

G
gitlabhq 已提交
127 128 129 130
        # tree viewer
        get "tree/:path" => "refs#tree",
          :as => :tree_file,
          :constraints => {
G
gitlabhq 已提交
131
            :id => /[a-zA-Z.0-9\/_\-]+/,
G
gitlabhq 已提交
132 133
            :path => /.*/
          }
134 135 136 137 138 139 140 141

        # blame
        get "blame/:path" => "refs#blame",
          :as => :blame_file,
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }
G
gitlabhq 已提交
142
      end
G
gitlabhq 已提交
143
    end
G
gitlabhq 已提交
144

145 146
    resources :merge_requests do
      member do
147
        get :diffs
R
randx 已提交
148
        get :automerge
V
Valery Sizov 已提交
149
        get :automerge_check
R
randx 已提交
150
        get :raw
151
      end
152

153
      collection do
154 155 156
        get :branch_from
        get :branch_to
      end
157
    end
158 159 160

    resources :snippets do
      member do
R
randx 已提交
161 162 163 164
        get "raw"
      end
    end

165 166
    resources :hooks, :only => [:index, :create, :destroy] do
      member do
167 168 169
        get :test
      end
    end
170 171
    resources :commits do
      collection do
D
Dmitriy Zaporozhets 已提交
172 173
        get :compare
      end
174

175
      member do
176 177
        get :patch
      end
D
Dmitriy Zaporozhets 已提交
178
    end
G
gitlabhq 已提交
179
    resources :team_members
D
Dmitriy Zaporozhets 已提交
180
    resources :milestones
V
VSizov 已提交
181 182
    resources :issues do
      collection do
183 184
        post  :sort
        get   :search
A
Adam Leonard 已提交
185
      end
V
VSizov 已提交
186
    end
187
    resources :notes, :only => [:index, :create, :destroy]
G
gitlabhq 已提交
188
  end
R
randx 已提交
189
  root :to => "dashboard#index"
G
gitlabhq 已提交
190
end