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'
R
randx 已提交
32
  get 'help/markdown' => 'help#markdown'
33

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

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

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

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

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

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

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

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

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

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

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

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

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

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

G
gitlabhq 已提交
132

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

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

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

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

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

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

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

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