Explorar o código

Add Makefile commands for building documentation (#9652)

Added:
* `make build-docs`: builds the documentation to `docs/_site`, to test if anything is broken.
* `make serve-docs`: runs a server for serving the documentation files, by default at `http://127.0.0.1:4000/FreshRSS/`.
  * Can also specify e.g. `DOCS_HOST=0.0.0.0 DOCS_PORT=8080`.
* `make clean-docs`: deletes `docs/{_site,.jekyll-cache}`.

The new commands are available in `make help`:
```
Documentation
  build-docs                      Test building Jekyll documentation
  serve-docs                      Run local server for serving docs
  clean-docs                      Clean up generated Jekyll files
```

[docs/README.md](https://github.com/FreshRSS/FreshRSS/blob/edge/docs/README.md) was updated with new information regarding the commands.
Inverle hai 1 día
pai
achega
efe955024c
Modificáronse 2 ficheiros con 33 adicións e 10 borrados
  1. 25 0
      Makefile
  2. 8 10
      docs/README.md

+ 25 - 0
Makefile

@@ -74,6 +74,31 @@ stop: ## Stop FreshRSS container if any
 	$(DOCKER) stop freshrss-dev || true
 	$(DOCKER) network rm $(NETWORK) || true
 
+##@ Documentation
+
+DOCS_HOST ?= 127.0.0.1
+DOCS_PORT ?= 4000
+
+define prepare_docs
+	cd docs && \
+	export BUNDLE_FROZEN=true && $(if , Always respect Gemfile.lock ) \
+	export BUNDLE_PATH=.bundle && $(if , Specify repo-local path to run without root ) \
+	(bundle check || bundle install)
+endef
+
+.PHONY: build-docs
+build-docs: ## Test building Jekyll documentation
+	$(prepare_docs) && bundle exec jekyll build
+
+# Example usage: `make serve-docs DOCS_HOST=0.0.0.0 DOCS_PORT=8080`
+.PHONY: serve-docs
+serve-docs: ## Run local server for serving docs
+	$(prepare_docs) && bundle exec jekyll serve -H $(DOCS_HOST) -P $(DOCS_PORT) --watch --incremental
+
+.PHONY: clean-docs
+clean-docs: ## Clean up generated Jekyll files
+	rm -rf docs/_site docs/.jekyll-cache # Without removing installed bundles
+
 ##@ Tests and linter
 .PHONY: lint
 lint: bin/phpcs ## Run the linter on PHP files

+ 8 - 10
docs/README.md

@@ -1,13 +1,11 @@
-This is the documentation deployed by GitHub Pages.
+This is the documentation deployed using GitHub Pages, published at <https://freshrss.github.io/FreshRSS/en/>.
 
-To build and serve locally, first install the necessary packages:
-```sh
-bundle install
-```
-
-Then serve:
-```sh
-bundle exec jekyll serve -H 127.0.0.1 --watch --incremental
-```
+To test if the documentation builds, run: `make build-docs`.
 
+To run a local server for serving the documentation files, use: `make serve-docs`.
 The documentation should be reachable at <http://127.0.0.1:4000/FreshRSS/>.
+Optionally, you can specify another host and port for the server to listen on e.g. `make serve-docs DOCS_HOST=0.0.0.0 DOCS_PORT=8080`.
+
+In order for the command to work, you must have Make and Ruby installed on your machine.
+
+After you're done, you can clean up the files generated by Jekyll: `make clean-docs` (the `_site` and `.jekyll-cache` directories).