Skip to content

Commit

Permalink
Merge pull request #6 from knewkarma-io/dev
Browse files Browse the repository at this point in the history
7.0.3
  • Loading branch information
rly0nheart authored Oct 8, 2024
2 parents 12958b0 + 0200b76 commit e45f7ff
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 25 deletions.
Binary file removed docs/source/_static/favicon.ico
Binary file not shown.
Binary file added docs/source/_static/favicon16x16.ico
Binary file not shown.
Binary file removed docs/source/_static/logo.png
Binary file not shown.
Binary file added docs/source/_static/logo512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
html_css_files = [
"custom.css",
]
html_favicon = "_static/favicon.ico"
html_logo = "_static/logo.png"
html_favicon = "_static/favicon16x16.ico"
html_logo = "_static/logo512x512.png"
html_show_sphinx = False
html_show_sourcelink = False
html_sidebars = {
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A Reddit Data Analysis Toolkit.
.. raw:: html

<p align="center">
<a href="https://github.com/rly0nheart/knewkarma"><img alt="Code Style" src="https://img.shields.io/badge/code%20style-black-000000?logo=github&link=https%3A%2F%2Fgithub.com%2Frly0nheart%2Fknewkarma"></a>
<a href="https://github.com/knewkarma-io/knewkarma"><img alt="Code Style" src="https://img.shields.io/badge/code%20style-black-000000?logo=github&link=https%3A%2F%2Fgithub.com%2Frly0nheart%2Fknewkarma"></a>
<a href="https://pepy.tech/project/knewkarma"><img alt="Downloads" src="https://img.shields.io/pepy/dt/knewkarma?logo=pypi"></a>
<a href="https://pypi.org/project/knewkarma"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/knewkarma?logo=pypi&link=https%3A%2F%2Fpypi.org%2Fproject%2Fknewkarma"></a>
<a href="https://snapcraft.io/knewkarma"><img alt="Snap Version" src="https://img.shields.io/snapcraft/v/knewkarma/latest/stable?logo=snapcraft&color=%23BB431A"></a>
Expand Down
Binary file removed snap/gui/icon.png
Binary file not shown.
Binary file added snap/gui/icon512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion snap/gui/knewkarma.desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=Knew Karma
Comment=A Reddit data analysis toolkit
Icon=${SNAP}/snap/gui/icon.png
Icon=${SNAP}/snap/gui/icon512x512.png
Exec=sh "--help"
Terminal=true
Type=Application
Expand Down
2 changes: 1 addition & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: knewkarma
icon: snap/gui/icon.png
icon: snap/gui/icon512x512.png
title: Knew Karma
summary: A Reddit data analysis toolkit
description: |
Expand Down
1 change: 0 additions & 1 deletion src/knewkarma/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def show_license(ctx: click.Context, conditions: bool, warranty: bool):
version.full,
"-v",
"--version",
message=about.copyright,
)
@click.pass_context
def cli(
Expand Down
6 changes: 0 additions & 6 deletions src/knewkarma/meta/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
{name} (/nuː ‘kɑːrmə/) is a Reddit data analysis toolkit designed to provide an extensive range of
functionalities for exploring and analysing Reddit data. It includes a Command-Line Interface (CLI), and an
Application Programming Interface (API) to enable an easy integration in other Python Projects.
📚 Refer to the documentation <{documentation}> for usage examples and integration guide.
❤️ Become a sponsor: <{sponsor}>
"""

# -------------------------------- END ----------------------------------------- #
25 changes: 12 additions & 13 deletions update-version.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

# Function to check if the version argument is provided
# Check if the version argument is provided
check_version_argument() {
if [ -z "$1" ]; then
echo "Usage: $0 <version>"
exit 1
fi
}

# Function to extract version parts (major, minor, patch)
# Extract version parts (major, minor, patch)
extract_version_parts() {
VERSION=$1
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION"
Expand All @@ -17,18 +17,18 @@ extract_version_parts() {
PATCH="${VERSION_PARTS[2]}"
}

# Function to get the absolute path of the current directory
# Get the absolute path of the current directory
get_script_dir() {
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
}

# Function to define absolute file paths
# Define absolute file paths
define_file_paths() {
VERSION_PY="$SCRIPT_DIR/src/knewkarma/meta/version.py"
PYPROJECT_TOML="$SCRIPT_DIR/pyproject.toml"
}

# Function to check if files exist
# Check if files exist
check_files_exist() {
if [ ! -f "$VERSION_PY" ]; then
echo "Error: $VERSION_PY not found!"
Expand All @@ -41,7 +41,7 @@ check_files_exist() {
fi
}

# Function to update version in version.py
# Update version in version.py
update_version_py() {
sed -i.bak "s/major: tuple\[int, str\] = [0-9]\+/major: tuple[int, str] = $MAJOR/" "$VERSION_PY"
sed -i.bak "s/minor: tuple\[int, str\] = [0-9]\+/minor: tuple[int, str] = $MINOR/" "$VERSION_PY"
Expand All @@ -50,29 +50,28 @@ update_version_py() {
sed -i.bak "s/release: str = \"[0-9]\+\.[0-9]\+\"/release: str = \"$MAJOR.$MINOR\"/" "$VERSION_PY"
}

# Function to update version in pyproject.toml
update_pyproject_toml() {
sed -i.bak "s/version = \".*\"/version = \"$VERSION\"/" "$PYPROJECT_TOML"
# Update only the project version in pyproject.toml, ignoring dependencies
update_pyproject_version() {
# Only update the version for the project, without touching dependency versions
sed -i.bak -E "s/version = \"[0-9]+\.[0-9]+\.[0-9]+\"/version = \"$VERSION\"/" "$PYPROJECT_TOML"
}

# Function to clean up backup files created by sed
# Clean up backup files created by sed
cleanup_backup_files() {
rm "${VERSION_PY}.bak"
rm "${PYPROJECT_TOML}.bak"
}

# Main function
main() {
check_version_argument "$1"
extract_version_parts "$1"
get_script_dir
define_file_paths
check_files_exist
update_version_py
update_pyproject_toml
update_pyproject_version
cleanup_backup_files
echo "Version updated to $VERSION in $VERSION_PY and $PYPROJECT_TOML"
}

# Call the main function with the version argument
main "$1"

0 comments on commit e45f7ff

Please sign in to comment.