Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Gitorious
- module RepositoryRoutes
- class Resource < ActionDispatch::Routing::Mapper::Resource
- attr_accessor :prefix
- def id_segment
- prefix.to_s + super
- end
- end
- def resources_without_collection(name, prefix = nil, options = {}, &block)
- if @scope[:scope_level] == :resources
- nested do
- resources_without_collection(name, nil, options, &block)
- end
- return
- end
- resource = Gitorious::RepositoryRoutes::Resource.new(name, options)
- resource.prefix = prefix
- scope(:controller => resource.controller) do
- with_scope_level(:resources, resource) do
- yield if block_given?
- with_scope_level(:member) do
- scope("#{prefix}:id") do
- scope(resource.options) do
- get :show
- put :update
- delete :destroy
- get :edit, :as => resource.singular
- end
- end
- end
- end
- end
- end
- def repositories
- resources_without_collection :repositories do
- member do
- get :clone
- post :create_clone
- get :writable_by
- get :config
- get :confirm_delete
- get :committers
- get :search_clones
- match "trees" => "trees#index", :as => :trees
- match "trees/*branch_and_path" => "trees#show", :as => :tree
- match "trees/*branch_and_path.:format" => "trees#show", :as => :formatted_tree
- match "archive-tarball/*branch" => "trees#archive", :as => :archive_tar, :defaults => {:archive_forat => "tar.gz"}
- match "archive-zip/*branch" => "trees#archive", :as => :archive_zip, :defaults => {:archive_format => "zip"}
- # # repo.formatted_commits_feed "commits/*branch/feed.:format",
- # # :controller => "commits", :action => "feed", :conditions => {:feed => :get}
- match "commits/*branch/feed.:format" => "commits#feed", :as => :formatted_commits_feed
- match "commits" => "commits#index", :as => :commits
- match "commits/*branch" => "commits#index", :as => :commits_in_ref
- match "commit/:id(.:format)" => "commits#show", :as => :commit
- match "comments/commit/:sha" => "comments#commit", :as => :commit_comment, :via => :get
- match "comments/preview" => "comments#preview", :as => :comments_preview
- match "blobs/raw/*branch_and_path" => "blobs#raw", :as => :raw_blob
- match "blobs/history/*branch_and_path" => "blobs#history", :as => :blob_history
- match "blobs/*branch_and_path" => "blobs#show", :as => :blob
- end
- resources :comments
- resources :merge_requests do
- member do
- get :terms_accepted
- get :version
- get :commit_status
- end
- collection do
- post :create
- post :commit_list
- post :target_branches
- end
- resources :comments do
- post :preview, :on => :collection
- end
- resources :merge_request_versions do
- resources :comments do
- post :preview, :on => :collection
- end
- end
- end
- resources :committerships do
- collection do
- get :auto_complete_for_group_name
- get :auto_complete_for_user_login
- end
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment