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

83 setup script #85

Merged
merged 18 commits into from
Aug 31, 2023
Merged

83 setup script #85

merged 18 commits into from
Aug 31, 2023

Conversation

ColmBhandal
Copy link
Contributor

Closes #83.

This is quick and dirty. The user just copies the bash script into their repo and runs it, and the script clones & sets up the files for them.

Please take a note of the readme changes I made.

The file takes the working dir as input
Then it copies and updates files as necessary
readme.rst Outdated Show resolved Hide resolved
bootstrap.sh Show resolved Hide resolved
bootstrap.sh Outdated Show resolved Hide resolved
readme.rst Outdated Show resolved Hide resolved
readme.rst Outdated

Getting started
---------------
Local Development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sentence case

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that heading better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt that it better describes the content, which describes how to build and run and develop locally.

Also, the user may not only want to consult this when getting started.

Also, the user has already god started by running the bootstrap so it felt a bit weird telling them to get started mid doc.

Copy link
Contributor

@ru-fu ru-fu Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see the point about "Getting started" not being good, but I don't like the "local development". At this time, we don't have anything else (RTD hasn't been set up, and we want everybody to build their docs locally first before doing anything else). So maybe just "Development" or "Start working" or "Build and view the docs" or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I changed to "Build and view the docs".

Copy link
Contributor

@ru-fu ru-fu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments from a pure code review, I haven't tried to actively break it yet. ;-)

readme.rst Outdated Show resolved Hide resolved
readme.rst Outdated
.. code-block:: none
* Copy [bootstrap.sh](bootstrap.sh) to your repository's root directory.
* Run the script: ``./boostrap.sh``
* Enter the installation directory when prompted. For standalone repos, enter ".". For docs alonside code, enter "docs".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Enter the installation directory when prompted. For standalone repos, enter ".". For docs alonside code, enter "docs".
* Enter the installation directory when prompted. For standalone repositories, enter ".". For documentation alongside code, enter "docs".

There's a few more cases of "repo" and "docs", which we shouldn't use imo. They'll also break the spelling check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, updated.

readme.rst Outdated

* ``configuration: docs/conf.py``
* ``requirements: docs/.sphinx/requirements.txt``
When the script completes, your repository will have the starter sphinx docs files added. Commit your changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a summary of what the script does somewhere in this section. You can't expect anybody to want to run a script that copies files around without telling them what the script will do. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a description.

readme.rst Outdated

* ``configuration: docs/conf.py``
* ``requirements: docs/.sphinx/requirements.txt``
When the script completes, your repository will have the starter sphinx docs files added. Commit your changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When the script completes, your repository will have the starter sphinx docs files added. Commit your changes.
When the script completes, your repository will have the files added that are needed to get started with Sphinx documentation. Commit your changes.

readme.rst Outdated

Getting started
---------------
Local Development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that heading better?

bootstrap.sh Show resolved Hide resolved
bootstrap.sh Show resolved Hide resolved
bootstrap.sh Show resolved Hide resolved
bootstrap.sh Outdated

# Update working-directory field in workflow files
echo "Updating working directory in workflow files..."
sed -i "s|working-directory: .*|working-directory: $install_directory|g" .github/workflows/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO! This will change all working directories in existing workflows (which might not be related to documentation).
Either change this before moving the workflow out of the temp directory, or restrict to our workflow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we know what our workflow file contains, so why use a wildcard?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I've updated the sed to run much earlier in the script. I left it as a wildcard in case we add more workflows.

bootstrap.sh Outdated

# Update .readthedocs.yaml configuration
echo "Updating .readthedocs.yaml configuration..."
sed -i "s|configuration: .*|configuration: $install_directory/conf.py|g" "$install_directory/.readthedocs.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, why use a wildcard for matching? We know what we want to replace, and if the content is different, we don't want to blindly replace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep Lloyd had a similar comment and now I only match conf.py

ColmBhandal and others added 9 commits August 29, 2023 11:37
Only replace configuration ending with conf.py
This prevents overwriting other configuraitons
Co-authored-by: Ruth Fuchss <ruth.fuchss@canonical.com>
Docs and repos
Replaced with full words
Running sed straight after clone
This ensures it's only run against starter pack
And it doesn't affect their existing repo
bootstrap.sh Outdated Show resolved Hide resolved
bootstrap.sh Outdated
echo "Updating working directory in workflow files..."
sed -i "s|working-directory: .*|working-directory: $install_directory|g" "temp-starter-pack/.github/workflows"/*
echo "Updating .readthedocs.yaml configuration..."
sed -i "s|configuration: .*conf\.py|configuration: $install_directory/conf.py|g" "temp-starter-pack/.readthedocs.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.*conf\.py ?

I think we should either use exactly what we have in the readthedocs.yaml file (conf\.py, similar in the next line) or wildcards. Mixing the two doesn't make any sense imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense. I left a whitespace wildcard in there but other than that made it strict as you said.

bootstrap.sh Outdated
echo "Cleaning up..."
rm -rf temp-starter-pack

echo "Setup completed!"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a line break at the end?

readme.rst Outdated Show resolved Hide resolved
readme.rst Outdated
Comment on lines 29 to 30
* Copies contents and workflow files from the starter pack to the installation directory
* Udates working directory paths in workflow files, and updates configuration paths in the .readthedocs.yaml file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are now switched around.

ColmBhandal and others added 6 commits August 30, 2023 14:27
Co-authored-by: Ruth Fuchss <ruth.fuchss@canonical.com>
Co-authored-by: Ruth Fuchss <ruth.fuchss@canonical.com>
The description steps need to be reordered
The order in the script has changed
bootstrap.sh Outdated Show resolved Hide resolved
SSH will only work for those with it set up
@ColmBhandal ColmBhandal merged commit 0a468e4 into main Aug 31, 2023
4 of 6 checks passed
@pmatulis
Copy link

Why was this merged if the tests didn't pass?

@ColmBhandal
Copy link
Contributor Author

Why was this merged if the tests didn't pass?

I have no idea what happened. I swear I didn't click the merge button, but the above seems to prove otherwise... anyway, Ruth reverted the commit and force pushed main very quickly afterwards so should be all good.

@ColmBhandal ColmBhandal mentioned this pull request Sep 6, 2023
@ru-fu ru-fu deleted the 83-setup-script branch June 13, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup Script
4 participants