Commit d7eb7970249b662ebcc2673001503a247d7fbe48

Authored by Robert Speicher
1 parent 94f91146

1.9 Hash syntax in routes.rb

Also cleans up some alignment and removes unnecessary "to: " arguments
Showing 1 changed file with 52 additions and 51 deletions   Show diff stats
config/routes.rb
... ... @@ -23,14 +23,14 @@ Gitlab::Application.routes.draw do
23 23 #
24 24 # Help
25 25 #
26   - get 'help' => 'help#index'
27   - get 'help/permissions' => 'help#permissions'
28   - get 'help/workflow' => 'help#workflow'
29   - get 'help/api' => 'help#api'
30   - get 'help/web_hooks' => 'help#web_hooks'
  26 + get 'help' => 'help#index'
  27 + get 'help/permissions' => 'help#permissions'
  28 + get 'help/workflow' => 'help#workflow'
  29 + get 'help/api' => 'help#api'
  30 + get 'help/web_hooks' => 'help#web_hooks'
31 31 get 'help/system_hooks' => 'help#system_hooks'
32   - get 'help/markdown' => 'help#markdown'
33   - get 'help/ssh' => 'help#ssh'
  32 + get 'help/markdown' => 'help#markdown'
  33 + get 'help/ssh' => 'help#ssh'
34 34  
35 35 #
36 36 # Admin Area
... ... @@ -43,19 +43,19 @@ Gitlab::Application.routes.draw do
43 43 put :unblock
44 44 end
45 45 end
46   - resources :projects, :constraints => { :id => /[^\/]+/ } do
  46 + resources :projects, constraints: { id: /[^\/]+/ } do
47 47 member do
48 48 get :team
49 49 put :team_update
50 50 end
51 51 end
52   - resources :team_members, :only => [:edit, :update, :destroy]
53   - resources :hooks, :only => [:index, :create, :destroy] do
  52 + resources :team_members, only: [:edit, :update, :destroy]
  53 + resources :hooks, only: [:index, :create, :destroy] do
54 54 get :test
55 55 end
56 56 resource :logs, only: [:show]
57   - resource :resque, :controller => 'resque', only: [:show]
58   - root :to => "dashboard#index"
  57 + resource :resque, controller: 'resque', only: [:show]
  58 + root to: "dashboard#index"
59 59 end
60 60  
61 61 get "errors/githost"
... ... @@ -63,31 +63,32 @@ Gitlab::Application.routes.draw do
63 63 #
64 64 # Profile Area
65 65 #
66   - get "profile/account", :to => "profile#account"
67   - get "profile/history", :to => "profile#history"
68   - put "profile/password", :to => "profile#password_update"
69   - get "profile/token", :to => "profile#token"
70   - put "profile/reset_private_token", :to => "profile#reset_private_token"
71   - get "profile", :to => "profile#show"
72   - get "profile/design", :to => "profile#design"
73   - put "profile/update", :to => "profile#update"
  66 + get "profile/account" => "profile#account"
  67 + get "profile/history" => "profile#history"
  68 + put "profile/password" => "profile#password_update"
  69 + get "profile/token" => "profile#token"
  70 + put "profile/reset_private_token" => "profile#reset_private_token"
  71 + get "profile" => "profile#show"
  72 + get "profile/design" => "profile#design"
  73 + put "profile/update" => "profile#update"
  74 +
74 75 resources :keys
75 76  
76 77 #
77 78 # Dashboard Area
78 79 #
79   - get "dashboard", :to => "dashboard#index"
80   - get "dashboard/issues", :to => "dashboard#issues"
81   - get "dashboard/merge_requests", :to => "dashboard#merge_requests"
  80 + get "dashboard" => "dashboard#index"
  81 + get "dashboard/issues" => "dashboard#issues"
  82 + get "dashboard/merge_requests" => "dashboard#merge_requests"
82 83  
83   - resources :projects, :constraints => { :id => /[^\/]+/ }, :only => [:new, :create]
  84 + resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create]
84 85  
85   - devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks }
  86 + devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks }
86 87  
87 88 #
88 89 # Project Area
89 90 #
90   - resources :projects, :constraints => { :id => /[^\/]+/ }, :except => [:new, :create, :index], :path => "/" do
  91 + resources :projects, constraints: { id: /[^\/]+/ }, except: [:new, :create, :index], path: "/" do
91 92 member do
92 93 get "team"
93 94 get "wall"
... ... @@ -95,7 +96,7 @@ Gitlab::Application.routes.draw do
95 96 get "files"
96 97 end
97 98  
98   - resources :wikis, :only => [:show, :edit, :destroy, :create] do
  99 + resources :wikis, only: [:show, :edit, :destroy, :create] do
99 100 collection do
100 101 get :pages
101 102 end
... ... @@ -114,46 +115,45 @@ Gitlab::Application.routes.draw do
114 115 end
115 116  
116 117 resources :deploy_keys
117   - resources :protected_branches, :only => [:index, :create, :destroy]
  118 + resources :protected_branches, only: [:index, :create, :destroy]
118 119  
119   - resources :refs, :only => [], :path => "/" do
  120 + resources :refs, only: [], path: "/" do
120 121 collection do
121 122 get "switch"
122 123 end
123 124  
124 125 member do
125   - get "tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }
126   - get "logs_tree", :constraints => { :id => /[a-zA-Z.\/0-9_\-]+/ }
  126 + get "tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
  127 + get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
127 128  
128 129 get "blob",
129   - :constraints => {
130   - :id => /[a-zA-Z.0-9\/_\-]+/,
131   - :path => /.*/
  130 + constraints: {
  131 + id: /[a-zA-Z.0-9\/_\-]+/,
  132 + path: /.*/
132 133 }
133 134  
134   -
135 135 # tree viewer
136 136 get "tree/:path" => "refs#tree",
137   - :as => :tree_file,
138   - :constraints => {
139   - :id => /[a-zA-Z.0-9\/_\-]+/,
140   - :path => /.*/
  137 + as: :tree_file,
  138 + constraints: {
  139 + id: /[a-zA-Z.0-9\/_\-]+/,
  140 + path: /.*/
141 141 }
142 142  
143 143 # tree viewer
144 144 get "logs_tree/:path" => "refs#logs_tree",
145   - :as => :logs_file,
146   - :constraints => {
147   - :id => /[a-zA-Z.0-9\/_\-]+/,
148   - :path => /.*/
  145 + as: :logs_file,
  146 + constraints: {
  147 + id: /[a-zA-Z.0-9\/_\-]+/,
  148 + path: /.*/
149 149 }
150 150  
151 151 # blame
152 152 get "blame/:path" => "refs#blame",
153   - :as => :blame_file,
154   - :constraints => {
155   - :id => /[a-zA-Z.0-9\/_\-]+/,
156   - :path => /.*/
  153 + as: :blame_file,
  154 + constraints: {
  155 + id: /[a-zA-Z.0-9\/_\-]+/,
  156 + path: /.*/
157 157 }
158 158 end
159 159 end
... ... @@ -178,7 +178,7 @@ Gitlab::Application.routes.draw do
178 178 end
179 179 end
180 180  
181   - resources :hooks, :only => [:index, :create, :destroy] do
  181 + resources :hooks, only: [:index, :create, :destroy] do
182 182 member do
183 183 get :test
184 184 end
... ... @@ -194,7 +194,7 @@ Gitlab::Application.routes.draw do
194 194 end
195 195 resources :team_members
196 196 resources :milestones
197   - resources :labels, :only => [:index]
  197 + resources :labels, only: [:index]
198 198 resources :issues do
199 199  
200 200 collection do
... ... @@ -203,11 +203,12 @@ Gitlab::Application.routes.draw do
203 203 get :search
204 204 end
205 205 end
206   - resources :notes, :only => [:index, :create, :destroy] do
  206 + resources :notes, only: [:index, :create, :destroy] do
207 207 collection do
208 208 post :preview
209 209 end
210 210 end
211 211 end
212   - root :to => "dashboard#index"
  212 +
  213 + root to: "dashboard#index"
213 214 end
... ...