Git Product home page Git Product logo

dotfiles's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ Iโ€™m currently working on Amber (for Screeps), Fantasy Advisor, and Twine Games
  • ๐ŸŒฑ Iโ€™m currently learning React, Docker, TypeScript
  • ๐Ÿ˜„ Pronouns: he/him
๐Ÿ“ˆ GitHub Stats...

brisberg-github-stats brisberg-top-langs

dotfiles's People

Watchers

 avatar  avatar

dotfiles's Issues

Set up OSX GitHub action to test install

Still need to reearch this, but it may be possible to set up a scheduled run on a mac runner to run the install script and verify everything works correctly.

Refactor to use feature flags and host definitions

An alternative to using branch based definitions for each host.

In this model, there is only one branch in this repo (main). All hosts will download it and use it directly.
Many areas of the scripts will use conditionals based on env variables to enable or disable certain configurations.

Each host would define their own (or I commit the host definitions here). They would have a file which defines settings for the host (name, hostname, OS ect) as well as the set of feature I want enabled on that host.

For example, that way I can enable Godot on my laptop and desktop, but not on my work machine or raspberrypi.

Pros:
Reduced 'merge' commits as I no longer need to propogate configs down stream.
Easier to understand 'where' configs should go. Right now I need to decide if they are common to all hosts or just one based on where I commit it.
Easier time modifying similar configs on multiple hosts, since they will all use the same script definitions.


Still not sure if branch based or feature flag based is the best option. It relies on different hosts being similar enough for them to work reasonably well with course grain feature flags.

For now I'll stick with branch based until it no longer works.

Cascaded Git Configs do not override values when used

When a git config value is specified more than once, git has some strange behavior.

For example, given this config

user.name = "Brandon Risberg"
user.name = "brisberg"

Running git config user.name results in brisberg. Meaning that the last value takes precedence.

However, performing a git commit given this set up actually signed the commit with "Brandon Risberg". Meaning that the first value takes precedence.

I do not know why this is the case.


For now, I will specify my layed git configs in order of specificity, expecting that the first instance of a variable will be used (contrary to what git config reports).

Add /bin directory with dotfiles-sync script

From the work dotfiles, add this to dotfiles/bin/dotfiles-sync

#!/usr/bin/zsh

# Ensure that local dotfiles have not been modified and synchronize them with
# the remote git repo

local error=false

if [[ ! -z $(git -C $DOTFILES status --porcelain) ]]; then
  echo "\033[0;31mError\033[0m: dotfiles has uncommited files"
  error=true
fi

local branch=$(git -C $DOTFILES rev-parse --abbrev-ref HEAD)
if [[ "$branch" != "$HOST_SHORT" ]]; then
  echo "\033[0;33mWarning\033[0m: dotfiles is not on the correct branch. ('$branch')"
  git -C $DOTFILES checkout $HOST_SHORT
fi

if [[ "$error" = false ]]; then
    echo "Syncing main dotfiles..."
    git -C $DOTFILES pull -r
    git -C $DOTFILES push
    sh $DOTFILES/install
    echo "...done"
fi

make sure to chmod +x bin/dotfiles-sync to make it executable, and make sure that the dotfiles bin directory is on the path

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.