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'
29
  get 'help/web_hooks' => 'help#web_hooks'
30

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

57
  get "errors/githost"
R
randx 已提交
58 59 60 61

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

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

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

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

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

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

99 100
    resource :repository do
      member do
D
Dmitriy Zaporozhets 已提交
101 102
        get "branches"
        get "tags"
103
        get "archive"
D
Dmitriy Zaporozhets 已提交
104 105
      end
    end
106

M
miks 已提交
107
    resources :deploy_keys
108
    resources :protected_branches, :only => [:index, :create, :destroy]
M
miks 已提交
109

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

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

G
gitlabhq 已提交
123

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

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

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

150
      collection do
151 152 153
        get :branch_from
        get :branch_to
      end
154
    end
155 156 157

    resources :snippets do
      member do
R
randx 已提交
158 159 160 161
        get "raw"
      end
    end

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

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