2016-05-28 19:21:02 +01:00
|
|
|
require 'sidekiq/web'
|
|
|
|
require 'sidekiq-scheduler/web'
|
|
|
|
|
2015-06-03 22:54:25 +01:00
|
|
|
Rails.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)
|
|
|
|
|
2023-03-07 16:10:27 +00:00
|
|
|
# namespace :admin do
|
|
|
|
# constraints Rosa::Constraints::AdminAccess do
|
|
|
|
# mount Sidekiq::Web => 'sidekiq'
|
|
|
|
# end
|
|
|
|
# end
|
2014-04-11 21:29:43 +01:00
|
|
|
|
2014-03-28 22:14:37 +00:00
|
|
|
match '/robots.txt' => 'sitemap#robots', via: [:get, :post, :head], as: :robots
|
|
|
|
|
2014-10-06 20:16:12 +01:00
|
|
|
resources :statistics, only: [:index]
|
2012-07-20 17:06:31 +01:00
|
|
|
|
2014-03-27 14:25:15 +00:00
|
|
|
devise_scope :user do
|
2016-09-25 23:40:53 +01: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
|
2012-05-02 10:18:07 +01:00
|
|
|
|
2014-03-31 11:25:56 +01:00
|
|
|
devise_for :users, controllers: {
|
|
|
|
confirmations: 'users/confirmations'
|
|
|
|
}, skip: [:registrations]
|
2014-03-12 15:59:57 +00:00
|
|
|
|
2012-07-31 08:35:27 +01:00
|
|
|
namespace :api do
|
2015-02-19 19:28:51 +00:00
|
|
|
namespace :v1, constraints: { format: 'json' }, defaults: { format: 'json' } do
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :search, only: [:index]
|
|
|
|
resources :build_lists, only: [:index, :create, :show] do
|
2012-07-31 08:35:27 +01:00
|
|
|
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
|
2012-07-31 08:35:27 +01:00
|
|
|
}
|
|
|
|
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
|
2012-10-09 16:06:27 +01:00
|
|
|
collection {
|
|
|
|
get :platforms_for_build
|
2013-06-26 13:04:06 +01:00
|
|
|
get :allowed
|
2012-10-09 16:06:27 +01:00
|
|
|
}
|
|
|
|
member {
|
|
|
|
get :members
|
2012-10-09 17:23:48 +01:00
|
|
|
put :add_member
|
2012-10-09 18:07:10 +01:00
|
|
|
delete :remove_member
|
2012-10-10 16:13:14 +01:00
|
|
|
post :clone
|
|
|
|
put :clear
|
2012-10-09 16:06:27 +01:00
|
|
|
}
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :maintainers, only: [ :index ]
|
2012-10-08 19:02:44 +01:00
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :repositories, only: [:show, :update, :destroy] do
|
2012-10-14 13:00:49 +01:00
|
|
|
member {
|
2013-07-26 16:38:39 +01:00
|
|
|
get :projects
|
|
|
|
get :key_pair
|
2014-01-20 21:24:22 +00:00
|
|
|
get :packages
|
2013-07-26 16:38:39 +01:00
|
|
|
put :add_member
|
|
|
|
delete :remove_member
|
|
|
|
put :add_project
|
|
|
|
delete :remove_project
|
|
|
|
put :signatures
|
2013-07-29 13:24:41 +01:00
|
|
|
put :add_repo_lock_file
|
2013-07-29 14:14:55 +01:00
|
|
|
delete :remove_repo_lock_file
|
2012-10-14 13:00:49 +01:00
|
|
|
}
|
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :projects, only: [:index, :show, :update, :create, :destroy] do
|
2012-08-28 17:57:12 +01:00
|
|
|
collection { get :get_id }
|
2012-10-11 17:27:17 +01:00
|
|
|
member {
|
2015-02-04 12:02:45 +00:00
|
|
|
get :members
|
|
|
|
put :add_member
|
2012-10-17 11:35:33 +01:00
|
|
|
delete :remove_member
|
2015-02-04 12:02:45 +00:00
|
|
|
put :update_member
|
2012-10-11 17:27:17 +01:00
|
|
|
}
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :build_lists, only: :index
|
2012-08-28 17:57:12 +01:00
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :users, only: [:show]
|
2012-10-15 16:47:42 +01:00
|
|
|
get 'user' => 'users#show_current_user'
|
2014-01-21 04:51:49 +00:00
|
|
|
resource :user, only: [:update] do
|
2012-10-15 15:06:08 +01:00
|
|
|
member {
|
|
|
|
get :notifiers
|
|
|
|
put :notifiers
|
|
|
|
}
|
|
|
|
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
|
|
|
|
}
|
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :products, only: [:show, :update, :create, :destroy] do
|
|
|
|
resources :product_build_lists, only: :index
|
2013-02-06 19:05:49 +00:00
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :product_build_lists, only: [:index, :show, :destroy, :create, :update] do
|
|
|
|
put :cancel, on: :member
|
2013-02-06 19:05:49 +00:00
|
|
|
end
|
2013-09-30 17:35:56 +01:00
|
|
|
|
|
|
|
resources :jobs do
|
|
|
|
collection do
|
|
|
|
get :shift
|
|
|
|
get :status
|
|
|
|
put :feedback
|
2013-10-22 18:48:00 +01:00
|
|
|
put :logs
|
2013-11-08 21:15:22 +00:00
|
|
|
put :statistics
|
2013-09-30 17:35:56 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-31 08:35:27 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :search, only: [:index]
|
2012-05-02 10:18:07 +01:00
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
get '/forbidden' => 'pages#forbidden', as: 'forbidden'
|
|
|
|
get '/terms-of-service' => 'pages#tos', as: 'tos'
|
2013-05-15 18:28:39 +01:00
|
|
|
|
2012-05-03 15:08:02 +01:00
|
|
|
if APP_CONFIG['anonymous_access']
|
|
|
|
authenticated do
|
2016-04-29 15:10:30 +01:00
|
|
|
root to: 'home#index'
|
2012-01-11 13:58:13 +00:00
|
|
|
end
|
2014-03-11 07:39:25 +00:00
|
|
|
unauthenticated do
|
2016-03-20 09:24:23 +00:00
|
|
|
root to: 'statistics#index', as: :unauthenticated_root
|
|
|
|
#devise_scope :user do
|
|
|
|
# root to: 'devise/sessions#new', as: :unauthenticated_root
|
|
|
|
#end
|
2014-03-11 07:39:25 +00:00
|
|
|
end
|
2012-05-03 15:08:02 +01:00
|
|
|
else
|
2016-04-29 15:10:30 +01:00
|
|
|
root to: 'home#index'
|
2012-03-30 12:26:28 +01:00
|
|
|
end
|
2011-12-09 23:40:13 +00:00
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
scope module: 'platforms' do
|
|
|
|
resources :platforms, constraints: {id: Platform::NAME_PATTERN} do
|
2012-03-31 00:37:54 +01:00
|
|
|
member do
|
2013-08-23 19:58:29 +01:00
|
|
|
put :regenerate_metadata
|
2013-03-06 12:17:42 +00:00
|
|
|
put :clear
|
2012-05-02 10:18:07 +01:00
|
|
|
get :clone
|
|
|
|
get :members
|
2014-11-11 23:50:15 +00:00
|
|
|
delete :remove_members
|
2013-06-26 10:00:51 +01:00
|
|
|
post :change_visibility
|
|
|
|
post :add_member
|
2012-05-02 10:18:07 +01:00
|
|
|
post :make_clone
|
|
|
|
end
|
2012-07-02 15:50:47 +01:00
|
|
|
|
2014-05-20 22:15:06 +01:00
|
|
|
resources :contents, only: %i(index) do
|
|
|
|
collection do
|
|
|
|
delete :remove_file
|
|
|
|
end
|
|
|
|
end
|
2013-07-05 17:08:09 +01:00
|
|
|
|
2014-06-26 18:20:26 +01:00
|
|
|
resources :mass_builds, only: [:create, :new, :index, :show] do
|
2012-07-02 15:50:47 +01:00
|
|
|
member do
|
2012-07-03 15:34:07 +01:00
|
|
|
post :cancel
|
2013-03-21 14:41:45 +00:00
|
|
|
post :publish
|
2016-03-24 15:59:12 +00:00
|
|
|
get 'show_fail_reason(/:page)' => 'mass_builds#show_fail_reason', as: :show_fail_reason, page: /[0-9]+/, defaults: { page: '1' }
|
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/
|
2012-07-02 15:50:47 +01:00
|
|
|
end
|
2012-06-27 15:06:59 +01:00
|
|
|
end
|
2012-07-02 15:50:47 +01:00
|
|
|
|
2016-06-23 15:20:36 +01:00
|
|
|
resources :repositories, only: [:create, :new, :show, :edit, :update] do
|
2012-05-02 10:18:07 +01:00
|
|
|
member do
|
2016-05-22 13:25:00 +01:00
|
|
|
get :manage_projects
|
2013-11-12 17:13:05 +00:00
|
|
|
put :add_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
|
2013-07-29 13:24:41 +01:00
|
|
|
put :sync_lock_file
|
2012-05-02 10:18:07 +01:00
|
|
|
end
|
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :tokens, only: [:create, :index, :show, :new] do
|
2013-06-25 08:00:20 +01:00
|
|
|
member do
|
|
|
|
post :withdraw
|
|
|
|
end
|
|
|
|
end
|
2012-05-02 10:18:07 +01:00
|
|
|
resources :products do
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :product_build_lists, only: [:create, :destroy, :new, :show, :update] do
|
2012-11-12 13:22:19 +00:00
|
|
|
member {
|
|
|
|
get :log
|
2012-12-06 14:41:24 +00:00
|
|
|
put :cancel
|
2012-11-12 13:22:19 +00:00
|
|
|
}
|
2012-11-09 17:42:25 +00:00
|
|
|
end
|
2016-09-25 23:40:53 +01:00
|
|
|
collection {
|
|
|
|
get :autocomplete_project
|
2016-05-22 13:25:00 +01:00
|
|
|
get :project_versions
|
|
|
|
}
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :maintainers, only: [:index]
|
2011-10-27 14:04:03 +01:00
|
|
|
end
|
2012-05-02 10:18:07 +01:00
|
|
|
|
2014-04-09 19:44:19 +01:00
|
|
|
resources :product_build_lists, only: [:index, :show, :update]
|
2011-10-27 14:04:03 +01:00
|
|
|
end
|
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :autocompletes, only: [] do
|
2012-10-02 17:54:55 +01:00
|
|
|
collection do
|
|
|
|
get :autocomplete_user_uname
|
2013-06-04 20:59:08 +01:00
|
|
|
get :autocomplete_extra_build_list
|
2014-06-27 20:08:14 +01:00
|
|
|
get :autocomplete_extra_mass_build
|
2013-06-04 20:59:08 +01:00
|
|
|
get :autocomplete_extra_repositories
|
2014-10-21 21:56:36 +01:00
|
|
|
get :autocomplete_user_or_group
|
2012-10-02 17:54:55 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
scope module: 'users' do
|
2013-03-07 08:06:34 +00:00
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
resources :settings, only: [] do
|
2012-02-27 16:10:12 +00:00
|
|
|
collection do
|
2012-05-02 10:18:07 +01:00
|
|
|
get :profile
|
2014-03-17 17:01:17 +00:00
|
|
|
patch :profile
|
2012-05-02 10:18:07 +01:00
|
|
|
get :private
|
2014-03-17 17:01:17 +00:00
|
|
|
patch :private
|
2012-05-02 10:18:07 +01:00
|
|
|
get :notifiers
|
2014-03-14 22:54:04 +00:00
|
|
|
patch :notifiers
|
2015-02-10 22:08:39 +00:00
|
|
|
get :builds_settings
|
|
|
|
patch :builds_settings
|
2013-10-16 18:30:40 +01:00
|
|
|
put :reset_auth_token
|
2012-02-27 16:10:12 +00:00
|
|
|
end
|
2011-03-10 14:20:09 +00:00
|
|
|
end
|
2013-03-07 08:06:34 +00:00
|
|
|
|
|
|
|
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
|
2012-05-02 10:18:07 +01:00
|
|
|
collection do
|
2014-11-11 23:50:15 +00:00
|
|
|
post :add
|
|
|
|
put :update
|
2012-05-02 10:18:07 +01:00
|
|
|
delete :remove
|
|
|
|
end
|
|
|
|
end
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-21 04:51:49 +00:00
|
|
|
scope module: 'projects' do
|
|
|
|
resources :build_lists, only: [:index, :show] do
|
2012-05-02 10:18:07 +01:00
|
|
|
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
|
2012-08-17 09:23:49 +01:00
|
|
|
get :log
|
2014-03-24 17:54:05 +00:00
|
|
|
patch :publish
|
2013-06-10 12:26:12 +01:00
|
|
|
put :reject_publish
|
2013-11-01 17:11:59 +00:00
|
|
|
put :publish_into_testing
|
2014-07-23 19:02:51 +01:00
|
|
|
get :dependent_projects
|
|
|
|
post :dependent_projects
|
2012-05-02 10:18:07 +01:00
|
|
|
end
|
|
|
|
end
|
2012-04-19 18:35:35 +01:00
|
|
|
|
2016-04-29 15:10:30 +01:00
|
|
|
resources :projects, only: [:index, :new, :create]
|
|
|
|
|
2015-06-15 21:46:17 +01:00
|
|
|
scope '*name_with_owner', name_with_owner: Project::OWNER_AND_NAME_REGEXP do # project
|
2014-01-21 04:51:49 +00:00
|
|
|
scope as: 'project' do
|
2016-04-29 15:10:30 +01:00
|
|
|
resources :build_lists, only: [:index, :new, :create]
|
2014-02-18 19:16:23 +00:00
|
|
|
put 'schedule' => 'projects#schedule'
|
2012-05-10 17:57:59 +01:00
|
|
|
end
|
|
|
|
|
2012-04-19 20:45:50 +01:00
|
|
|
# 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
|
2016-04-29 15:10:30 +01:00
|
|
|
patch '/' => 'projects#update', as: :project
|
2012-04-19 20:45:50 +01:00
|
|
|
delete '/' => 'projects#destroy'
|
2015-12-08 16:44:26 +00:00
|
|
|
|
2016-03-20 09:24:23 +00:00
|
|
|
get '/commit/:sha' => 'projects#commit', as: :commit
|
|
|
|
get '/diff/:diff' => 'projects#diff', as: :diff, format: false, diff: /.*/
|
2012-04-19 20:45:50 +01:00
|
|
|
end
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
|
|
|
|
2012-05-03 22:52:56 +01:00
|
|
|
scope ':uname' do # project owner profile
|
2012-07-17 09:02:56 +01:00
|
|
|
constraints Rosa::Constraints::Owner.new(User) do
|
2014-01-21 04:51:49 +00:00
|
|
|
get '/' => 'users/profile#show', as: :user
|
2012-05-03 22:52:56 +01:00
|
|
|
end
|
2012-07-17 09:02:56 +01:00
|
|
|
constraints Rosa::Constraints::Owner.new(Group, true) do
|
2014-03-19 23:00:16 +00:00
|
|
|
get '/' => 'groups/profile#show'
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
|
|
|
end
|
2013-03-15 13:35:32 +00:00
|
|
|
|
|
|
|
# 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
|
2014-03-11 07:39:25 +00:00
|
|
|
get '*a', to: 'application#render_404'
|
2011-03-09 13:13:36 +00:00
|
|
|
end
|