diff --git a/.gitignore b/.gitignore index 0e3cba717bda2..1ff4e03e2c069 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,6 @@ package-lock.json # Development Docker storage location _docker-storage/ + +# YARD generated doc (in the Gitdocs folder) +docs/.static/ruby-doc/ diff --git a/.yardopts b/.yardopts new file mode 100644 index 0000000000000..36c24e4943184 --- /dev/null +++ b/.yardopts @@ -0,0 +1 @@ +--no-cache --no-save --protected --private --charset utf-8 --plugin yard-activerecord --plugin yard-activesupport-concern diff --git a/Gemfile b/Gemfile index 5a3591a4b52ac..3d271a7f86a50 100644 --- a/Gemfile +++ b/Gemfile @@ -117,6 +117,9 @@ group :development do gem "pry", "~> 0.12" # An IRB alternative and runtime developer console gem "pry-rails", "~> 0.3" # Use Pry as your rails console gem "web-console", "~> 3.7" # Rails Console on the Browser + gem "yard-activerecord", "~> 0.0.16" # YARD extension that handles and interprets methods used when developing applications with ActiveRecord + gem "yard-activesupport-concern", "~> 0.0.1" # YARD extension that brings support for modules making use of ActiveSupport::Concern + gem "yard", "~> 0.9.19" # YARD is a documentation generation tool for the Ruby programming language end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 549f593c8f50c..bd228a68984bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -812,6 +812,11 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yajl-ruby (1.4.1) + yard (0.9.19) + yard-activerecord (0.0.16) + yard (>= 0.8.3) + yard-activesupport-concern (0.0.1) + yard (>= 0.8) zonebie (0.6.1) PLATFORMS @@ -947,6 +952,9 @@ DEPENDENCIES webmock (~> 3.5) webpacker (~> 3.5) webpush (~> 0.3) + yard (~> 0.9.19) + yard-activerecord (~> 0.0.16) + yard-activesupport-concern (~> 0.0.1) zonebie (~> 0.6.1) RUBY VERSION diff --git a/docs/.gitdocs.json b/docs/.gitdocs.json index 10212c94da5f8..1d8bda248b09e 100644 --- a/docs/.gitdocs.json +++ b/docs/.gitdocs.json @@ -12,6 +12,11 @@ "title": "DEV", "href": "https://dev.to", "target": "_blank" + }, + { + "title": "Ruby doc", + "href": "http://docs.dev.to/ruby-doc", + "target": "_blank" } ] } diff --git a/docs/.ruby-version b/docs/.ruby-version new file mode 100644 index 0000000000000..097a15a2af39d --- /dev/null +++ b/docs/.ruby-version @@ -0,0 +1 @@ +2.6.2 diff --git a/docs/Gemfile b/docs/Gemfile new file mode 100644 index 0000000000000..c022a49e0b891 --- /dev/null +++ b/docs/Gemfile @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } + +gem "activerecord", "~> 5.2.3" # Databases on Rails +gem "yard-activerecord", "~> 0.0.16" # YARD extension that handles and interprets methods used when developing applications with ActiveRecord +gem "yard-activesupport-concern", "~> 0.0.1" # YARD extension that brings support for modules making use of ActiveSupport::Concern +gem "yard", "~> 0.9.19" # YARD is a documentation generation tool for the Ruby programming language diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000000000..165fec6847f28 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,10 @@ +.PHONY: build + +build: ruby-doc gitdocs + +ruby-doc: + # docs/.static/ruby-doc will let gitdocs serve the Ruby doc as static content + cd .. && yard doc -o docs/.static/ruby-doc + +gitdocs: + npm install -g gitdocs@latest && gitdocs build diff --git a/docs/faqs.md b/docs/faqs.md index 972e5b7acd79d..ada80d7b29964 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -3,3 +3,12 @@ title: FAQs --- # Frequently Asked Questions + +## How do I build my local copy of the Ruby source code documentation? + +```shell +cd docs +make ruby-doc +``` + +Then open `.static/ruby-doc/index.html` in the `docs` directory and browse the Ruby documentation diff --git a/netlify.toml b/netlify.toml index 885275197b4dc..37a2b04a5b324 100644 --- a/netlify.toml +++ b/netlify.toml @@ -7,9 +7,17 @@ [build] base = "docs/" + command = "make" + [[redirects]] from = "http://docs.dev.to" to = "https://docs.dev.to" +[[redirects]] + from = "http://docs.dev.to/ruby-doc" + to = "https://docs.dev.to/ruby-doc/index.html" +[[redirects]] + from = "http://docs.dev.to/ruby-doc/" + to = "https://docs.dev.to/ruby-doc/index.html" [[redirects]] from = "http://docs.dev.to/*" to = "https://docs.dev.to/:splat"