Skip to content

Instantly share code, notes, and snippets.

@tboerger
Created March 25, 2014 14:14
Show Gist options
  • Save tboerger/9762715 to your computer and use it in GitHub Desktop.
Save tboerger/9762715 to your computer and use it in GitHub Desktop.
Crowbar::Application.routes.draw do
root to: "dashboard#index"
Dir.glob(File.join(File.dirname(__FILE__), "routes.d", "*.routes")) do |routes_file|
eval(IO.read(routes_file), binding)
end
constraints(id: /.*/ ) do
get "dashboard" => "dashboard#index", as: :dashboard
resources :nodes, only: [:edit, :update, :show] do
collection do
get :status
get :unallocated
get :list
get :families
post :bulk
end
member do
get :status
post :group
get "hit/:req" => "nodes#hit", as: :hit
get "attribute/*path" => "nodes#attribute", as: :attribute, constraints: { path: /.*/ }
end
end
resources :utils, only: [:index, :destroy], controller: :support do
member do
get :restart
post :import
post :upload
end
end
resources :networks, only: [], controller: :network do
member do
get :switch
get :vlan
end
end
resources :docs, only: [:index] do
collection do
get "*id" => "docs#show", as: :topic
end
end
end
match "crowbar/modules/1.0", controller: "barclamp", action: "modules", as: :available_barclamps, via: [:get, :post]
match "docs/:controller/1.0", action: "docs", as: :barclamp_docs, via: [:get, :post]
match "nodes/:controller/1.0", action: "nodes", as: :barclamp_nodes, via: [:get, :post]
match "utils/:controller/1.0", action: "utils", as: :barclamp_utils, via: [:get, :post]
match "network/:controller/1.0", action: "network", as: :barclamp_network, via: [:get, :post]
match "export/:controller/1.0", action: "export", as: :barclamp_export, via: [:get, :post]
constraints(id: /[^\/]/ ) do
match "crowbar/:controller/1.0", action: :index, as: :grouped_barclamps, via: [:get]
match "crowbar/:controller/1.0/:id", action: :show, as: :show_barclamp, via: [:get]
match "crowbar/:controller/1.0/:id", action: :delete, as: :delete_barclamp, via: [:delete]
match "crowbar/:controller/1.0/:action/:id", as: :on_barclamp, via: [:post]
end
scope "crowbar/:controller/1.0" do
match "help", action: "help", as: :help, via: [:get]
match "status", action: "status", as: :status, via: [:get]
match "transition/:id", action: "transition", as: :transition, via: [:get, :post]
match "proposals", action: "proposal_index", as: :proposals, via: [:get]
match "proposals", action: "proposal_create", as: :create_proposal, via: [:put]
match "proposals/:id", action: "proposal_update", as: :update_proposal, via: [:post]
match "proposals/:id", action: "proposal_show", as: :show_proposal, via: [:get]
match "proposals/status/:id/:name", action: "proposal_status", as: :status_proposal, via: [:get]
match "proposals/delete/:id", action: "proposal_delete", as: :delete_proposal, via: [:get]
match "proposals/dequeue/:id", action: "proposal_dequeue", as: :dequeue_proposal, via: [:get]
match "proposals/commit/:id", action: "proposal_commit", as: :commit_proposal, via: [:post]
match "elements", action: "element_index", as: :elements, via: [:get]
match "elements/:id", action: "element_show", as: :show_element, via: [:get]
end
get "crowbar/:controller", action: "versions"
constraints(id: /.*/ ) do
match "crowbar/:barclamp/1.0", controller: :barclamp, action: :index, via: [:get]
match "crowbar/:barclamp/1.0/:id", controller: :barclamp, action: :show, via: [:get]
match "crowbar/:barclamp/1.0/:id", controller: :barclamp, action: :delete, via: [:delete]
match "crowbar/:barclamp/1.0/:action/:id", controller: :barclamp, via: [:post]
end
scope "crowbar/:barclamp/1.0", controller: "barclamp" do
match "help", action: "help", via: [:get]
match "status", action: "status", via: [:get]
match "transition/:id", action: "transition", via: [:get, :post]
match "proposals", action: "proposal_index", via: [:get]
match "proposals", action: "proposal_create", via: [:put]
match "proposals/:id", action: "proposal_update", via: [:post]
match "proposals/:id", action: "proposal_show", via: [:get]
match "proposals/status/:id/:name", action: "proposal_status", via: [:get]
match "proposals/delete/:id", action: "proposal_delete", via: [:get]
match "proposals/dequeue/:id", action: "proposal_dequeue", via: [:get]
match "proposals/commit/:id", action: "proposal_commit", via: [:post]
match "elements", action: "element_index", via: [:get]
match "elements/:id", action: "element_show", via: [:get]
end
get "crowbar/:barclamp", controller: "barclamp", action: "versions"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment