git-scm.com/config/routes.rb

124 строки
3.8 KiB
Ruby
Исходник Постоянная ссылка Обычный вид История

# frozen_string_literal: true
2018-03-14 23:10:31 +03:00
Rails.application.routes.draw do
constraints(host: "whygitisbetterthanx.com") do
root to: "site#redirect_wgibtx", as: :whygitisbetterthanx
end
constraints(host: "progit.org") do
root to: "site#redirect_book", as: :progit
get "*path" => "site#redirect_book"
end
2012-05-03 05:18:09 +04:00
get "site/index"
2012-03-06 20:52:03 +04:00
2018-02-28 05:21:04 +03:00
scope :manual, as: :manual do
2018-11-13 02:21:38 +03:00
get "/" => "doc#index"
get "/ext" => "doc#ext"
end
2018-02-28 05:21:04 +03:00
scope :manuals do
2018-11-13 02:21:38 +03:00
get "/" => "doc#ref"
2018-11-13 02:21:38 +03:00
get "/howto/:file", to: redirect { |path_params, _req|
"https://github.com/git/git/blob/master/Documentation/howto/#{path_params[:file]}.txt"
}
2018-11-13 02:21:38 +03:00
get "/:file.html" => "doc#man", :as => :doc_file_html, :file => /[\w\-\.]+/
get "/:file" => "doc#man", :as => :doc_file, :file => /[\w\-\.]+/
2018-11-13 02:21:38 +03:00
get "/:file/:version" => "doc#man", :version => %r{[^\/]+}
end
2018-02-28 05:21:04 +03:00
scope :doc, as: :doc do
2018-11-13 02:21:38 +03:00
get "/" => redirect("/manual")
get "/ext" => redirect("/manual/ext")
2018-02-28 05:21:04 +03:00
end
2019-02-18 01:23:32 +03:00
scope :docs, as: :docs do
2018-11-13 02:21:38 +03:00
get "/" => redirect("/manuals")
2018-02-28 05:21:04 +03:00
2018-11-13 02:21:38 +03:00
get "/howto/:file", to: redirect { |path_params, _req|
2018-02-28 05:21:04 +03:00
"https://github.com/git/git/blob/master/Documentation/howto/#{path_params[:file]}.txt"
}
2018-11-13 02:21:38 +03:00
get "/:file.html" => redirect("/manuals/%<file>s.html"), :file => /[\w\-\.]+/
get "/:file" => redirect("/manuals/%<file>s"), :file => /[\w\-\.]+/
2018-02-28 05:21:04 +03:00
2018-11-13 02:21:38 +03:00
get "/:file/:version" => redirect("/manuals/%<file>s/%<version>s"), :version => %r{[^\/]+}
2018-02-28 05:21:04 +03:00
end
%w[man ref git].each do |path|
2018-11-13 02:21:38 +03:00
get "/#{path}/:file" => redirect("/docs/%<file>s")
get "/#{path}/:file/:version" => redirect("/docs/%<file>s/%<version>s"), :version => %r{[^\/]+}
end
2012-04-27 01:41:31 +04:00
2012-07-24 06:34:51 +04:00
resource :book do
2018-11-13 02:21:38 +03:00
get "/ch:chapter-:section.html" => "books#chapter"
2014-07-25 05:11:49 +04:00
get "/:lang/ch:chapter-:section.html" => "books#chapter"
2018-11-13 02:21:38 +03:00
get "/index" => redirect("/book")
get "/commands" => redirect("/docs")
nested do
2018-11-13 02:21:38 +03:00
scope ":lang" do
get "/v:edition" => "books#show"
get "/v:edition/:slug" => "books#section"
get "/v:edition/:chapter/:link" => "books#link", :chapter => /(ch|app)\d+/
2018-11-13 02:21:38 +03:00
get "/" => "books#show", :as => :lang
get "/:slug" => "books#section", :as => :slug
end
end
2012-07-24 06:34:51 +04:00
end
scope :download, as: :download do
2018-11-13 02:21:38 +03:00
get "/" => "downloads#index"
get "/:platform" => "downloads#download"
get "/gui/:platform" => "downloads#gui"
end
2014-10-23 19:50:26 +04:00
resources :downloads, only: [:index] do
collection do
2014-07-25 05:11:49 +04:00
get "/guis" => "downloads#guis"
get "/installers" => "downloads#installers"
2018-11-13 02:21:38 +03:00
get "/logos" => "downloads#logos"
2014-07-25 05:11:49 +04:00
get "/latest" => "downloads#latest"
end
end
2014-07-25 05:11:49 +04:00
get "/blog" => "blog#index"
get "/blog/*post" => redirect("/blog")
2018-11-13 02:21:38 +03:00
get "/:year/:month/:day/:slug" => redirect("/blog"), :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/
2018-11-13 02:21:38 +03:00
get "/about" => "about#index"
2014-07-25 05:11:49 +04:00
get "/about/:section" => "about#index"
2012-04-19 01:03:53 +04:00
2018-11-13 02:21:38 +03:00
get "/videos" => "doc#videos"
2014-07-25 05:11:49 +04:00
get "/video/:id" => "doc#watch"
2014-07-25 05:11:49 +04:00
get "/community" => "community#index"
2018-11-13 02:21:38 +03:00
get "/search" => "site#search"
2014-07-25 05:11:49 +04:00
get "/search/results" => "site#search_results"
2012-04-03 21:11:21 +04:00
# historical synonyms
namespace :documentation do
2018-11-13 02:21:38 +03:00
get "/" => redirect("/doc")
get "/reference" => redirect("/docs")
get "/reference/:file.html" => redirect { |path_params, _req| "/docs/#{path_params[:file]}" }
get "/book" => redirect("/book")
get "/videos" => redirect("/videos")
get "/external-links" => redirect("doc/ext")
end
2014-07-25 05:11:49 +04:00
get "/course/svn" => "site#svn"
get "/sfc" => "site#sfc"
get "/site" => "site#about"
get "/trademark" => redirect("/about/trademark")
2014-07-25 05:11:49 +04:00
get "/contributors" => redirect("https://github.com/git/git/graphs/contributors")
2012-12-14 22:38:18 +04:00
root to: "site#index"
2012-03-06 20:52:03 +04:00
end