BigW Consortium Gitlab

routes.rb 5.42 KB
Newer Older
gitlabhq committed
1
Gitlab::Application.routes.draw do
2 3 4
  #
  # Search
  #
5
  get 'search' => "search#show"
Valery Sizov committed
6

7 8 9 10
  # API
  require 'api'
  mount Gitlab::API => '/api'

11
  # Optionally, enable Resque here
12
  require 'resque/server'
13
  mount Resque::Server => '/info/resque', as: 'resque'
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
21
  }), at: '/:path', constraints: { path: /[-\/\w\.-]+\.git/ }
22

23 24 25
  #
  # Help
  #
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'
31
  get 'help/system_hooks' => 'help#system_hooks'
32 33
  get 'help/markdown'     => 'help#markdown'
  get 'help/ssh'          => 'help#ssh'
34

35 36 37
  #
  # Admin Area
  #
Nihad Abbasov committed
38
  namespace :admin do
39 40
    resources :users do
      member do
41
        put :team_update
42 43
        put :block
        put :unblock
44 45
      end
    end
46 47 48
    resources :groups, constraints: { id: /[^\/]+/ } do
      member do
        put :project_update
49
        delete :remove_project
50 51
      end
    end
52
    resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do
53
      member do
54 55 56 57
        get :team
        put :team_update
      end
    end
58 59
    resources :team_members, only: [:edit, :update, :destroy]
    resources :hooks, only: [:index, :create, :destroy] do
60 61
      get :test
    end
62
    resource :logs, only: [:show]
63 64
    resource :resque, controller: 'resque', only: [:show]
    root to: "dashboard#index"
gitlabhq committed
65 66
  end

67
  get "errors/githost"
randx committed
68 69 70 71

  #
  # Profile Area
  #
72 73 74 75 76 77 78 79 80
  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"

81
  resources :keys
Dmitriy Zaporozhets committed
82

randx committed
83 84 85
  #
  # Dashboard Area
  #
86 87 88
  get "dashboard"                => "dashboard#index"
  get "dashboard/issues"         => "dashboard#issues"
  get "dashboard/merge_requests" => "dashboard#merge_requests"
gitlabhq committed
89

90 91 92 93 94 95 96 97 98 99 100 101 102

  #
  # Groups Area
  #
  resources :groups, constraints: { id: /[^\/]+/ }, only: [:show] do
    member do
      get :issues
      get :merge_requests
      get :search
      get :people
    end
  end

103
  resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
104

105
  devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks }
gitlabhq committed
106

107 108 109
  #
  # Project Area
  #
110
  resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create, :index], path: "/" do
Nihad Abbasov committed
111
    member do
gitlabhq committed
112
      get "wall"
Valery Sizov committed
113
      get "graph"
114
      get "files"
gitlabhq committed
115
    end
gitlabhq committed
116

117
    resources :wikis, only: [:show, :edit, :destroy, :create] do
Dmitriy Zaporozhets committed
118 119 120 121
      collection do
        get :pages
      end

Valery Sizov committed
122
      member do
123
        get "history"
Valery Sizov committed
124 125
      end
    end
126

127 128
    resource :repository do
      member do
129 130
        get "branches"
        get "tags"
randx committed
131
        get "stats"
132
        get "archive"
133 134
      end
    end
135

136 137 138 139 140 141
    resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
      member do
        get :test
      end
    end

miks committed
142
    resources :deploy_keys
143
    resources :protected_branches, only: [:index, :create, :destroy]
miks committed
144

145
    resources :refs, only: [], path: "/" do
146
      collection do
gitlabhq committed
147 148 149
        get "switch"
      end

150
      member do
151 152
        # tree viewer logs
        get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
153
        get "logs_tree/:path" => "refs#logs_tree",
154 155 156 157
          as: :logs_file,
          constraints: {
            id:   /[a-zA-Z.0-9\/_\-]+/,
            path: /.*/
158
          }
gitlabhq committed
159
      end
gitlabhq committed
160
    end
gitlabhq committed
161

162
    resources :merge_requests, constraints: {id: /\d+/} do
163
      member do
164
        get :diffs
randx committed
165
        get :automerge
166
        get :automerge_check
167
      end
168

169
      collection do
170 171 172
        get :branch_from
        get :branch_to
      end
173
    end
174 175 176

    resources :snippets do
      member do
177 178 179 180
        get "raw"
      end
    end

181
    resources :hooks, only: [:index, :create, :destroy] do
182
      member do
183 184 185
        get :test
      end
    end
186

187
    resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
Robert Speicher committed
188
    resources :commits, only: [:show], constraints: {id: /.+/}
189
    resources :compare, only: [:index, :create]
190 191
    resources :blame,   only: [:show], constraints: {id: /.+/}
    resources :blob,    only: [:show], constraints: {id: /.+/}
Valeriy Sizov committed
192
    resources :tree,    only: [:show, :edit, :update], constraints: {id: /.+/}
193 194
    match "/compare/:from...:to" => "compare#show", as: "compare",
                    :via => [:get, :post], constraints: {from: /.+/, to: /.+/}
195

196
    resources :team, controller: 'team_members', only: [:index]
197
    resources :milestones
198
    resources :labels, only: [:index]
VSizov committed
199 200
    resources :issues do
      collection do
201
        post  :sort
randx committed
202
        post  :bulk_update
203
        get   :search
204
      end
VSizov committed
205
    end
Robert Speicher committed
206

207 208 209 210 211 212 213 214 215 216
    resources :team_members do
      collection do

        # Used for import team
        # from another project
        get :import
        post :apply_import
      end
    end

217
    resources :notes, only: [:index, :create, :destroy] do
218 219 220 221
      collection do
        post :preview
      end
    end
gitlabhq committed
222
  end
223 224

  root to: "dashboard#index"
gitlabhq committed
225
end