Skip to content
Snippets Groups Projects
routes.rb 6.42 KiB
Newer Older
  • Learn to ignore specific revisions
  • Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
    require 'sidekiq/web'
    
    
    gitlabhq's avatar
    gitlabhq committed
    Gitlab::Application.routes.draw do
    
      get 'search' => "search#show"
    
    Valery Sizov's avatar
    Valery Sizov committed
    
    
      # API
      require 'api'
      mount Gitlab::API => '/api'
    
    
    Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
      constraint = lambda { |request| request.env["warden"].authenticate? and request.env['warden'].user.admin? }
      constraints constraint do
    
        mount Sidekiq::Web, at: "/admin/sidekiq", as: :sidekiq
    
    Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
      end
    
      # Enable Grack support
      mount Grack::Bundle.new({
    
        git_path:     Gitlab.config.git.bin_path,
        project_root: Gitlab.config.gitolite.repos_path,
        upload_pack:  Gitlab.config.gitolite.upload_pack,
        receive_pack: Gitlab.config.gitolite.receive_pack
    
      }), at: '/', constraints: lambda { |request| /[-\/\w\.-]+\.git\//.match(request.path_info) }
    
    Riyad Preukschas's avatar
    Riyad Preukschas committed
      get 'help'                => 'help#index'
      get 'help/api'            => 'help#api'
      get 'help/markdown'       => 'help#markdown'
      get 'help/permissions'    => 'help#permissions'
    
      get 'help/public_access'  => 'help#public_access'
    
    Riyad Preukschas's avatar
    Riyad Preukschas committed
      get 'help/raketasks'      => 'help#raketasks'
      get 'help/ssh'            => 'help#ssh'
      get 'help/system_hooks'   => 'help#system_hooks'
      get 'help/web_hooks'      => 'help#web_hooks'
      get 'help/workflow'       => 'help#workflow'
    
      #
      # Public namespace
      #
      namespace :public do
        resources :projects, only: [:index]
        root to: "projects#index"
      end
    
    
    Nihad Abbasov's avatar
    Nihad Abbasov committed
      namespace :admin do
    
    Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
            put :team_update
    
            put :block
            put :unblock
    
    Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
          end
        end
    
        resources :groups, constraints: { id: /[^\/]+/ } do
          member do
            put :project_update
    
            put :project_teams_update
    
            delete :remove_project
    
        resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, except: [:new, :create] do
    
            get :team
            put :team_update
          end
        end
    
        resources :teams do #, constraints: { id: /[^\/]+/ } do end
          member do
            post :delegate_projects
            delete :relegate_project
            post :add_members
            delete :remove_member
          end
        end
    
        resources :team_members, only: [:edit, :update, :destroy]
        resources :hooks, only: [:index, :create, :destroy] do
    
          get :test
        end
    
        resource :resque, controller: 'resque', only: [:show]
        root to: "dashboard#index"
    
    gitlabhq's avatar
    gitlabhq committed
      end
    
    
      get "errors/githost"
    
    randx's avatar
    randx committed
    
      #
      # Profile Area
      #
    
      resource :profile, only: [:show, :update] do
        member do
          get :account
          get :history
          get :token
          get :design
    
          put :update_password
          put :reset_private_token
          put :update_username
        end
      end
    
      match "/u/:username" => "users#show", as: :user, constraints: { username: /.*/ }
    
    Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
    
    
    randx's avatar
    randx committed
      #
      # Dashboard Area
      #
    
      get "dashboard"                => "dashboard#index"
      get "dashboard/issues"         => "dashboard#issues"
      get "dashboard/merge_requests" => "dashboard#merge_requests"
    
    gitlabhq's avatar
    gitlabhq committed
    
    
      resources :groups, constraints: { id: /[^\/]+/ }, only: [:show, :new, :create] do
    
        member do
          get :issues
          get :merge_requests
          get :search
          get :people
    
          post :team_members
    
      resources :teams do
        member do
          get :issues
          get :merge_requests
          get :search
          post :delegate_projects
          delete :relegate_project
          put :update_access
        end
    
        scope module: :teams do
          resources :members
    
          resources :projects, only: [:index, :show] do
    
        collection do
          get :search
        end
      end
    
    
      resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
    
    Marin Jankovski's avatar
    Marin Jankovski committed
      devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations }
    
    gitlabhq's avatar
    gitlabhq committed
    
    
      resources :projects, constraints: { id: /[a-zA-Z.0-9_\-\/]+/ }, except: [:new, :create, :index], path: "/" do
    
    Nihad Abbasov's avatar
    Nihad Abbasov committed
        member do
    
    gitlabhq's avatar
    gitlabhq committed
          get "wall"
    
    Valery Sizov's avatar
    Valery Sizov committed
          get "graph"
    
    gitlabhq's avatar
    gitlabhq committed
        end
    
    gitlabhq's avatar
    gitlabhq committed
    
    
        resources :tree,    only: [:show, :edit, :update], constraints: {id: /.+/}
        resources :commit,  only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
        resources :commits, only: [:show], constraints: {id: /.+/}
        resources :compare, only: [:index, :create]
        resources :blame,   only: [:show], constraints: {id: /.+/}
        resources :blob,    only: [:show], constraints: {id: /.+/}
        match "/compare/:from...:to" => "compare#show", as: "compare",
                        :via => [:get, :post], constraints: {from: /.+/, to: /.+/}
    
    
        resources :wikis, only: [:show, :edit, :destroy, :create] do
    
    Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
          collection do
            get :pages
          end
    
    
    Valery Sizov's avatar
    Valery Sizov committed
          member do
    
    Valery Sizov's avatar
    Valery Sizov committed
          end
        end
    
        resource :repository do
          member do
    
            get "branches"
            get "tags"
    
    randx's avatar
    randx committed
            get "stats"
    
            get "archive"
    
        resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do
          member do
            get :test
          end
        end
    
    
    miks's avatar
    miks committed
        resources :deploy_keys
    
        resources :protected_branches, only: [:index, :create, :destroy]
    
    gitlabhq's avatar
    gitlabhq committed
            get "switch"
          end
    
    
            # tree viewer logs
            get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
    
            get "logs_tree/:path" => "refs#logs_tree",
    
              as: :logs_file,
              constraints: {
                id:   /[a-zA-Z.0-9\/_\-]+/,
                path: /.*/
    
    gitlabhq's avatar
    gitlabhq committed
          end
    
    gitlabhq's avatar
    gitlabhq committed
        end
    
    gitlabhq's avatar
    gitlabhq committed
    
    
        resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do
    
    randx's avatar
    randx committed
            get :automerge
    
            get :automerge_check
    
            get :branch_from
            get :branch_to
          end
    
        resources :hooks, only: [:index, :create, :destroy] do
    
        resources :team, controller: 'team_members', only: [:index]
    
        resources :milestones, except: [:destroy]
    
        resources :labels, only: [:index]
    
        resources :issues, except: [:destroy] do
    
    VSizov's avatar
    VSizov committed
          collection do
    
    randx's avatar
    randx committed
            post  :bulk_update
    
    VSizov's avatar
    VSizov committed
        end
    
    Dmitriy Zaporozhets's avatar
    Dmitriy Zaporozhets committed
        resources :team_members do
          collection do
    
            # Used for import team
            # from another project
            get :import
            post :apply_import
          end
        end
    
    
        resources :notes, only: [:index, :create, :destroy] do
    
          collection do
            post :preview
          end
        end
    
    gitlabhq's avatar
    gitlabhq committed
      end
    
    
      root to: "dashboard#index"
    
    gitlabhq's avatar
    gitlabhq committed
    end