routes.rb 4.6 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'
V
Valeriy Sizov 已提交
31
  get 'help/system_hooks' => 'help#system_hooks'
32

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

V
Valeriy Sizov 已提交
55 56 57
    resources :hooks, :only => [:index, :create, :destroy] do
      get :test
    end
58
    resource :logs
G
gleb 已提交
59
    resource :resque, :controller => 'resque'
R
randx 已提交
60
    root :to => "dashboard#index"
G
gitlabhq 已提交
61 62
  end

63
  get "errors/githost"
R
randx 已提交
64 65 66 67

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

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

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

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

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

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

105 106
    resource :repository do
      member do
D
Dmitriy Zaporozhets 已提交
107 108
        get "branches"
        get "tags"
109
        get "archive"
D
Dmitriy Zaporozhets 已提交
110 111
      end
    end
112

M
miks 已提交
113
    resources :deploy_keys
114
    resources :protected_branches, :only => [:index, :create, :destroy]
M
miks 已提交
115

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

121
      member do
G
gitlabhq 已提交
122
        get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }
R
randx 已提交
123 124
        get "logs_tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }

125
        get "blob",
G
gitlabhq 已提交
126 127 128 129 130
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }

G
gitlabhq 已提交
131

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

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

148 149 150 151 152 153 154
        # blame
        get "blame/:path" => "refs#blame",
          :as => :blame_file,
          :constraints => {
            :id => /[a-zA-Z.0-9\/_\-]+/,
            :path => /.*/
          }
G
gitlabhq 已提交
155
      end
G
gitlabhq 已提交
156
    end
G
gitlabhq 已提交
157

158 159
    resources :merge_requests do
      member do
160
        get :diffs
R
randx 已提交
161
        get :automerge
V
Valery Sizov 已提交
162
        get :automerge_check
R
randx 已提交
163
        get :raw
164
      end
165

166
      collection do
167 168 169
        get :branch_from
        get :branch_to
      end
170
    end
171 172 173

    resources :snippets do
      member do
R
randx 已提交
174 175 176 177
        get "raw"
      end
    end

178 179
    resources :hooks, :only => [:index, :create, :destroy] do
      member do
180 181 182
        get :test
      end
    end
183 184
    resources :commits do
      collection do
D
Dmitriy Zaporozhets 已提交
185 186
        get :compare
      end
187

188
      member do
189 190
        get :patch
      end
D
Dmitriy Zaporozhets 已提交
191
    end
G
gitlabhq 已提交
192
    resources :team_members
D
Dmitriy Zaporozhets 已提交
193
    resources :milestones
V
VSizov 已提交
194 195
    resources :issues do
      collection do
196
        post  :sort
R
randx 已提交
197
        post  :bulk_update
198
        get   :search
A
Adam Leonard 已提交
199
      end
V
VSizov 已提交
200
    end
201
    resources :notes, :only => [:index, :create, :destroy]
G
gitlabhq 已提交
202
  end
R
randx 已提交
203
  root :to => "dashboard#index"
G
gitlabhq 已提交
204
end