Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): add project documentation #70

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

This project follows a fork and pull request syle of contribution.

### Creating a Fork

Just head over to the GitHub page and [click the "Fork" button](https://help.github.com/articles/fork-a-repo). Once you've done that, you can use your favorite git client to clone your repo or just head straight to the command line:

```shell
# Clone your fork to your local machine
git clone [email protected]:USERNAME/FORKED-PROJECT.git
```

### Keeping Your Fork Up to Date

While this isn't an absolutely necessary step, if you plan on doing anything more than just a tiny quick fix, you'll want to make sure you keep your fork up to date by tracking the original "upstream" repo that you forked. You can do this by using [the Github UI](https://help.github.com/articles/syncing-a-fork) or locally by adding this repo as an upstream.

```shell
# Add 'upstream' repo to list of remotes
git remote add upstream https://github.com/ublue-os/yafti.git

# Verify the new remote named 'upstream'
git remote -v
```

Whenever you want to update your fork with the latest upstream changes, you'll need to first fetch the upstream repo's branches and latest commits to bring them into your repository:

```shell
# Fetch from upstream remote
git fetch upstream

# View all branches, including those from upstream
git branch -va
```

Now, checkout your own main branch and merge the upstream repo's main branch:

```shell
# Checkout your main branch and merge upstream
git checkout main
git merge --ff-only upstream/main
```

If there are no unique commits on the local main branch, git will simply perform a fast-forward. However, if you have been making changes on main (in the vast majority of cases you probably shouldn't be - [see the next section](#doing-your-work), you may have to deal with conflicts. When doing so, be careful to respect the changes made upstream.

Now, your local main branch is up-to-date with everything modified upstream.

### Doing Your Work

#### Create a Branch

Whenever you begin work on a new feature or bugfix, it's important that you create a new branch. Not only is it proper git workflow, but it also keeps your changes organized and separated from the main branch so that you can easily submit and manage multiple pull requests for every task you complete.

To create a new branch and start working on it:

```shell
# Checkout the main branch - you want your new branch to come from main
git checkout main

# Create a new branch named newfeature (give your branch its own simple informative name)
git checkbout -b newfeature
```

Now, go to town hacking away and making whatever changes you want to.

#### Commit Messages

We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and enforce them with a bot to keep the changelogs tidy:

```
chore: add Oyster build script
docs: explain hat wobble
feat: add beta sequence
fix: remove broken confirmation message
refactor: share logic between 4d3d3d3 and flarhgunnstow
style: convert tabs to spaces
test: ensure Tayne retains clothing
```

If you have multiple commits, when [submitting your chages](#submitting-a-pull-request), make sure to use a conventional commit style PR title as this project does squash merges and that will be used as your contribution.

### Submitting a Pull Request

#### Cleaning Up Your Work

Prior to submitting your pull request, you might want to do a few things to clean up your branch and make it as simple as possible for the original repo's maintainer to test, accept, and merge your work.

If any commits have been made to the upstream main branch, you should rebase your feature branch so that merging it will be a simple fast-forward that won't require any conflict resolution work.

```shell
# Fetch upstream main and merge with your repo's main branch
git fetch upstream
git checkout main
git merge upstream/main

# If there were any new commits, rebase your feature branch
git checkout newfeature
git rebase main
```

#### Submitting

Once you've committed and pushed all of your changes to GitHub, go to the page for your fork on GitHub, select your feature branch, and click the pull request button. If you need to make any adjustments to your pull request, just push the updates to GitHub. Your pull request will automatically track the changes on your feature branch and update.

### Accepting and Merging a Pull Request

Take note that unlike the previous sections which were written from the perspective of someone that created a fork and generated a pull request, this section is written from the perspective of the original repository owner who is handling an incoming pull request. Thus, where the "forker" was referring to the original repository as `upstream`, we're now looking at it as the owner of that original repository and the standard `origin` remote.

#### Checking Out and Testing Pull Requests

There are multiple ways to [check out a pull request locally](https://help.github.com/articles/checking-out-pull-requests-locally). This way uses standard git operations to complete. Open up the `.git/config` file and add a new line under `[remote "origin"]`:

```
fetch = +refs/pull/*/head:refs/pull/origin/*
```

Now you can fetch and checkout any pull request so that you can test them:

```shell
# Fetch all pull request branches
git fetch origin

# Checkout out a given pull request branch based on its number
git checkout -b 9001 pull/origin/9001
```

Keep in mind that these branches will be read only and you won't be able to push any changes.

#### Automatically Merging a Pull Request
In cases where the merge would be a simple fast-forward, you can automatically do the merge by clicking the button on the pull request page on GitHub.
Empty file added docs/developers.md
Empty file.
43 changes: 43 additions & 0 deletions docs/generate_reference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""Generate the code reference pages and navigation."""

from pathlib import Path

import mkdocs_gen_files

nav = mkdocs_gen_files.Nav()

for path in sorted(Path("yafti").rglob("*.py")):
print(path)
module_path = path.with_suffix("")
print(module_path)
doc_path = path.relative_to("yafti").with_suffix(".md")
print(doc_path)
full_doc_path = Path("reference", doc_path)
print(full_doc_path)

parts = tuple(module_path.parts)

print(parts)
if parts[-1] == "__init__":
parts = parts[:-1]
doc_path = doc_path.with_name("index.md")
full_doc_path = full_doc_path.with_name("index.md")
elif parts[-1] == "__main__":
continue

print(doc_path)

nav[parts] = doc_path.as_posix()

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
ident = ".".join(parts)
if len(parts) < 1:
fd.write("")
continue

fd.write(f"::: {ident}")

mkdocs_gen_files.set_edit_path(full_doc_path, Path("../") / path)

with mkdocs_gen_files.open("reference/SUMMARY.txt", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
Empty file added docs/getting-started.md
Empty file.
22 changes: 22 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
hide:
- navigation
- toc
- path
- title
---

# Yet another first time installer

![](/assets/logo.png)

This application is responsible for installing Flatpaks on first boot after a user finishes installation.
It is intended as a replacement for custom zenity dialogs.

## Project goals

* Config file driven via JSON/YAML
* Support for arbitrary pre and post-install commands
* Configuration driven screens
* Screen independent state management with ability to set defaults
* Extensible with drop-in Python classes / plugins to extend functionality
78 changes: 78 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
site_name: Yafti
repo_url: https://github.com/ublue-os/yafti
repo_name: ublue-os/yafti
watch: [README.md, yafti]
nav:
- Home: "index.md"
- Getting Started: "getting-started.md"
- Developers: "developers.md"
- Contributing: "contributing.md"
- Reference: reference/

theme:
name: "material"
features:
- content.action.edit
- navigation.expand
- navigation.sections
- navigation.tabs
- navigation.tabs.sticky
- navigation.tracking
- toc.integrate
icon:
edit: material/pencil
repo: fontawesome/brands/github
view: material/eye
palette:
# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: pink
accent: teal
toggle:
icon: material/brightness-4
name: Switch to system preference
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: pink
accent: teal
toggle:
icon: material/brightness-7
name: Switch to dark mode

plugins:
- gen-files:
scripts:
- docs/generate_reference.py
- git-revision-date-localized:
fallback_to_build_date: true
- literate-nav:
nav_file: SUMMARY.txt
- mkdocstrings:
default_handler: python
handlers:
python:
paths: [.]
options:
show_source: true
- search

markdown_extensions:
- admonition
- attr_list
- def_list
- footnotes
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.tasklist:
custom_checkbox: true
Loading