Commit 884eb732977ee785c48a954542e8735cd572e1fe

Authored by Robert Speicher
1 parent 2ddb1917

Enable tree resource, remove old tree routes

config/routes.rb
... ... @@ -122,24 +122,14 @@ Gitlab::Application.routes.draw do
122 122 end
123 123  
124 124 member do
125   - get "tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
126   - get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
127   -
128 125 get "blob",
129 126 constraints: {
130 127 id: /[a-zA-Z.0-9\/_\-]+/,
131 128 path: /.*/
132 129 }
133 130  
134   - # tree viewer
135   - get "tree/:path" => "refs#tree",
136   - as: :tree_file,
137   - constraints: {
138   - id: /[a-zA-Z.0-9\/_\-]+/,
139   - path: /.*/
140   - }
141   -
142   - # tree viewer
  131 + # tree viewer logs
  132 + get "logs_tree", constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
143 133 get "logs_tree/:path" => "refs#logs_tree",
144 134 as: :logs_file,
145 135 constraints: {
... ... @@ -217,7 +207,7 @@ Gitlab::Application.routes.draw do
217 207 # resources :blame, only: [:show], constraints: {id: /.+/}
218 208 # resources :blob, only: [:show], constraints: {id: /.+/}
219 209 # resources :raw, only: [:show], constraints: {id: /.+/}
220   - # resources :tree, only: [:show], constraints: {id: /.+/}
  210 + resources :tree, only: [:show], constraints: {id: /.+/}
221 211 end
222 212  
223 213 root to: "dashboard#index"
... ...
spec/routing/project_routing_spec.rb
... ... @@ -192,10 +192,8 @@ describe ProtectedBranchesController, "routing" do
192 192 end
193 193  
194 194 # switch_project_refs GET /:project_id/switch(.:format) refs#switch
195   -# tree_project_ref GET /:project_id/:id/tree(.:format) refs#tree
196   -# logs_tree_project_ref GET /:project_id/:id/logs_tree(.:format) refs#logs_tree
197 195 # blob_project_ref GET /:project_id/:id/blob(.:format) refs#blob
198   -# tree_file_project_ref GET /:project_id/:id/tree/:path(.:format) refs#tree
  196 +# logs_tree_project_ref GET /:project_id/:id/logs_tree(.:format) refs#logs_tree
199 197 # logs_file_project_ref GET /:project_id/:id/logs_tree/:path(.:format) refs#logs_tree
200 198 # blame_file_project_ref GET /:project_id/:id/blame/:path(.:format) refs#blame
201 199 describe RefsController, "routing" do
... ... @@ -203,11 +201,6 @@ describe RefsController, "routing" do
203 201 get("/gitlabhq/switch").should route_to('refs#switch', project_id: 'gitlabhq')
204 202 end
205 203  
206   - it "to #tree" do
207   - get("/gitlabhq/stable/tree").should route_to('refs#tree', project_id: 'gitlabhq', id: 'stable')
208   - get("/gitlabhq/stable/tree/foo/bar/baz").should route_to('refs#tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz')
209   - end
210   -
211 204 it "to #logs_tree" do
212 205 get("/gitlabhq/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable')
213 206 get("/gitlabhq/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz')
... ... @@ -406,6 +399,12 @@ describe NotesController, "routing" do
406 399 end
407 400 end
408 401  
  402 +describe TreeController, "routing" do
  403 + it "to #show" do
  404 + get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
  405 + end
  406 +end
  407 +
409 408 # TODO: Pending
410 409 #
411 410 # /:project_id/blame/*path
... ... @@ -457,10 +456,4 @@ describe "pending routing" do
457 456 get("/gitlabhq/raw/master/app/models/project.rb").should route_to('raw#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
458 457 end
459 458 end
460   -
461   - describe "/:project_id/tree/:id" do
462   - it "routes to a ref with a path" do
463   - get("/gitlabhq/tree/master/app/models/project.rb").should route_to('tree#show', project_id: 'gitlabhq', id: 'master/app/models/project.rb')
464   - end
465   - end
466 459 end
... ...