Skip to content

Instantly share code, notes, and snippets.

@psmay
Created November 6, 2014 17:08
Show Gist options
  • Save psmay/aa12eee038cacae36d1a to your computer and use it in GitHub Desktop.
Save psmay/aa12eee038cacae36d1a to your computer and use it in GitHub Desktop.

StepMania default theme

psmay/stepmania-default-theme is a repo to track only the Themes/default directory within the stepmania project. The goal is to be able to fork the repo, create a new default-based theme, and then be able to observe the relative changes made and merge in improvements made to default as they are added.

How to use

  • Fork the repo.

    • GitHub can only automatically fork a given repository once. If you want to maintain more than one theme based on this repo, you can still fork manually (see below).
  • Replace README.md with information relevant to your theme, remembering to credit the original authors of any material you include.

  • Make changes, commit, push, and so forth.

  • If at any time significant changes are made to the original default theme, merge them from upstream as desired.

To manually fork the repo

export GITHUB_USER=your_github_username
export GITHUB_REPO_NAME=stepmania-my-own-theme
export LOCAL_REPO_NAME="$GITHUB_REPO_NAME"

mkdir "$LOCAL_REPO_NAME" &&
cd "$LOCAL_REPO_NAME" &&
git init &&
git remote add upstream https://github.com/psmay/stepmania-default-theme.git &&
git remote add origin "[email protected]:$GITHUB_USER/$GITHUB_REPO_NAME.git" &&
git pull upstream master &&
git push -u origin master

To manually merge changes from upstream to a manually forked repo

Just pull the changes from upstream master into the desired branch:

git pull upstream master

Resolve conflicts as necessary, review the changes, commit, and push as normal.

Authors and License

This repo consists solely of content created/aggregated by the authors of the stepmania project. Please refer to that project for authorship and licensing details.

Maintainer (psmay) only: Keeping this repo up-to-date

Skip this part if you are only making a derived theme.

The following is a bit about keeping the psmay/stepmania-default-theme repo up to date.

The following script grabs the most recent version from stepmania's master branch, clone the important parts into a psmay/stepmania-default-theme branch, and check it in. I will need to run this periodically.

#!/bin/bash

# Locations

# The "parent" repo is just the stepmania/stepmania repo. Our local clone of
# this repo will be configured as a sparse checkout configured to check out
# only the Themes/default part.
parent_url=https://github.com/stepmania/stepmania.git
parent_branch=master
parent_dir="$HOME/src/stepmania-default-theme_parent"
parent_subdir="Themes/default/"

# The "theme" repo is the psmay/stepmania-default-theme repo. Its basic
# layout is intended to mimic what would happen if you checked out the
# parent repo, copied its Themes/default to a new location, and started a
# new repo inside that copy.
[email protected]:psmay/stepmania-default-theme.git
theme_dir="$HOME/prj/stepmania-default-theme"
theme_branch=master

bq='`'

# To be run the first time; sets up local checkouts
initial_setup () {
    # Create the parent repo.
    git init "$parent_dir" &&
    (
        cd "$parent_dir" &&
        git remote add origin "$parent_url" &&
        git config core.sparsecheckout true &&
        echo "$parent_subdir" >> .git/info/sparse-checkout
    ) &&

    # Clone the theme repo.
    git clone -b "$theme_branch" "$theme_url" "$theme_dir"
}

# To be run at least every time the theme is updated in the parent
update () {
    # Update the parent repo
    (
        cd "$parent_dir" &&
        git pull origin "$parent_branch" &&
        git clean -f -d -x
    ) &&

    # Replace theme repo's files with the parent repo
    rsync -avz \
        --exclude README.md \
        --exclude .git \
        --delete "$parent_dir/$parent_subdir" "$theme_dir/" &&

    # Think of a commit message
    current_date="`date -u -Iseconds`" &&
    commit_msg="Refreshed from $bq$parent_url$bq @ $bq$current_date$bq" &&

    # Check in and push the changes
    # (If nothing changed, no commit will occur)
    (
        cd "$theme_dir" &&
        git add -A &&
        git commit -m "$commit_msg" &&
        git push
    )
}

# initial_setup &&
update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment