Blob of config/routes.rb (raw blob data)

1 ActionController::Routing::Routes.draw do |map|
2
3 # The priority is based upon order of creation: first created -> highest priority.
4
5 # Sample of regular route:
6 # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7 # Keep in mind you can assign values other than :controller and :action
8
9 # Sample of named route:
10 # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
11 # This route can be invoked with purchase_url(:id => product.id)
12
13 # You can have the root of your site routed by hooking up ''
14 # -- just remember to delete public/index.html.
15 # map.connect '', :controller => "welcome"
16
17 # Allow downloading Web Service WSDL as a file with an extension
18 # instead of a file named 'wsdl'
19 #map.connect ':controller/service.wsdl', :action => 'wsdl'
20 VALID_SHA = /[a-zA-Z0-9~\{\}\+\^\.\-_]+/
21 map.root :controller => "site", :action => "index"
22
23 map.resource :account, :member => {:password => :get, :update_password => :put} do |account|
24 account.resources :keys
25 end
26 map.connect "users/activate/:activation_code", :controller => "users", :action => "activate"
27 map.resources :users, :requirements => {:id => /.+/ }, :collection => {
28 :forgot_password => :get, :reset_password => :post}, :member => { :feed => :get }
29 map.resources :events
30
31 map.open_id_complete '/sessions', :controller => "sessions", :action=> "create",:requirements => { :method => :get }
32 map.resource :sessions
33 map.with_options(:controller => "projects", :action => "category") do |project_cat|
34 project_cat.projects_category "projects/category/:id"
35 project_cat.formatted_projects_category "projects/category/:id.:format"
36 end
37 map.resources :projects, :member => {:confirm_delete => :get} do |projects|
38 projects.resources(:repositories, :member => {
39 :new => :get, :create => :post,
40 :writable_by => :get,
41 :confirm_delete => :get
42 }, :as => "repos") do |repo|
43 repo.resources :committers, :name_prefix => nil, :collection => {:auto_complete_for_user_login => :post, :list => :get, :create => :post}
44 repo.resources :comments, :member => { :commmit => :get }
45 repo.resources :merge_requests, :member => { :resolve => :put }, :collection => { :create => :post }
46 repo.commit_comment "comments/commit/:sha", :controller => "comments",
47 :action => "commit", :conditions => { :method => :get }
48
49 repo.resources :logs, :requirements => { :id => VALID_SHA }#, :member => { :feed => :get }
50 repo.formatted_log_feed "logs/:id/feed.:format", :controller => "logs", :action => "feed",
51 :conditions => {:feed => :get}, :requirements => {:id => VALID_SHA}
52 repo.resources :commits
53 repo.trees "trees/", :controller => "trees", :action => "index"
54 repo.with_options(:requirements => { :id => VALID_SHA }) do |r|
55 r.tree "trees/:id/*path", :controller => "trees", :action => "show"
56 r.formatted_tree "trees/:id/*path.:format", :controller => "trees", :action => "show"
57 r.archive_tree "archive/:id.tar.gz", :controller => "trees", :action => "archive"
58 r.raw_blob "blobs/raw/:id/*path", :controller => "blobs", :action => "raw"
59 r.blob "blobs/:id/*path", :controller => "blobs", :action => "show"
60 end
61 end
62 end
63
64 map.resource :search
65
66 map.with_options :controller => 'sessions' do |session|
67 session.login '/login', :action => 'new'
68 session.logout '/logout', :action => 'destroy'
69 end
70
71 map.dashboard "dashboard", :controller => "site", :action => "dashboard"
72 map.about "about", :controller => "site", :action => "about"
73 map.faq "about/faq", :controller => "site", :action => "faq"
74
75 # Install the default route as the lowest priority.
76 map.connect ':controller/:action/:id.:format'
77 map.connect ':controller/:action/:id'
78 end