routes.rb 4.7 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
  require 'resque/server'
13
  mount Resque::Server => '/info/resque', as: '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
  #
R
Robert Speicher 已提交
26 27 28 29 30
  get 'help'              => 'help#index'
  get 'help/permissions'  => 'help#permissions'
  get 'help/workflow'     => 'help#workflow'
  get 'help/api'          => 'help#api'
  get 'help/web_hooks'    => 'help#web_hooks'
V
Valeriy Sizov 已提交
31
  get 'help/system_hooks' => 'help#system_hooks'
R
Robert Speicher 已提交
32 33
  get 'help/markdown'     => 'help#markdown'
  get 'help/ssh'          => 'help#ssh'
34

35 36 37
  #
  # Admin Area
  #
N
Nihad Abbasov 已提交
38
  namespace :admin do
39 40
    resources :users do
      member do
D
Dmitriy Zaporozhets 已提交
41
        put :team_update
42 43
        put :block
        put :unblock
D
Dmitriy Zaporozhets 已提交
44 45
      end
    end
R
Robert Speicher 已提交
46
    resources :projects, constraints: { id: /[^\/]+/ } do
47
      member do
48 49 50 51
        get :team
        put :team_update
      end
    end
R
Robert Speicher 已提交
52 53
    resources :team_members, only: [:edit, :update, :destroy]
    resources :hooks, only: [:index, :create, :destroy] do
V
Valeriy Sizov 已提交
54 55
      get :test
    end
56
    resource :logs, only: [:show]
R
Robert Speicher 已提交
57 58
    resource :resque, controller: 'resque', only: [:show]
    root to: "dashboard#index"
G
gitlabhq 已提交
59 60
  end

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

  #
  # Profile Area
  #
R
Robert Speicher 已提交
66 67 68 69 70 71 72 73 74
  get "profile/account"             => "profile#account"
  get "profile/history"             => "profile#history"
  put "profile/password"            => "profile#password_update"
  get "profile/token"               => "profile#token"
  put "profile/reset_private_token" => "profile#reset_private_token"
  get "profile"                     => "profile#show"
  get "profile/design"              => "profile#design"
  put "profile/update"              => "profile#update"

75
  resources :keys
D
Dmitriy Zaporozhets 已提交
76

R
randx 已提交
77 78 79
  #
  # Dashboard Area
  #
R
Robert Speicher 已提交
80 81 82
  get "dashboard"                => "dashboard#index"
  get "dashboard/issues"         => "dashboard#issues"
  get "dashboard/merge_requests" => "dashboard#merge_requests"
G
gitlabhq 已提交
83

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

R
Robert Speicher 已提交
86
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks }
G
gitlabhq 已提交
87

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

R
Robert Speicher 已提交
98
    resources :wikis, only: [:show, :edit, :destroy, :create] do
D
Dmitriy Zaporozhets 已提交
99 100 101 102
      collection do
        get :pages
      end

V
Valery Sizov 已提交
103
      member do
104
        get "history"
V
Valery Sizov 已提交
105 106
      end
    end
V
Valery Sizov 已提交
107

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

M
miks 已提交
116
    resources :deploy_keys
R
Robert Speicher 已提交
117
    resources :protected_branches, only: [:index, :create, :destroy]
M
miks 已提交
118

R
Robert Speicher 已提交
119
    resources :refs, only: [], path: "/" do
120
      collection do
G
gitlabhq 已提交
121 122 123
        get "switch"
      end

124
      member do
125 126
        # tree viewer logs
        get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
R
randx 已提交
127
        get "logs_tree/:path" => "refs#logs_tree",
R
Robert Speicher 已提交
128 129 130 131
          as: :logs_file,
          constraints: {
            id:   /[a-zA-Z.0-9\/_\-]+/,
            path: /.*/
R
randx 已提交
132
          }
G
gitlabhq 已提交
133
      end
G
gitlabhq 已提交
134
    end
G
gitlabhq 已提交
135

136 137
    resources :merge_requests do
      member do
138
        get :diffs
R
randx 已提交
139
        get :automerge
V
Valery Sizov 已提交
140
        get :automerge_check
R
randx 已提交
141
        get :raw
142
      end
143

144
      collection do
145 146 147
        get :branch_from
        get :branch_to
      end
148
    end
149 150 151

    resources :snippets do
      member do
R
randx 已提交
152 153 154 155
        get "raw"
      end
    end

R
Robert Speicher 已提交
156
    resources :hooks, only: [:index, :create, :destroy] do
157
      member do
158 159 160
        get :test
      end
    end
161

162 163
    # XXX: WIP
    resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
R
Robert Speicher 已提交
164 165
    resources :commits, only: [:show], constraints: {id: /.+/}
    resources :compare, only: [:index]
166 167
    resources :blame,   only: [:show], constraints: {id: /.+/}
    resources :blob,    only: [:show], constraints: {id: /.+/}
R
Robert Speicher 已提交
168
    resources :tree,    only: [:show], constraints: {id: /.+/}
169
    match "/compare/:from...:to" => "compare#show", as: "compare", constraints: {from: /.+/, to: /.+/}
170

R
Robert Speicher 已提交
171
    resources :team, controller: 'team_members', only: [:index]
G
gitlabhq 已提交
172
    resources :team_members
D
Dmitriy Zaporozhets 已提交
173
    resources :milestones
R
Robert Speicher 已提交
174
    resources :labels, only: [:index]
V
VSizov 已提交
175 176
    resources :issues do
      collection do
177
        post  :sort
R
randx 已提交
178
        post  :bulk_update
179
        get   :search
A
Adam Leonard 已提交
180
      end
V
VSizov 已提交
181
    end
R
Robert Speicher 已提交
182

R
Robert Speicher 已提交
183
    resources :notes, only: [:index, :create, :destroy] do
184 185 186 187
      collection do
        post :preview
      end
    end
G
gitlabhq 已提交
188
  end
R
Robert Speicher 已提交
189 190

  root to: "dashboard#index"
G
gitlabhq 已提交
191
end