Ready to install.

This commit is contained in:
tmerritt committed 2021-07-24 14:35:10 -04:00
1 parent c6387a96f2
commit 8134556e58
20 files changed
+713 -88

No files matched your search

+3
View File
@@ -2,3 +2,6 @@
path = dotbot
url = https://github.com/anishathalye/dotbot
ignore = dirty
[submodule "dotbot-git"]
path = plugins/dotbot-git
url = https://github.com/DrDynamic/dotbot-git.git
View File
File renamed without changes.
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
set -e
git rev-parse --abbrev-ref HEAD
+33
View File
@@ -0,0 +1,33 @@
[user]
email = trevor.merritt@gmail.com
name = Trevor Merritt
[init]
defaultBranch = main
templatedir = ~/.git_template
[push]
default = current
[color]
ui = auto
[alias]
aa = add --all
ap = add --patch
branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes
ci = commit -v
co = checkout
pf = push --force-with-lease
st = status
[core]
excludesfile = ~/.gitignore
autocrlf = input
[merge]
ff = only
[commit]
template = ~/.gitmessage
[fetch]
prune = true
[rebase]
autosquash = true
[include]
path = ~/.gitconfig.local
[diff]
colorMoved = zebra
-3
View File
@@ -1,3 +0,0 @@
[user]
email = trevor.merritt@gmail.com
name = Trevor Merritt
+3 -1
View File
@@ -12,4 +12,6 @@ cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}" \
-p ${BASEDIR}/plugins/dotbot-git/git.py \
+15 -5
View File
@@ -1,10 +1,20 @@
- clean: ['~']
- defaults:
link:
relink: true
- link:
~/.bash_logout: bash_logout
~/.gitconfig: gitconfig
# Bash
~/.bash_logout: ./bash/bash_logout
# Git
~/.gitconfig: ./git/gitconfig
# SSH
~/.ssh/config:
path: ssh/config
create: true
# ZSH
~/.zshrc: ./zsh/zshrc
~/.zshenv: ./zsh/zshenv
# Postgres
~/.psqlrc: ./postgres/psqlrc
# tmux
~/.tmux.conf: ./tmux/tmux.conf
+129
View File
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
+82
View File
@@ -0,0 +1,82 @@
[dotbot_repo]: https://github.com/anishathalye/dotbot
## Dotbot ```git``` Plugin
Plugin for [Dotbot][dotbot_repo], that adds ```git``` directive, which allows you to clone or pull git repositories.
## Installation
1. Simply add this repo as a submodule of your dotfiles repository:
```
git submodule add https://github.com/DrDynamic/dotbot-git.git
```
2. Pass this folder (or directly git.py file) path with corresponding flag to your [Dotbot][dotbot_repo] script:
- ```-p /path/to/file/git.py```
or
- ```--plugin-dir /pato/to/plugin/folder```
## Requirements
This plugin needs git 2.22 or later to be installes.
Also please note, that this plugin clones repositories direcly into the given path.
No subfolders are created!
## Properties
| Name | Description | Required |
| --- | --- | --- |
| url | The URL to the remote repository | Required |
| branch | The branch to checkout after clone (or pull) | optional |
| commit | The commit to checkout after clone (or pull) | optional |
| method | Either clone, pull or clone-or-pull (see **Supported methods**) | optional |
| description | The description of the Repository (only for log output) | optional |
### Supported methods
| Method | Description |
| --- | --- |
| clone | Just clone the repository and checkout the configured branch / commit. Ignore that entry if that is alredy done.|
| pull | Just pull the existing directory. Failes if the directory doesn't exist or isnt a git repository |
| clone-or-pull | DEFAULT - Clones the repository if it doesnt exist or pulls changes if it does. |
## Supported task variants
```yaml
...
- git:
'/local/path/to/clone/to':
url: <url to repository>
branch: <name of the branch>
commit: <commit hash>
method: <clone|pull|clone-or-pull>
description: <name of the repository or something like that>
...
...
```
## Usage
### Example config
```yaml
...
- git:
'~/.oh-my-zsh/custom/plugins/zsh-autosuggestions':
url: 'https://github.com/zsh-users/zsh-autosuggestions'
description: 'oh my zsh - autosuggestions'
'~/.oh-my-zsh/custom/themes/powerlevel10k':
url: 'https://github.com/romkatv/powerlevel10k.git'
description: 'oh my zsh - powerlevel10k'
...
...
```
### Execution
```bash
"~/.dotfiles/bin/dotbot" -d "~/.dotfiles" -c "~/.dotfiles/packages.yaml" -p "~/.dotfiles/plugins/dotbot-git/git.py"
```
+173
View File
@@ -0,0 +1,173 @@
import subprocess, dotbot, os
from pprint import PrettyPrinter
class DotbotGit(dotbot.Plugin):
_directive = 'git'
def can_handle(self, directive):
return self._directive == directive
def handle(self, directive, data):
if directive != self._directive:
raise ValueError('git cannot handle directive %s' %
directive)
success = True
for clone_path in data:
repo_definition = data[clone_path]
repo = self.Repository(self._log)
repo.path = os.path.expanduser(clone_path)
if 'url' in repo_definition:
repo.url = repo_definition['url']
else:
success = False
self._log.error('Failed to clone repository! (no url specified)')
continue
if 'branch' in repo_definition:
repo.branch = repo_definition['branch']
if 'commit' in repo_definition:
repo.commit = repo_definition['commit']
if 'method' in repo_definition:
if repo_definition['method'] in ['clone', 'pull', 'clone-or-pull']:
repo.method = repo_definition['method']
else:
self._log.warning('Method '+repo_definition['method']
+'is not defined! (Will be ignored...)')
if 'description' in repo_definition:
repo.description = repo_definition['description']
if not repo.load():
success = False
return success
class Repository:
path=None
url=None
branch=None
commit=None
method='clone-or-pull'
description=None
_log = None
def __init__(self, _log):
self._log = _log
def load(self):
method = None
# check the load method to use
if self.method == 'clone':
method = 'clone'
if self.method == 'pull':
method = 'pull'
if self.method == 'clone-or-pull':
if self._repo_exists():
method = 'pull'
else:
method = 'clone'
# sanity checks
if method == 'clone':
if self._repo_exists():
method = None
self._log.lowinfo("Repository already exists! Won't clone " + self._get_description())
if method == 'pull':
if not self._repo_exists():
method = None
self._log.error("Repository doesn't exist! Woun't pull " + self._get_description())
# loading
success = True
if method == 'clone':
success = self._clone()
self._log.lowinfo('Cloned ' + self._get_description())
elif method == 'pull':
success = self._pull()
self._log.lowinfo('Pulled ' + self._get_description())
if self.branch is not None:
current_branch = self._get_current_branch()
if current_branch != self.branch:
self._checkout('branch')
if self.commit is not None:
current_commit = self._get_current_commit()
if current_commit != self.commit:
self.checkout('commit')
return success
def _clone(self):
if not os.path.isdir(self.path):
os.makedirs(self.path)
command = 'git clone --quiet '
command += self.url + ' ' + self.path
return self._run_command(command)
def _pull(self):
command = 'git --work-tree="' + self.path + '"'
command += ' --git-dir="' + self.path + '/.git"'
command += ' pull --quiet'
return self._run_command(command)
def _checkout(self, source='branch'):
if source == 'branch':
if self.branch is None:
return True
goto = self.branch
if source == 'commit':
if self.commit is None:
return True
goto = self.commit
command = 'git --work-tree="'+self.path+'"'
command += ' --git-dir="'+self.path+'/.git"'
command += ' checkout --quiet --force ' + goto
return self._run_command(command)
def _get_current_commit(self):
p = subprocess.Popen(
['git --git-dir="'+self.path+'/.git" rev-parse HEAD'],
shell=True,
stdout=subprocess.PIPE)
output = p.communicate()[0].decode()
if p.returncode == 0:
return output.strip()
return False
def _get_current_branch(self):
p = subprocess.Popen(
['git --git-dir="' + self.path + '/.git" branch --show-current'],
shell=True,
stdout=subprocess.PIPE)
output = p.communicate()[0].decode()
if p.returncode == 0:
return output.strip()
return False
def _run_command(self, command):
try:
subprocess.run(
[command],
shell=True,
check=True)
return True
except subprocess.CalledProcessError:
self._log.error('git command failed...')
return False
def _repo_exists(self):
return os.path.isdir(os.path.join(self.path, '.git'))
def _get_description(self):
if self.description is None:
return 'into ' + self.path
else:
return self.description
+28
View File
@@ -0,0 +1,28 @@
-- Official docs: http://www.postgresql.org/docs/9.3/static/app-psql.html
-- Unofficial docs: http://robots.thoughtbot.com/improving-the-command-line-postgres-experience
-- Don't display the "helpful" message on startup.
\set QUIET 1
\pset null '[NULL]'
-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING
\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
-- PROMPT2 is printed when the prompt expects more input, like when you type
-- SELECT * FROM<enter>. %R shows what type of input it expects.
\set PROMPT2 '[more] %R > '
-- Show how long each query takes to execute
\timing
-- Use best available output format
\x auto
\set VERBOSITY verbose
\set HISTFILE ~/.psql_history- :DBNAME
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
\unset QUIET
-- psql can't check for a file's existence, so we'll provide an empty local
-- file that users can override with their custom dotfiles. To set your own
-- personal settings, place your own file in ~/.psqlrc.local
\i ~/.psqlrc.local
-79
View File
@@ -1,93 +1,14 @@
Host 192.168.0.141
KexAlgorithms diffie-hellman-group-exchange-sha1
Host localdev
HostName 192.168.122.246
Host config.ptbo.achi.tech
HostName config.ptbo.achi.tech
Host 172.24.4.126
HostName 172.24.4.126
User root
Host 172.24.4.160
HostName 172.24.4.160
User tmerritt
Host 172.24.4.124
HostName 172.24.4.124
Host git.pyrocode.xyz
Port 2222
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa
# entry generated by okteto
Host phoneorders.okteto
ForwardAgent yes
HostName localhost
Port 36087
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
# entry generated by okteto
Host orchard.okteto
ForwardAgent yes
HostName localhost
Port 40245
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
# entry generated by okteto
Host orchardui.okteto
ForwardAgent yes
HostName localhost
Port 43873
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
# entry generated by okteto
Host lilith-server.okteto
ForwardAgent yes
HostName localhost
Port 2222
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
# entry generated by okteto
Host lilith-server-dev.okteto
ForwardAgent yes
HostName localhost
Port 33583
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
# entry generated by okteto
Host devserverlilith.okteto
ForwardAgent yes
HostName localhost
Port 46367
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
# entry generated by okteto
Host dev-server-lilith.okteto
ForwardAgent yes
HostName localhost
Port 36799
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
Host 172.24.4.115
HostName 172.24.4.115
User tmerritt
Host 172.24.4.225
HostName 172.24.4.225
Host 172.24.4.222
HostName 172.24.4.222
Host 10.1.24.115
HostName 10.1.24.115
User tmerritt
# entry generated by okteto
Host devlilith.okteto
ForwardAgent yes
PubkeyAcceptedKeyTypes +ssh-rsa
HostName localhost
Port 43405
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile "/home/tmerritt/.okteto/id_rsa_okteto"
+24
View File
@@ -0,0 +1,24 @@
# improve colors
set -g default-terminal 'screen-256color'
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# soften status bar color from harsh green to light gray
set -g status-style bg='#666666',fg='#aaaaaa'
# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right ''
# increase scrollback lines
set -g history-limit 10000
# prefix -> back-one-character
bind-key C-b send-prefix
# prefix-2 -> forward-incremental-history-search
bind-key C-s send-prefix -2
+6
View File
@@ -0,0 +1,6 @@
# makes color constants available
autoload -U colors
colors
# enable colored output from ls, etc. on FreeBSD-based systems
export CLICOLOR=1
+2
View File
@@ -0,0 +1,2 @@
export VISUAL=nano
export EDITOR=$VISUAL
+6
View File
@@ -0,0 +1,6 @@
setopt hist_ignore_all_dups inc_append_history
HISTFILE=~/.zhistory
HISTSIZE=4096
SAVEHIST=4096
export ERL_AFLAGS="-kernel shell_history enabled"
+15
View File
@@ -0,0 +1,15 @@
# load our own completion functions
fpath=(~/.zsh/completion /usr/local/share/zsh/site-functions $fpath)
# completion; use cache if updated within 24h
autoload -Uz compinit
if [[ -n $HOME/.zcompdump(#qN.mh+24) ]]; then
compinit -d $HOME/.zcompdump;
else
compinit -C;
fi;
# disable zsh bundled function mtools command mcd
# which causes a conflict.
compdef -d mcd
+14
View File
@@ -0,0 +1,14 @@
# modify the prompt to contain git branch name if applicable
git_prompt_info() {
current_branch=$(git current-branch 2> /dev/null)
if [[ -n $current_branch ]]; then
echo " %{$fg_bold[green]%}$current_branch%{$reset_color%}"
fi
}
setopt promptsubst
# Allow exported PS1 variable to override default prompt.
if ! env | grep -q '^PS1='; then
PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '
fi
+29
View File
@@ -0,0 +1,29 @@
local _old_path="$PATH"
# Local config
[[ -f ~/.zshenv.local ]] && source ~/.zshenv.local
if [[ $PATH != $_old_path ]]; then
# `colors` isn't initialized yet, so define a few manually
typeset -AHg fg fg_bold
if [ -t 2 ]; then
fg[red]=$'\e[31m'
fg_bold[white]=$'\e[1;37m'
reset_color=$'\e[m'
else
fg[red]=""
fg_bold[white]=""
reset_color=""
fi
cat <<MSG >&2
${fg[red]}Warning:${reset_color} your \`~/.zshenv.local' configuration seems to edit PATH entries.
Please move that configuration to \`.zshrc.local' like so:
${fg_bold[white]}cat ~/.zshenv.local >> ~/.zshrc.local && rm ~/.zshenv.local${reset_color}
(called from ${(%):-%N:%i})
MSG
fi
unset _old_path
+146
View File
@@ -0,0 +1,146 @@
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/tmerritt/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nano'
else
export EDITOR='nano'
fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# load custom executable functions
for function in ~/.zsh/functions/*; do
source $function
done
# extra files in ~/.zsh/configs/pre , ~/.zsh/configs , and ~/.zsh/configs/post
# these are loaded first, second, and third, respectively.
_load_settings() {
_dir="$1"
if [ -d "$_dir" ]; then
if [ -d "$_dir/pre" ]; then
for config in "$_dir"/pre/**/*~*.zwc(N-.); do
. $config
done
fi
for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/(pre|post)/*|*.zwc)
:
;;
*)
. $config
;;
esac
done
if [ -d "$_dir/post" ]; then
for config in "$_dir"/post/**/*~*.zwc(N-.); do
. $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
# aliases
[[ -f ~/.aliases ]] && source ~/.aliases