2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2011-03-09 13:13:36 +00:00
|
|
|
Rosa::Application.routes.draw do
|
2012-07-20 17:06:31 +01:00
|
|
|
resource :contact, :only => [:new, :create, :sended] do
|
|
|
|
get '/' => 'contacts#new'
|
|
|
|
get :sended
|
|
|
|
end
|
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
devise_scope :users do
|
2011-10-11 21:56:51 +01:00
|
|
|
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
|
|
|
|
end
|
2012-02-08 14:01:00 +00:00
|
|
|
devise_for :users, :controllers => {:omniauth_callbacks => 'users/omniauth_callbacks'}
|
2012-05-02 10:18:07 +01:00
|
|
|
|
2012-07-31 08:35:27 +01:00
|
|
|
namespace :api do
|
|
|
|
namespace :v1 do
|
2012-10-18 15:17:50 +01:00
|
|
|
resources :advisories, :only => [:index, :show, :create, :update]
|
2012-11-21 12:09:01 +00:00
|
|
|
resources :search, :only => [:index]
|
2012-07-31 08:35:27 +01:00
|
|
|
resources :build_lists, :only => [:index, :create, :show] do
|
|
|
|
member {
|
|
|
|
get :publish
|
|
|
|
get :reject_publish
|
|
|
|
get :cancel
|
|
|
|
}
|
|
|
|
end
|
2012-10-04 13:45:49 +01:00
|
|
|
resources :arches, :only => [:index]
|
2012-10-10 18:45:56 +01:00
|
|
|
resources :platforms, :only => [:index, :show, :update, :destroy, :create] do
|
2012-10-09 16:06:27 +01:00
|
|
|
collection {
|
|
|
|
get :platforms_for_build
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|
2012-11-26 11:32:23 +00:00
|
|
|
resources :maintainers, :only => [ :index ]
|
2012-10-08 19:02:44 +01:00
|
|
|
end
|
2012-10-14 13:00:49 +01:00
|
|
|
resources :repositories, :only => [:show, :update, :destroy] do
|
|
|
|
member {
|
2012-10-19 14:52:36 +01:00
|
|
|
get :projects
|
2012-10-14 13:00:49 +01:00
|
|
|
put :add_member
|
|
|
|
delete :remove_member
|
2012-10-14 14:38:06 +01:00
|
|
|
put :add_project
|
|
|
|
delete :remove_project
|
|
|
|
put :signatures
|
2012-10-14 13:00:49 +01:00
|
|
|
}
|
|
|
|
end
|
2012-10-17 11:35:33 +01: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 {
|
2012-10-17 14:46:16 +01:00
|
|
|
post :fork
|
2012-10-11 17:27:17 +01:00
|
|
|
get :refs_list
|
2012-10-17 11:35:33 +01:00
|
|
|
get :members
|
|
|
|
put :add_member
|
|
|
|
delete :remove_member
|
|
|
|
put :update_member
|
2012-10-11 17:27:17 +01:00
|
|
|
}
|
2012-11-29 17:52:15 +00:00
|
|
|
resources :build_lists, :only => :index
|
2012-08-28 17:57:12 +01:00
|
|
|
end
|
2012-10-15 10:45:00 +01:00
|
|
|
resources :users, :only => [:show]
|
2012-10-15 16:47:42 +01:00
|
|
|
get 'user' => 'users#show_current_user'
|
|
|
|
resource :user, :only => [:update] do
|
2012-10-15 15:06:08 +01:00
|
|
|
member {
|
|
|
|
get :notifiers
|
|
|
|
put :notifiers
|
|
|
|
}
|
|
|
|
end
|
2012-10-16 12:49:07 +01:00
|
|
|
resources :groups, :only => [:index, :show, :update, :create, :destroy] do
|
|
|
|
member {
|
|
|
|
get :members
|
|
|
|
put :add_member
|
|
|
|
delete :remove_member
|
|
|
|
put :update_member
|
|
|
|
}
|
|
|
|
end
|
2012-07-31 08:35:27 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
resources :search, :only => [:index]
|
|
|
|
|
2012-07-20 17:06:31 +01: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/
|
2012-08-30 11:30:07 +01:00
|
|
|
match '/invite.html' => redirect('/register_requests/new')
|
2012-05-02 10:18:07 +01:00
|
|
|
|
2012-05-03 15:08:02 +01:00
|
|
|
get '/activity_feeds.:format' => 'activity_feeds#index', :as => 'atom_activity_feeds', :format => /atom/
|
|
|
|
if APP_CONFIG['anonymous_access']
|
|
|
|
authenticated do
|
|
|
|
root :to => 'activity_feeds#index'
|
2012-01-11 13:58:13 +00:00
|
|
|
end
|
2012-05-03 15:08:02 +01:00
|
|
|
root :to => 'pages#root'
|
|
|
|
else
|
|
|
|
root :to => 'activity_feeds#index'
|
2012-03-30 12:26:28 +01:00
|
|
|
end
|
2011-12-09 23:40:13 +00:00
|
|
|
|
2012-05-03 22:52:56 +01:00
|
|
|
namespace :admin do
|
|
|
|
resources :users do
|
|
|
|
get :list, :on => :collection
|
|
|
|
end
|
|
|
|
resources :register_requests, :only => [:index] do
|
|
|
|
put :update, :on => :collection
|
2012-03-31 00:37:54 +01:00
|
|
|
member do
|
2012-05-03 22:52:56 +01:00
|
|
|
get :approve
|
|
|
|
get :reject
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
2011-10-27 14:04:03 +01:00
|
|
|
end
|
2012-07-25 19:05:25 +01:00
|
|
|
resources :flash_notifies
|
2012-05-03 22:52:56 +01:00
|
|
|
resources :event_logs, :only => :index
|
2012-07-17 09:02:56 +01:00
|
|
|
constraints Rosa::Constraints::AdminAccess do
|
2012-06-09 17:04:06 +01:00
|
|
|
mount Resque::Server => 'resque'
|
|
|
|
end
|
2011-10-27 14:04:03 +01:00
|
|
|
end
|
|
|
|
|
2012-07-03 23:52:13 +01:00
|
|
|
resources :advisories, :only => [:index, :show, :search] do
|
|
|
|
get :search, :on => :collection
|
|
|
|
end
|
2012-05-05 18:18:29 +01:00
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
scope :module => 'platforms' do
|
|
|
|
resources :platforms do
|
|
|
|
resources :private_users, :except => [:show, :destroy, :update]
|
2012-03-31 00:37:54 +01:00
|
|
|
member do
|
2012-06-21 08:15:20 +01:00
|
|
|
post :clear
|
2012-05-02 10:18:07 +01:00
|
|
|
get :clone
|
|
|
|
get :members
|
2012-09-12 20:32:51 +01:00
|
|
|
post :remove_members # fixme: change post to delete
|
2012-05-02 10:18:07 +01:00
|
|
|
delete :remove_member
|
|
|
|
post :add_member
|
|
|
|
post :make_clone
|
2012-06-04 20:49:20 +01:00
|
|
|
get :advisories
|
2012-05-02 10:18:07 +01:00
|
|
|
end
|
2012-07-02 15:50:47 +01:00
|
|
|
|
2012-07-03 15:34:07 +01:00
|
|
|
resources :mass_builds, :only => [:create, :index] do
|
2012-07-02 15:50:47 +01:00
|
|
|
member do
|
|
|
|
get :failed_builds_list
|
2012-07-03 15:34:07 +01:00
|
|
|
post :cancel
|
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
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
resources :repositories do
|
|
|
|
member do
|
|
|
|
get :add_project
|
|
|
|
delete :remove_project
|
|
|
|
get :projects_list
|
2012-09-12 20:32:51 +01:00
|
|
|
post :remove_members # fixme: change post to delete
|
2012-09-11 16:30:14 +01:00
|
|
|
delete :remove_member
|
|
|
|
post :add_member
|
2012-05-02 10:18:07 +01:00
|
|
|
end
|
|
|
|
end
|
2012-07-13 12:18:12 +01:00
|
|
|
resources :key_pairs, :only => [:create, :index, :destroy]
|
2012-05-02 10:18:07 +01:00
|
|
|
resources :products do
|
2012-11-09 17:42:25 +00:00
|
|
|
resources :product_build_lists, :only => [:create, :destroy, :new, :show] do
|
2012-11-12 13:22:19 +00:00
|
|
|
member {
|
|
|
|
get :log
|
|
|
|
get :stop
|
|
|
|
}
|
2012-11-09 17:42:25 +00:00
|
|
|
end
|
2012-11-06 14:13:16 +00:00
|
|
|
collection { get :autocomplete_project }
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
2012-05-29 13:40:25 +01:00
|
|
|
resources :maintainers, :only => [:index]
|
2011-10-27 14:04:03 +01:00
|
|
|
end
|
2012-05-02 10:18:07 +01:00
|
|
|
match '/private/:platform_name/*file_path' => 'privates#show'
|
|
|
|
|
|
|
|
resources :product_build_lists, :only => [:index]
|
2012-06-28 16:54:58 +01:00
|
|
|
match 'product_status', :to => 'product_build_lists#status_build'
|
2011-10-27 14:04:03 +01:00
|
|
|
end
|
|
|
|
|
2012-10-02 17:54:55 +01:00
|
|
|
resources :autocompletes, :only => [] do
|
|
|
|
collection do
|
|
|
|
get :autocomplete_user_uname
|
|
|
|
get :autocomplete_group_uname
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
scope :module => 'users' do
|
|
|
|
resources :settings, :only => [] do
|
2012-02-27 16:10:12 +00:00
|
|
|
collection do
|
2012-05-02 10:18:07 +01:00
|
|
|
get :profile
|
|
|
|
put :profile
|
|
|
|
get :private
|
|
|
|
put :private
|
|
|
|
get :notifiers
|
|
|
|
put :notifiers
|
2012-02-27 16:10:12 +00:00
|
|
|
end
|
2011-03-10 14:20:09 +00:00
|
|
|
end
|
2012-04-23 18:06:14 +01:00
|
|
|
|
2012-05-18 17:54:57 +01:00
|
|
|
resources :register_requests, :only => [:new, :create], :format => /ru|en/ #view support only two languages
|
2011-03-10 11:35:46 +00:00
|
|
|
end
|
2012-04-11 19:29:08 +01:00
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
scope :module => 'groups' do
|
2012-05-03 22:52:56 +01:00
|
|
|
get '/groups/new' => 'profile#new' # need to force next route exclude :id => 'new'
|
|
|
|
get '/groups/:id' => redirect("/%{id}"), :as => :profile_group # override default group show route
|
2012-05-02 10:18:07 +01:00
|
|
|
resources :groups, :controller => 'profile' do
|
|
|
|
delete :remove_user, :on => :member
|
|
|
|
resources :members, :only => [:index] do
|
|
|
|
collection do
|
|
|
|
post :add
|
|
|
|
post :update
|
|
|
|
delete :remove
|
|
|
|
end
|
|
|
|
end
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
scope :module => 'projects' do
|
|
|
|
# Core callbacks
|
|
|
|
match 'build_lists/publish_build', :to => "build_lists#publish_build"
|
|
|
|
match 'build_lists/status_build', :to => "build_lists#status_build"
|
|
|
|
match 'build_lists/post_build', :to => "build_lists#post_build"
|
|
|
|
match 'build_lists/pre_build', :to => "build_lists#pre_build"
|
|
|
|
match 'build_lists/circle_build', :to => "build_lists#circle_build"
|
|
|
|
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
|
2012-03-31 00:37:54 +01:00
|
|
|
|
2012-05-04 18:29:04 +01:00
|
|
|
resources :build_lists, :only => [:index, :show, :update] do
|
2012-05-02 10:18:07 +01:00
|
|
|
member do
|
|
|
|
put :cancel
|
2012-08-17 09:23:49 +01:00
|
|
|
get :log
|
2012-05-02 10:18:07 +01:00
|
|
|
end
|
|
|
|
collection { post :search }
|
|
|
|
end
|
2012-04-19 18:35:35 +01:00
|
|
|
|
2012-05-02 10:18:07 +01:00
|
|
|
resources :projects, :only => [:index, :new, :create]
|
2012-05-14 14:24:01 +01:00
|
|
|
scope ':owner_name/:project_name', :constraints => {:project_name => Project::NAME_REGEXP} do # project
|
2012-05-03 22:52:56 +01:00
|
|
|
scope :as => 'project' do
|
|
|
|
resources :wiki do
|
|
|
|
collection do
|
|
|
|
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
|
|
|
|
match 'revert/:sha1/:sha2' => 'wiki#revert', :as => :revert_page, :via => [:get, :post]
|
|
|
|
match ':ref' => 'wiki#show', :as => :versioned, :via => :get
|
2012-03-31 00:37:54 +01:00
|
|
|
|
2012-05-03 22:52:56 +01:00
|
|
|
post :compare
|
|
|
|
#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
|
2012-04-19 20:45:50 +01:00
|
|
|
end
|
2012-05-03 22:52:56 +01:00
|
|
|
resources :issues, :except => :edit do
|
|
|
|
resources :comments, :only => [:edit, :create, :update, :destroy]
|
|
|
|
resources :subscribes, :only => [:create, :destroy]
|
|
|
|
collection do
|
|
|
|
post :create_label
|
|
|
|
get :search_collaborators
|
|
|
|
end
|
2012-04-19 20:45:50 +01:00
|
|
|
end
|
2012-05-03 22:52:56 +01:00
|
|
|
post "/labels/:label_id" => "issues#destroy_label", :as => :issues_delete_label
|
|
|
|
post "/labels/:label_id/update" => "issues#update_label", :as => :issues_update_label
|
|
|
|
resources :build_lists, :only => [:index, :new, :create] do
|
|
|
|
collection { post :search }
|
2012-04-19 20:45:50 +01:00
|
|
|
end
|
2012-05-03 22:52:56 +01:00
|
|
|
resources :collaborators do
|
|
|
|
get :find, :on => :collection
|
2012-05-14 18:09:18 +01:00
|
|
|
end
|
2012-09-25 21:50:40 +01:00
|
|
|
resources :pull_requests, :except => :destroy do
|
2012-10-03 12:36:04 +01:00
|
|
|
get :autocomplete_to_project, :on => :collection
|
2012-08-08 18:21:49 +01:00
|
|
|
put :merge, :on => :member
|
2012-05-17 17:47:36 +01:00
|
|
|
end
|
2012-08-29 15:58:58 +01:00
|
|
|
post '/preview' => 'projects#preview', :as => 'md_preview'
|
2012-10-01 17:03:08 +01:00
|
|
|
post 'refs_list' => 'projects#refs_list', :as => 'refs_list'
|
2012-10-05 20:19:05 +01:00
|
|
|
get '/pull_requests/:issue_id/add_line_comments(.:format)' => "comments#new_line", :as => :new_line_pull_comment
|
2012-05-10 17:57:59 +01:00
|
|
|
end
|
|
|
|
|
2012-04-19 20:45:50 +01:00
|
|
|
# Resource
|
2012-08-24 16:19:26 +01:00
|
|
|
get '/autocomplete_maintainers' => 'projects#autocomplete_maintainers', :as => :autocomplete_maintainers
|
2012-07-17 09:02:56 +01:00
|
|
|
get '/modify' => 'projects#edit', :as => :edit_project
|
2012-04-19 20:45:50 +01:00
|
|
|
put '/' => 'projects#update'
|
|
|
|
delete '/' => 'projects#destroy'
|
|
|
|
# Member
|
|
|
|
post '/fork' => 'projects#fork', :as => :fork_project
|
|
|
|
get '/sections' => 'projects#sections', :as => :sections_project
|
|
|
|
post '/sections' => 'projects#sections'
|
|
|
|
delete '/remove_user' => 'projects#remove_user', :as => :remove_user_project
|
2012-07-17 09:02:56 +01:00
|
|
|
constraints :treeish => /.+/ do
|
|
|
|
constraints Rosa::Constraints::Treeish do
|
|
|
|
# Tree
|
|
|
|
get '/' => "git/trees#show", :as => :project
|
|
|
|
get '/tree/:treeish(/*path)' => "git/trees#show", :as => :tree, :format => false
|
|
|
|
# Commits
|
|
|
|
get '/commits/:treeish(/*path)' => "git/commits#index", :as => :commits, :format => false
|
|
|
|
get '/commit/:id(.:format)' => "git/commits#show", :as => :commit
|
|
|
|
# Commit comments
|
|
|
|
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
|
|
|
|
put '/commit/:commit_id/comments/:id(.:format)' => "comments#update", :as => :project_commit_comment
|
|
|
|
delete '/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
|
2012-10-04 19:40:12 +01:00
|
|
|
get '/commit/:commit_id/add_line_comments(.:format)' => "comments#new_line", :as => :new_line_commit_comment
|
2012-07-17 09:02:56 +01:00
|
|
|
# Commit subscribes
|
|
|
|
post '/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit
|
|
|
|
delete '/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit
|
|
|
|
# Editing files
|
|
|
|
get '/edit/:treeish/*path' => "git/blobs#edit", :as => :edit_blob, :format => false
|
|
|
|
put '/edit/:treeish/*path' => "git/blobs#update", :format => false
|
|
|
|
# Blobs
|
|
|
|
get '/blob/:treeish/*path' => "git/blobs#show", :as => :blob, :format => false
|
|
|
|
# Blame
|
|
|
|
get '/blame/:treeish/*path' => "git/blobs#blame", :as => :blame, :format => false
|
|
|
|
# Raw
|
|
|
|
get '/raw/:treeish/*path' => "git/blobs#raw", :as => :raw, :format => false
|
|
|
|
# Archive
|
2012-09-20 15:26:26 +01:00
|
|
|
get '/archive/:treeish.:format' => "git/trees#archive", :as => :archive, :format => /zip|tar\.gz/
|
2012-11-19 19:15:15 +00:00
|
|
|
# Git diff
|
|
|
|
get '/diff/:commit1(...:commit2)' => "git/commits#diff", :as => :diff
|
2012-07-17 09:02:56 +01:00
|
|
|
end
|
2012-07-03 13:05:27 +01:00
|
|
|
end
|
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
|
2012-05-03 22:52:56 +01:00
|
|
|
get '/' => 'users/profile#show', :as => :user
|
|
|
|
end
|
2012-07-17 09:02:56 +01:00
|
|
|
constraints Rosa::Constraints::Owner.new(Group, true) do
|
2012-05-03 22:52:56 +01:00
|
|
|
get '/' => 'groups/profile#show', :as => :group
|
2012-03-31 00:37:54 +01:00
|
|
|
end
|
|
|
|
end
|
2011-03-09 13:13:36 +00:00
|
|
|
end
|