rosa-build/config/routes.rb

421 lines
15 KiB
Ruby
Raw Normal View History

2011-03-09 13:13:36 +00:00
Rosa::Application.routes.draw do
2014-03-28 22:14:37 +00:00
2014-04-11 21:29:43 +01:00
# ActiveAdmin routes.
ActiveAdmin.routes(self)
namespace :admin do
constraints Rosa::Constraints::AdminAccess do
mount Resque::Server => 'resque'
end
end
2014-03-28 22:14:37 +00:00
# Redirect sitemap1.xml.gz file on AWS S3
match '/sitemap.xml.gz' => 'sitemap#show', via: [:get, :post, :head], as: :sitemap
match '/robots.txt' => 'sitemap#robots', via: [:get, :post, :head], as: :robots
2014-10-06 20:16:12 +01:00
resources :statistics, only: [:index]
2014-01-21 04:51:49 +00:00
resource :contact, only: [:new, :create, :sended] do
get '/' => 'contacts#new'
get :sended
end
2014-03-27 14:25:15 +00:00
devise_scope :user do
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
2014-01-21 04:51:49 +00:00
get 'users/sign_up' => 'users/registrations#new', as: :new_user_registration
post 'users' => 'users/registrations#create', as: :user_registration
2013-08-28 16:15:28 +01:00
end
2014-03-31 11:25:56 +01:00
devise_for :users, controllers: {
omniauth_callbacks: 'users/omniauth_callbacks',
confirmations: 'users/confirmations'
}, skip: [:registrations]
2014-03-12 15:59:57 +00:00
namespace :api do
namespace :v1 do
2014-01-21 04:51:49 +00:00
resources :advisories, only: [:index, :show, :create, :update]
resources :search, only: [:index]
resources :build_lists, only: [:index, :create, :show] do
member {
2012-12-26 18:35:13 +00:00
put :publish
put :reject_publish
2014-05-22 19:08:43 +01:00
put :rerun_tests
2012-12-26 18:35:13 +00:00
put :cancel
2013-01-30 20:04:19 +00:00
put :create_container
2013-11-18 18:12:50 +00:00
put :publish_into_testing
}
end
2014-04-07 22:30:01 +01:00
resources :arches, only: :index
2014-04-08 22:07:50 +01:00
resources :platforms, only: %i(index show update destroy create) do
collection {
get :platforms_for_build
get :allowed
}
member {
get :members
put :add_member
delete :remove_member
post :clone
put :clear
}
2014-01-21 04:51:49 +00:00
resources :maintainers, only: [ :index ]
end
2014-01-21 04:51:49 +00:00
resources :repositories, only: [:show, :update, :destroy] do
member {
get :projects
get :key_pair
get :packages
put :add_member
delete :remove_member
put :add_project
delete :remove_project
put :signatures
put :add_repo_lock_file
delete :remove_repo_lock_file
}
end
2014-01-21 04:51:49 +00:00
resources :projects, only: [:index, :show, :update, :create, :destroy] do
collection { get :get_id }
member {
2012-10-17 14:46:16 +01:00
post :fork
get :refs_list
get :members
put :add_member
delete :remove_member
put :update_member
}
2014-01-21 04:51:49 +00:00
resources :build_lists, only: :index
resources :issues, only: [:index, :create, :show, :update]
resources :pull_requests, only: [:index, :create, :show, :update] do
2013-06-21 14:45:28 +01:00
member {
get :commits
get :files
2013-06-24 16:18:17 +01:00
put :merge
2013-06-21 14:45:28 +01:00
}
end
end
2014-01-21 04:51:49 +00:00
resources :users, only: [:show]
get 'user' => 'users#show_current_user'
2014-01-21 04:51:49 +00:00
resource :user, only: [:update] do
member {
get :notifiers
put :notifiers
2013-04-12 17:52:56 +01:00
get '/issues' => 'issues#user_index'
2013-06-18 20:45:40 +01:00
get '/pull_requests' => 'pull_requests#user_index'
}
end
2014-01-21 04:51:49 +00:00
resources :groups, only: [:index, :show, :update, :create, :destroy] do
2012-10-16 12:49:07 +01:00
member {
get :members
put :add_member
delete :remove_member
put :update_member
2013-04-12 17:52:56 +01:00
get '/issues' => 'issues#group_index'
2013-06-18 20:45:40 +01:00
get '/pull_requests' => 'pull_requests#group_index'
2012-10-16 12:49:07 +01:00
}
end
2014-01-21 04:51:49 +00:00
resources :products, only: [:show, :update, :create, :destroy] do
resources :product_build_lists, only: :index
end
2014-01-21 04:51:49 +00:00
resources :product_build_lists, only: [:index, :show, :destroy, :create, :update] do
put :cancel, on: :member
end
2013-09-30 17:35:56 +01:00
resources :jobs do
collection do
get :shift
get :status
put :feedback
put :logs
2013-11-08 21:15:22 +00:00
put :statistics
2013-09-30 17:35:56 +01:00
end
end
2014-01-21 04:51:49 +00:00
#resources :ssh_keys, only: [:index, :create, :destroy]
2013-04-12 17:52:56 +01:00
get 'issues' => 'issues#all_index'
2013-06-18 20:45:40 +01:00
get 'pull_requests' => 'pull_requests#all_index'
end
end
2014-01-21 04:51:49 +00:00
resources :search, only: [:index]
2014-01-21 04:51:49 +00:00
get '/forbidden' => 'pages#forbidden', as: 'forbidden'
get '/terms-of-service' => 'pages#tos', as: 'tos'
get '/tour/:id' => 'pages#tour_inside', as: 'tour_inside', id: /projects|sources|builds/
#match '/invite.html' => redirect('/register_requests/new')
2014-01-21 04:51:49 +00:00
get '/activity_feeds.:format' => 'home#activity', as: 'atom_activity_feeds', format: /atom/
get '/issues' => 'home#issues'
get '/pull_requests' => 'home#pull_requests'
if APP_CONFIG['anonymous_access']
authenticated do
2014-01-21 04:51:49 +00:00
root to: 'home#activity'
2012-01-11 13:58:13 +00:00
end
unauthenticated do
root to: 'home#root', as: :authenticated_root
end
else
2014-01-21 04:51:49 +00:00
root to: 'home#activity'
end
2014-01-21 04:51:49 +00:00
resources :advisories, only: [:index, :show, :search] do
get :search, on: :collection
end
2014-01-21 04:51:49 +00:00
scope module: 'platforms' do
resources :platforms, constraints: {id: Platform::NAME_PATTERN} do
member do
put :regenerate_metadata
put :clear
get :clone
get :members
2014-11-11 23:50:15 +00:00
delete :remove_members
post :change_visibility
post :add_member
post :make_clone
get :advisories
end
2014-05-20 22:15:06 +01:00
resources :contents, only: %i(index) do
collection do
delete :remove_file
end
end
2014-06-26 18:20:26 +01:00
resources :mass_builds, only: [:create, :new, :index, :show] do
member do
post :cancel
post :publish
2014-06-26 18:20:26 +01:00
get '/:kind' => "mass_builds#get_list", as: :get_list, kind: /failed_builds_list|missed_projects_list|projects_list|tests_failed_builds_list|success_builds_list/
end
2012-06-27 15:06:59 +01:00
end
resources :repositories do
member do
2013-07-26 15:41:39 +01:00
get :add_project
2013-11-12 17:13:05 +00:00
put :add_project
get :remove_project
2013-07-26 15:41:39 +01:00
delete :remove_project
get :projects_list
2014-11-11 23:50:15 +00:00
delete :remove_members
2013-07-26 15:41:39 +01:00
post :add_member
put :regenerate_metadata
put :sync_lock_file
end
end
2014-01-21 04:51:49 +00:00
resources :key_pairs, only: [:create, :index, :destroy]
resources :tokens, only: [:create, :index, :show, :new] do
member do
post :withdraw
end
end
resources :products do
2014-01-21 04:51:49 +00:00
resources :product_build_lists, only: [:create, :destroy, :new, :show, :update] do
member {
get :log
put :cancel
}
2012-11-09 17:42:25 +00:00
end
2012-11-06 14:13:16 +00:00
collection { get :autocomplete_project }
end
2014-01-21 04:51:49 +00:00
resources :maintainers, only: [:index]
end
resources :product_build_lists, only: [:index, :show, :update]
end
2014-01-21 04:51:49 +00:00
resources :autocompletes, only: [] do
collection do
get :autocomplete_user_uname
get :autocomplete_extra_build_list
get :autocomplete_extra_mass_build
get :autocomplete_extra_repositories
2014-10-21 21:56:36 +01:00
get :autocomplete_user_or_group
end
end
2014-01-21 04:51:49 +00:00
scope module: 'users' do
get '/settings/ssh_keys' => 'ssh_keys#index', as: :ssh_keys
post '/settings/ssh_keys' => 'ssh_keys#create'
2014-01-21 04:51:49 +00:00
delete '/settings/ssh_keys/:id' => 'ssh_keys#destroy', as: :ssh_key
2014-01-21 04:51:49 +00:00
resources :settings, only: [] do
collection do
get :profile
2014-03-17 17:01:17 +00:00
patch :profile
get :private
2014-03-17 17:01:17 +00:00
patch :private
get :notifiers
patch :notifiers
2013-10-16 18:30:40 +01:00
put :reset_auth_token
end
2011-03-10 14:20:09 +00:00
end
2014-01-21 04:51:49 +00:00
resources :register_requests, only: [:new, :create], format: /ru|en/ #view support only two languages
get '/allowed' => 'users#allowed'
get '/check' => 'users#check'
get '/discover' => 'users#discover'
2011-03-10 11:35:46 +00:00
end
2012-04-11 19:29:08 +01:00
2014-01-21 04:51:49 +00:00
scope module: 'groups' do
get '/groups/new' => 'profile#new' # need to force next route exclude id: 'new'
2014-03-19 23:00:16 +00:00
get '/groups/:id' => redirect("/%{id}"), as: :profile_group # override default group show route
2014-01-21 04:51:49 +00:00
resources :groups, controller: 'profile' do
delete :remove_user, on: :member
resources :members, only: [:index] do
collection do
2014-11-11 23:50:15 +00:00
post :add
put :update
delete :remove
end
end
end
end
2014-01-21 04:51:49 +00:00
scope module: 'projects' do
resources :build_lists, only: [:index, :show] do
member do
put :cancel
2013-01-25 17:24:46 +00:00
put :create_container
2014-05-21 23:58:13 +01:00
put :rerun_tests
get :log
patch :publish
put :reject_publish
2013-11-01 17:11:59 +00:00
put :publish_into_testing
put :update_type
get :dependent_projects
post :dependent_projects
end
end
2012-04-19 18:35:35 +01:00
2014-01-21 04:51:49 +00:00
resources :projects, only: [:index, :new, :create] do
2013-11-13 22:01:12 +00:00
collection do
post :run_mass_import
get :mass_import
end
end
scope ':name_with_owner', constraints: { name_with_owner: Project::OWNER_AND_NAME_REGEXP } do # project
2014-01-21 04:51:49 +00:00
scope as: 'project' do
resources :wiki do
collection do
2014-01-21 04:51:49 +00:00
match '_history' => 'wiki#wiki_history', as: :history, via: :get
match '_access' => 'wiki#git', as: :git, via: :get
match '_revert/:sha1/:sha2' => 'wiki#revert_wiki', as: :revert, via: [:get, :post]
match '_compare' => 'wiki#compare_wiki', as: :compare, via: :post
#match '_compare/:versions' => 'wiki#compare_wiki', versions: /.*/, as: :compare_versions, via: :get
match '_compare/:versions' => 'wiki#compare_wiki', versions: /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, as: :compare_versions, via: :get
post :preview
get :search
get :pages
end
member do
get :history
get :edit
2014-01-21 04:51:49 +00:00
match 'revert/:sha1/:sha2' => 'wiki#revert', as: :revert_page, via: [:get, :post]
match ':ref' => 'wiki#show', as: :versioned, via: :get
post :compare
2014-01-21 04:51:49 +00:00
#match 'compare/*versions' => 'wiki#compare', as: :compare_versions, via: :get
match 'compare/:versions' => 'wiki#compare', versions: /([a-f0-9\^]{6,40})(\.\.\.[a-f0-9\^]{6,40})/, as: :compare_versions, via: :get
end
end
2014-01-21 04:51:49 +00:00
resources :issues, except: [:destroy, :edit] do
resources :comments, only: [:edit, :create, :update, :destroy]
resources :subscribes, only: [:create, :destroy]
collection do
post :create_label
get :search_collaborators
end
end
get 'pull_requests' => 'issues#pull_requests', as: :pull_requests
get 'labels' => 'issues#labels', as: :labels
post 'labels/:label_id' => 'issues#destroy_label', as: :issues_delete_label
post 'labels/:label_id/update' => 'issues#update_label', as: :issues_update_label
2014-01-21 04:51:49 +00:00
resources :build_lists, only: [:index, :new, :create] do
get :list, on: :collection
end
resources :collaborators do
2014-01-21 04:51:49 +00:00
get :find, on: :collection
2012-05-14 18:09:18 +01:00
end
2014-01-21 04:51:49 +00:00
resources :hooks, except: :show
resources :pull_requests, except: [:index, :destroy] do
2014-01-21 04:51:49 +00:00
get :autocomplete_to_project, on: :collection
put :merge, on: :member
2012-05-17 17:47:36 +01:00
end
2014-01-21 04:51:49 +00:00
post '/preview' => 'projects#preview', as: 'md_preview'
post 'refs_list' => 'projects#refs_list', as: 'refs_list'
2014-02-18 19:16:23 +00:00
put 'schedule' => 'projects#schedule'
2012-05-10 17:57:59 +01:00
end
# Resource
2014-01-21 04:51:49 +00:00
get '/autocomplete_maintainers' => 'projects#autocomplete_maintainers', as: :autocomplete_maintainers
get '/modify' => 'projects#edit', as: :edit_project
2014-03-24 18:30:12 +00:00
patch '/' => 'projects#update'
delete '/' => 'projects#destroy'
# Member
2014-01-21 04:51:49 +00:00
post '/fork' => 'projects#fork', as: :fork_project
get '/possible_forks' => 'projects#possible_forks', as: :possible_forks_project
get '/sections' => 'projects#sections', as: :sections_project
2014-11-12 17:30:27 +00:00
patch '/sections' => 'projects#sections'
2014-01-21 04:51:49 +00:00
delete '/remove_user' => 'projects#remove_user', as: :remove_user_project
# constraints treeish: /[\w\-\.]+(\/[\w\-\.]+)?/ do
constraints treeish: /.+/ do
constraints Rosa::Constraints::Treeish do
# Tree
2014-01-21 04:51:49 +00:00
get '/' => "git/trees#show", as: :project
get '/tree/:treeish' => "git/trees#show", as: :tree, format: false
2013-02-12 16:35:14 +00:00
# Tags
2014-01-21 04:51:49 +00:00
get '/tags' => "git/trees#tags", as: :tags
2013-02-12 16:35:14 +00:00
# Branches
2014-01-21 04:51:49 +00:00
get '/branches' => "git/trees#branches", as: :branches
2014-03-13 16:35:00 +00:00
get '/branches/:treeish' => "git/trees#branches", as: :branch
delete '/branches/:treeish' => "git/trees#destroy", as: :destroy_branch
put '/branches/:treeish' => "git/trees#restore_branch", as: :restore_branch
post '/branches' => "git/trees#create", as: :create_branch
# Commits
2014-01-21 04:51:49 +00:00
get '/commits/:treeish(/*path)' => "git/commits#index", as: :commits, format: false
get '/commit/:id(.:format)' => "git/commits#show", as: :commit
# Commit comments
2014-01-21 04:51:49 +00:00
post '/commit/:commit_id/comments(.:format)' => "comments#create", as: :project_commit_comments
get '/commit/:commit_id/comments/:id(.:format)' => "comments#edit", as: :edit_project_commit_comment
2014-04-15 10:14:58 +01:00
patch '/commit/:commit_id/comments/:id(.:format)' => "comments#update", as: :project_commit_comment
delete '/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
2014-01-21 04:51:49 +00:00
get '/commit/:commit_id/add_line_comments(.:format)' => "comments#new_line", as: :new_line_commit_comment
# Commit subscribes
2014-01-21 04:51:49 +00:00
post '/commit/:commit_id/subscribe' => "commit_subscribes#create", as: :subscribe_commit
delete '/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", as: :unsubscribe_commit
# Editing files
2014-01-21 04:51:49 +00:00
get '/edit/:treeish/*path' => "git/blobs#edit", as: :edit_blob, format: false
put '/edit/:treeish/*path' => "git/blobs#update", format: false
# Blobs
2014-01-21 04:51:49 +00:00
get '/blob/:treeish/*path' => "git/blobs#show", as: :blob, format: false
# Blame
2014-01-21 04:51:49 +00:00
get '/blame/:treeish/*path' => "git/blobs#blame", as: :blame, format: false
# Raw
2014-01-21 04:51:49 +00:00
get '/raw/:treeish/*path' => "git/blobs#raw", as: :raw, format: false
# Archive
2014-01-21 04:51:49 +00:00
get '/archive/:treeish.:format' => "git/trees#archive", as: :archive, format: /zip|tar\.gz/
# Git diff
2014-01-21 04:51:49 +00:00
get '/diff/:diff' => "git/commits#diff", as: :diff, format: false, diff: /.*/
end
2012-07-03 13:05:27 +01:00
end
end
end
scope ':uname' do # project owner profile
constraints Rosa::Constraints::Owner.new(User) do
2014-01-21 04:51:49 +00:00
get '/' => 'users/profile#show', as: :user
end
constraints Rosa::Constraints::Owner.new(Group, true) do
2014-03-19 23:00:16 +00:00
get '/' => 'groups/profile#show'
end
end
# As of Rails 3.0.1, using rescue_from in your ApplicationController to
# recover from a routing error is broken!
# see: https://rails.lighthouseapp.com/projects/8994/tickets/4444-can-no-longer-rescue_from-actioncontrollerroutingerror
get '*a', to: 'application#render_404'
2011-03-09 13:13:36 +00:00
end