2018-02-28 02:28:04 +03:00
|
|
|
# frozen_string_literal: true
|
2012-07-31 09:51:59 +04:00
|
|
|
|
2018-03-14 23:10:31 +03:00
|
|
|
Rails.application.routes.draw do
|
2018-10-29 02:08:14 +03:00
|
|
|
constraints(host: "whygitisbetterthanx.com") do
|
|
|
|
root to: "site#redirect_wgibtx", as: :whygitisbetterthanx
|
2012-05-02 21:28:27 +04:00
|
|
|
end
|
|
|
|
|
2018-10-29 02:08:14 +03:00
|
|
|
constraints(host: "progit.org") do
|
|
|
|
root to: "site#redirect_book", as: :progit
|
|
|
|
get "*path" => "site#redirect_book"
|
2012-05-02 21:28:27 +04:00
|
|
|
end
|
2012-05-03 05:18:09 +04:00
|
|
|
|
2012-03-08 21:09:45 +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"
|
2018-02-28 05:13:54 +03:00
|
|
|
end
|
|
|
|
|
2018-02-28 05:21:04 +03:00
|
|
|
scope :manuals do
|
2018-11-13 02:21:38 +03:00
|
|
|
get "/" => "doc#ref"
|
2018-02-28 05:13:54 +03:00
|
|
|
|
2018-11-13 02:21:38 +03:00
|
|
|
get "/howto/:file", to: redirect { |path_params, _req|
|
2018-02-28 05:13:54 +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" => "doc#man", :as => :doc_file_html, :file => /[\w\-\.]+/
|
|
|
|
get "/:file" => "doc#man", :as => :doc_file, :file => /[\w\-\.]+/
|
2018-02-28 05:13:54 +03:00
|
|
|
|
2018-11-13 02:21:38 +03:00
|
|
|
get "/:file/:version" => "doc#man", :version => %r{[^\/]+}
|
2018-02-28 05:13:54 +03:00
|
|
|
end
|
2018-02-28 02:28:04 +03:00
|
|
|
|
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
|
|
|
|
|
2018-02-28 02:28:04 +03:00
|
|
|
%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{[^\/]+}
|
2012-05-12 00:54:12 +04:00
|
|
|
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-02-28 05:13:54 +03:00
|
|
|
|
2018-11-13 02:21:38 +03:00
|
|
|
get "/index" => redirect("/book")
|
|
|
|
get "/commands" => redirect("/docs")
|
2018-02-28 05:13:54 +03:00
|
|
|
|
|
|
|
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-02-28 05:13:54 +03:00
|
|
|
|
2018-11-13 02:21:38 +03:00
|
|
|
get "/" => "books#show", :as => :lang
|
|
|
|
get "/:slug" => "books#section", :as => :slug
|
2018-02-28 05:13:54 +03:00
|
|
|
end
|
|
|
|
end
|
2012-07-24 06:34:51 +04:00
|
|
|
end
|
|
|
|
|
2018-02-28 05:13:54 +03:00
|
|
|
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"
|
2018-02-28 05:13:54 +03:00
|
|
|
end
|
2014-10-23 19:50:26 +04:00
|
|
|
|
2018-02-28 02:28:04 +03:00
|
|
|
resources :downloads, only: [:index] do
|
2012-07-31 09:51:59 +04:00
|
|
|
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"
|
2012-07-31 09:51:59 +04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-25 05:11:49 +04:00
|
|
|
get "/blog" => "blog#index"
|
2018-02-08 12:10:52 +03:00
|
|
|
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}/
|
2013-04-04 22:51:12 +04:00
|
|
|
|
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"
|
2012-05-04 03:39:44 +04:00
|
|
|
|
2014-07-25 05:11:49 +04:00
|
|
|
get "/community" => "community#index"
|
2012-04-14 20:12:44 +04:00
|
|
|
|
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
|
|
|
|
2018-02-07 17:24:39 +03:00
|
|
|
# historical synonyms
|
2018-02-28 05:13:54 +03:00
|
|
|
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")
|
2018-02-28 05:13:54 +03:00
|
|
|
end
|
2014-07-25 05:11:49 +04:00
|
|
|
|
|
|
|
get "/course/svn" => "site#svn"
|
2018-11-12 18:35:37 +03:00
|
|
|
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
|
|
|
|
2018-10-29 02:08:14 +03:00
|
|
|
root to: "site#index"
|
2012-03-06 20:52:03 +04:00
|
|
|
end
|