wip: dir organisation, script cleanup
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
.gitignore
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
README.md
|
||||
|
||||
11
.github/workflows/ci.yml
vendored
Normal file
11
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
name: Dotfiles CI
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Run test suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: ./scripts/test.sh
|
||||
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
@@ -1,10 +0,0 @@
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
name: tests
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: make test
|
||||
14
.github/workflows/publish.yml
vendored
Normal file
14
.github/workflows/publish.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: Dotfiles publisher
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
publish-installer:
|
||||
name: Publish install script
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Publish to CDN
|
||||
run: ./scripts/publish.sh
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -1,11 +1,11 @@
|
||||
# install artefacts
|
||||
**/tmp
|
||||
**/logs
|
||||
**/*.deb
|
||||
|
||||
# custom functions
|
||||
!files/.config/fish/functions/nvm.fish
|
||||
|
||||
# install artefacts
|
||||
tmp
|
||||
logs/*
|
||||
**/*.deb
|
||||
|
||||
# setup files
|
||||
**/plugged
|
||||
**/autoload
|
||||
@@ -21,10 +21,6 @@ logs/*
|
||||
**/firebase
|
||||
**/pypoetry
|
||||
|
||||
# pytest
|
||||
**/__pycache__
|
||||
**/.pytest_cache
|
||||
|
||||
# ssh env
|
||||
**/id_rsa*
|
||||
**/known_hosts*
|
||||
|
||||
54
Dockerfile
54
Dockerfile
@@ -1,28 +1,44 @@
|
||||
FROM ubuntu:bionic as install
|
||||
#
|
||||
# ubuntu-base: Base Ubuntu image with sudo user
|
||||
#
|
||||
FROM ubuntu:focal AS ubuntu-base
|
||||
|
||||
# Install sudo and make, git since built-in is skipped
|
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
RUN apt-get -qqy update \
|
||||
&& apt-get -qqy install curl git make software-properties-common sudo
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt-get -qy update
|
||||
RUN apt-get -qy install --no-install-recommends \
|
||||
apt-utils software-properties-common sudo
|
||||
|
||||
# Create user with sudo priviledge
|
||||
ARG USER="test-user"
|
||||
RUN useradd --create-home -m "$USER" \
|
||||
&& adduser "$USER" sudo
|
||||
RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" \
|
||||
RUN useradd -r -u 1001 --create-home -m "test-user"
|
||||
RUN adduser "test-user" sudo
|
||||
RUN echo "test-user ALL=(ALL) NOPASSWD: ALL" \
|
||||
>>/etc/sudoers
|
||||
|
||||
# Filesystem steps
|
||||
RUN rm /home/$USER/.profile /home/$USER/.bashrc
|
||||
ENV WORKSPACE="/home/$USER/workspace"
|
||||
ADD --chown=test-user . "$WORKSPACE/dotfiles"
|
||||
WORKDIR "$WORKSPACE/dotfiles"
|
||||
|
||||
# Install steps
|
||||
#
|
||||
# source: Source steps
|
||||
#
|
||||
FROM ubuntu-base AS source
|
||||
|
||||
ARG DOTFILES_DIR="/home/test-user/.dotfiles"
|
||||
ADD --chown="test-user" . "$DOTFILES_DIR"
|
||||
WORKDIR "$DOTFILES_DIR"
|
||||
|
||||
|
||||
#
|
||||
# install: Install steps
|
||||
#
|
||||
FROM source AS install
|
||||
|
||||
USER test-user
|
||||
ARG TARGET="all"
|
||||
ENV LOG_TARGET="STDOUT"
|
||||
RUN make install TARGET=$TARGET
|
||||
ENV USER=test-user
|
||||
ENV UUID="docker"
|
||||
RUN ./scripts/install.sh
|
||||
|
||||
# Test entrypoint
|
||||
ENTRYPOINT [ "make", "--directory", "tests", "TARGET=$TARGET" ]
|
||||
|
||||
#
|
||||
# test: Test entrypoint
|
||||
#
|
||||
FROM install AS test
|
||||
ENTRYPOINT [ "tests/run.sh" ]
|
||||
|
||||
35
Makefile
35
Makefile
@@ -1,35 +0,0 @@
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Local commands
|
||||
# ---------------------------------------------------------------------------- #
|
||||
.PHONY: clean install
|
||||
|
||||
# Install dotfiles to home folder
|
||||
all:
|
||||
./bootstrap.pl
|
||||
|
||||
# @arg $TARGET binary to install
|
||||
install:
|
||||
./install.pl
|
||||
|
||||
clean:
|
||||
rm -rf logs
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Docker commands
|
||||
# ---------------------------------------------------------------------------- #
|
||||
.PHONY: build test start
|
||||
|
||||
# Build and tag docker image
|
||||
build:
|
||||
docker build . -t dotfiles:latest
|
||||
|
||||
# Run tests in docker container
|
||||
# @arg $TARGET binary to install and test
|
||||
test:
|
||||
docker build . -t dotfiles:localtest \
|
||||
--build-arg TARGET=$$TARGET \
|
||||
&& docker run dotfiles:localtest
|
||||
|
||||
# Launch bash in docker container
|
||||
start:
|
||||
docker run -it dotfiles:latest /bin/bash
|
||||
33
README.md
33
README.md
@@ -1,31 +1,28 @@
|
||||
# dotfiles
|
||||
# andrejusk/dotfiles
|
||||
|
||||
Collection of experimental dotfiles and supporting install scripts.
|
||||
Tested on and compatible with:
|
||||
|
||||
- Ubuntu 20.04
|
||||
|
||||
## Install
|
||||
|
||||
wget https://raw.githubusercontent.com/andrejusk/dotfiles/master/setup.pl -qO - | perl
|
||||
wget https://raw.githubusercontent.com/andrejusk/dotfiles/master/scripts/setup.sh -qO - | bash
|
||||
|
||||
## Stack
|
||||
|
||||
Shell: 🐟 fish (+ fisher)
|
||||
### Shell
|
||||
🐟 fish (+ fisher)
|
||||
|
||||
Editor: neovim (+ vim-plug)
|
||||
### Editor
|
||||
neovim (+ vim-plug)
|
||||
|
||||
Tools:
|
||||
### Languages
|
||||
|
||||
- aws, gcloud, firebase
|
||||
- docker (+ docker-compose)
|
||||
- kubectl
|
||||
- terraform
|
||||
- screenfetch
|
||||
|
||||
Languages:
|
||||
|
||||
- java
|
||||
- js (nvm, node, yarn)
|
||||
- python (pyenv, poetry)
|
||||
- ruby
|
||||
- java
|
||||
|
||||
### Tools
|
||||
|
||||
- docker (+ docker-compose)
|
||||
- terraform
|
||||
- gcloud, firebase, awscli
|
||||
- screenfetch
|
||||
|
||||
26
bootstrap.pl
26
bootstrap.pl
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use autodie;
|
||||
|
||||
use Cwd;
|
||||
use Data::Dumper;
|
||||
use Stow;
|
||||
|
||||
|
||||
my $dir = getcwd;
|
||||
my $target = $ENV{'HOME'};
|
||||
print "Stowing $dir/files to $target\n";
|
||||
|
||||
my %stow_options = ( dir => $dir,
|
||||
target => $target );
|
||||
my $stow = new Stow(%stow_options);
|
||||
|
||||
my @pkgs = ('files');
|
||||
$stow->plan_stow(@pkgs);
|
||||
my %conflicts = $stow->get_conflicts;
|
||||
if (%conflicts) {
|
||||
my $dump = Dumper(%conflicts);
|
||||
die("Failed to stow, conflicts: $dump");
|
||||
}
|
||||
$stow->process_tasks();
|
||||
21
config.json
Normal file
21
config.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"apt_dependencies": [
|
||||
"bat",
|
||||
"curl",
|
||||
"cowsay",
|
||||
"fd-find",
|
||||
"figlet",
|
||||
"fortune-mod",
|
||||
"git",
|
||||
"gnupg2",
|
||||
"jq",
|
||||
"make",
|
||||
"neovim",
|
||||
"net-tools",
|
||||
"openssh-client",
|
||||
"openssh-server",
|
||||
"screenfetch",
|
||||
"stow",
|
||||
"tmux"
|
||||
]
|
||||
}
|
||||
@@ -152,12 +152,17 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
|
||||
\ 'coc-perl',
|
||||
\ 'coc-prettier',
|
||||
\ 'coc-python',
|
||||
\ 'coc-react-refactor',
|
||||
\ 'coc-rust-analyzer',
|
||||
\ 'coc-sh',
|
||||
\ 'coc-snippets',
|
||||
\ 'coc-styled-components',
|
||||
\ 'coc-svg',
|
||||
\ 'coc-swagger',
|
||||
\ 'coc-tabnine',
|
||||
\ 'coc-toml',
|
||||
\ 'coc-tslint',
|
||||
\ 'coc-tslint-plugin',
|
||||
\ 'coc-tsserver',
|
||||
\ 'coc-vimlsp',
|
||||
\ 'coc-xml',
|
||||
@@ -165,6 +170,10 @@ Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
|
||||
\ ]
|
||||
" }}}
|
||||
|
||||
" ts
|
||||
Plug 'HerringtonDarkholme/yats.vim'
|
||||
Plug 'maxmellon/vim-jsx-pretty'
|
||||
|
||||
" elm
|
||||
Plug 'andys8/vim-elm-syntax'
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ fi
|
||||
# pyenv
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
export PATH="$PYENV_ROOT/shims:$PATH"
|
||||
if [ -d "$PYENV_ROOT" ]; then
|
||||
[ -x "$(command -v pyenv)" ] && eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
62
install.pl
62
install.pl
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use warnings;
|
||||
use autodie;
|
||||
|
||||
use File::Basename;
|
||||
|
||||
# Prevent running as root
|
||||
if ($< == 0) {
|
||||
print "Failed: Running as root. Please run as user, not sudo\n";
|
||||
exit (1);
|
||||
}
|
||||
|
||||
my $dir = dirname(__FILE__);
|
||||
|
||||
my $log_target = $ENV{'LOG_TARGET'} // '';
|
||||
my $log_path = '';
|
||||
if ($log_target ne 'STDOUT') {
|
||||
# Generate unique logfile
|
||||
my $log_dir = "$dir/logs";
|
||||
`mkdir -p $log_dir`;
|
||||
my $uuid = `uuidgen`;
|
||||
chomp $uuid;
|
||||
$log_path = "$log_dir/$uuid.log";
|
||||
}
|
||||
print "Logs: $log_path\n";
|
||||
|
||||
# Execute given command and log appropriately
|
||||
# @arg 0 command to run
|
||||
sub log_execute {
|
||||
my $command = $log_path ne ''
|
||||
? "$_[0] >> $log_path 2>&1"
|
||||
: $_[0];
|
||||
system($command) == 0
|
||||
or die "system $command failed: $?";
|
||||
}
|
||||
|
||||
|
||||
# Ensure dependencies installed
|
||||
log_execute("sudo apt-get update -qqy && sudo apt-get install -qqy build-essential liblocal-lib-perl cpanminus stow");
|
||||
|
||||
# Bootstrap files
|
||||
log_execute("make -C $dir");
|
||||
|
||||
# Read scripts to be installed
|
||||
my $install_dir = "$dir/install";
|
||||
print "Installing $install_dir\n";
|
||||
opendir($dir, $install_dir) or die "Could not open $install_dir\n";
|
||||
my @files = readdir($dir);
|
||||
closedir($dir);
|
||||
@files = grep(/^\d{2}-.*\.sh$/, @files);
|
||||
@files = sort { lc($a) cmp lc($b) } @files;
|
||||
|
||||
# Install selected targets
|
||||
my $target = $ENV{'TARGET'} // 'all';
|
||||
if ($target ne 'all') {
|
||||
@files = grep(/${target}/, @files);
|
||||
}
|
||||
foreach my $file (@files) {
|
||||
print "Running $file...\r";
|
||||
log_execute("$install_dir/$file");
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
apt-transport-https
|
||||
bat
|
||||
curl
|
||||
cowsay
|
||||
fd-find
|
||||
fortune-mod
|
||||
git
|
||||
gnupg2
|
||||
jq
|
||||
make
|
||||
neovim
|
||||
net-tools
|
||||
openssh-client
|
||||
openssh-server
|
||||
ripgrep
|
||||
ruby-full
|
||||
software-properties-common
|
||||
tmux
|
||||
universal-ctags
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
clean
|
||||
update
|
||||
upgrade
|
||||
echo "apt cleaned, updated, upgraded"
|
||||
|
||||
package_list_file="$install_dir/00-apt-pkglist"
|
||||
install_file "$package_list_file"
|
||||
echo "list of dependencies installed"
|
||||
|
||||
cat /etc/os-release
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# pyenv is installed
|
||||
if not_installed "pyenv"; then
|
||||
|
||||
echo "Installing pyenv..."
|
||||
|
||||
# Install pyenv prerequisites
|
||||
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
|
||||
pyenv_list_file="$install_dir/10-pyenv-pkglist"
|
||||
install_file "$pyenv_list_file"
|
||||
|
||||
# Install pyenv
|
||||
# see https://github.com/pyenv/pyenv-installer
|
||||
run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
|
||||
"bash"
|
||||
|
||||
fi
|
||||
echo "pyenv is installed, upgrading $PYENV_ROOT..."
|
||||
git --git-dir="$PYENV_ROOT/.git" fetch -q
|
||||
git --git-dir="$PYENV_ROOT/.git" rebase -q --autostash FETCH_HEAD
|
||||
|
||||
pyenv --version
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# nvm is installed
|
||||
if not_installed "nvm"; then
|
||||
|
||||
printf "Installing nvm...\n"
|
||||
|
||||
# Install nvm
|
||||
mkdir -p $NVM_DIR
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \
|
||||
"bash"
|
||||
source "$NVM_DIR/nvm.sh"
|
||||
nvm alias default node
|
||||
nvm install node
|
||||
|
||||
fi
|
||||
|
||||
printf "nvm is installed, upgrading...\n"
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh" \
|
||||
"bash"
|
||||
|
||||
nvm --version
|
||||
nvm use node
|
||||
node --version
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# yarn is installed
|
||||
if not_installed "yarn"; then
|
||||
|
||||
echo "Installing yarn..."
|
||||
|
||||
# Install yarn
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
update
|
||||
sudo apt install --no-install-recommends yarn
|
||||
|
||||
fi
|
||||
|
||||
echo "yarn is installed"
|
||||
# yarn --version
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "elm"; then
|
||||
# Download the 0.19.1 binary for Linux.
|
||||
#
|
||||
# +-----------+----------------------+
|
||||
# | FLAG | MEANING |
|
||||
# +-----------+----------------------+
|
||||
# | -L | follow redirects |
|
||||
# | -o elm.gz | name the file elm.gz |
|
||||
# +-----------+----------------------+
|
||||
#
|
||||
curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz
|
||||
|
||||
# There should now be a file named `elm.gz` on your Desktop.
|
||||
#
|
||||
# The downloaded file is compressed to make it faster to download.
|
||||
# This next command decompresses it, replacing `elm.gz` with `elm`.
|
||||
#
|
||||
gunzip elm.gz
|
||||
|
||||
# There should now be a file named `elm` on your Desktop!
|
||||
#
|
||||
# Every file has "permissions" about whether it can be read, written, or executed.
|
||||
# So before we use this file, we need to mark this file as executable:
|
||||
#
|
||||
chmod +x elm
|
||||
|
||||
# The `elm` file is now executable. That means running `~/Desktop/elm --help`
|
||||
# should work. Saying `./elm --help` works the same.
|
||||
#
|
||||
# But we want to be able to say `elm --help` without specifying the full file
|
||||
# path every time. We can do this by moving the `elm` binary to one of the
|
||||
# directories listed in your `PATH` environment variable:
|
||||
#
|
||||
sudo mv elm /usr/local/bin/
|
||||
rm {elm,elm.gz}
|
||||
fi
|
||||
|
||||
npm install -g @elm-tooling/elm-language-server elm-format elm-test
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "kubectl"; then
|
||||
echo "Installing kubectl..."
|
||||
sudo apt-get update && sudo apt-get install -y apt-transport-https gnupg2
|
||||
|
||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||
|
||||
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
|
||||
|
||||
update
|
||||
|
||||
install kubectl
|
||||
refresh
|
||||
fi
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
echo "cleaning"
|
||||
clean
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "screenfetch"; then
|
||||
echo "Installing screenfetch..."
|
||||
install screenfetch
|
||||
fi
|
||||
|
||||
echo "screenfetch is installed"
|
||||
screenfetch --version
|
||||
screenfetch
|
||||
112
install/utils.sh
112
install/utils.sh
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper functions
|
||||
# ---------------------------------------------------------------------------- #
|
||||
clean() {
|
||||
sudo apt-get clean
|
||||
}
|
||||
|
||||
update() {
|
||||
sudo apt-get update
|
||||
}
|
||||
|
||||
# Non-interactive upgrade
|
||||
upgrade() {
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
sudo apt-get \
|
||||
-o Dpkg::Options::="--force-confdef" \
|
||||
-o Dpkg::Options::="--force-confold" \
|
||||
-y \
|
||||
dist-upgrade
|
||||
sudo apt-get -y autoremove
|
||||
}
|
||||
|
||||
# @arg $1 packages to install
|
||||
install() {
|
||||
sudo apt-get install -qqy $1
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 package list file to install
|
||||
install_file() {
|
||||
sudo apt-get install -qqyf $(cat $1)
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 repository to add
|
||||
add_ppa() {
|
||||
sudo add-apt-repository -y ppa:$1
|
||||
}
|
||||
|
||||
# @arg $1 url to add
|
||||
# @arg $2 keyring to add to
|
||||
add_key() {
|
||||
curl -fsSL $1 | sudo apt-key --keyring "/etc/apt/trusted.gpg.d/$2.gpg" add
|
||||
}
|
||||
|
||||
# @arg $1 URL to run
|
||||
# @arg $2 binary to use
|
||||
run() {
|
||||
curl -fsSL $1 | $2 | indent
|
||||
}
|
||||
|
||||
# Symlink contents of source folder to target
|
||||
#
|
||||
# @arg $1 source folder
|
||||
# @arg $2 target folder
|
||||
link_folder() {
|
||||
mkdir -p $2
|
||||
cp -srf $1/. $2
|
||||
}
|
||||
|
||||
indent() { sed 's/^/ /'; }
|
||||
|
||||
# @arg $1 binary to test
|
||||
not_installed() {
|
||||
! [ -x "$(command -v $1)" ]
|
||||
}
|
||||
|
||||
# Refreshes PATH
|
||||
refresh() {
|
||||
hash -r
|
||||
}
|
||||
|
||||
# Add to PATH and refresh
|
||||
# @arg $1 path to add to PATH
|
||||
add_path() {
|
||||
export PATH="$1:$PATH"
|
||||
refresh
|
||||
}
|
||||
|
||||
export -f clean update upgrade install install_file add_ppa add_key run \
|
||||
link_folder indent not_installed refresh add_path
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Shell colours
|
||||
# ---------------------------------------------------------------------------- #
|
||||
C_BLACK='\033[0;30m'
|
||||
C_DGRAY='\033[1;30m'
|
||||
C_RED='\033[0;31m'
|
||||
C_LRED='\033[1;31m'
|
||||
C_GREEN='\033[0;32m'
|
||||
C_LGREEN='\033[1;32m'
|
||||
C_ORANGE='\033[0;33m'
|
||||
C_YELLOW='\033[1;33m'
|
||||
C_BLUE='\033[0;34m'
|
||||
C_LBLUE='\033[1;34m'
|
||||
C_PURPLE='\033[0;35m'
|
||||
C_LPURPLE='\033[1;35m'
|
||||
C_CYAN='\033[0;36m'
|
||||
C_LCYAN='\033[1;36m'
|
||||
C_LGRAY='\033[0;37m'
|
||||
C_WHITE='\033[1;37m'
|
||||
C_NC='\033[0m'
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper variables #
|
||||
# ---------------------------------------------------------------------------- #
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
install_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
dotfiles_dir="$(dirname "$install_dir")"
|
||||
source "$dotfiles_dir/files/.bash_profile"
|
||||
refresh
|
||||
36
modules/published-dots/main.tf
Normal file
36
modules/published-dots/main.tf
Normal file
@@ -0,0 +1,36 @@
|
||||
# Static bucket
|
||||
resource "google_storage_bucket" "bucket" {
|
||||
provider = google-beta
|
||||
|
||||
project = var.project
|
||||
|
||||
name = var.domain
|
||||
location = "EU"
|
||||
storage_class = "MULTI_REGIONAL"
|
||||
|
||||
versioning {
|
||||
enabled = var.enable_versioning
|
||||
}
|
||||
}
|
||||
|
||||
# Allow public read
|
||||
resource "google_storage_default_object_acl" "bucket_acl" {
|
||||
provider = google-beta
|
||||
bucket = google_storage_bucket.bucket.name
|
||||
role_entity = ["READER:allUsers"]
|
||||
}
|
||||
|
||||
# DNS entry
|
||||
resource "google_dns_record_set" "cname" {
|
||||
provider = google-beta
|
||||
|
||||
depends_on = [google_storage_bucket.bucket]
|
||||
|
||||
project = var.project
|
||||
|
||||
name = "${var.domain}."
|
||||
managed_zone = var.dns_zone
|
||||
type = "CNAME"
|
||||
ttl = 300
|
||||
rrdatas = ["c.storage.googleapis.com."]
|
||||
}
|
||||
7
modules/published-dots/outputs.tf
Normal file
7
modules/published-dots/outputs.tf
Normal file
@@ -0,0 +1,7 @@
|
||||
output "bucket_url" {
|
||||
value = "storage.googleapis.com/${var.domain}"
|
||||
}
|
||||
|
||||
output "bucket_link" {
|
||||
value = google_storage_bucket.bucket.self_link
|
||||
}
|
||||
14
modules/published-dots/variables.tf
Normal file
14
modules/published-dots/variables.tf
Normal file
@@ -0,0 +1,14 @@
|
||||
variable "project" {
|
||||
description = "Google Cloud project to host resources in"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "domain" {
|
||||
description = "DNS name to serve static content"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "dns_zone" {
|
||||
description = "Cloud DNS zone to use"
|
||||
type = string
|
||||
}
|
||||
78
scripts/_utils.sh
Executable file
78
scripts/_utils.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
function apt_update {
|
||||
sudo apt-get update
|
||||
}
|
||||
|
||||
# @arg $1 debian package to install if not present
|
||||
function apt_install {
|
||||
if ! dpkg -s $1; then
|
||||
sudo apt-get install -y $1
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Helper functions
|
||||
# ---------------------------------------------------------------------------- #
|
||||
clean() {
|
||||
sudo apt-get clean
|
||||
}
|
||||
|
||||
update() {
|
||||
apt_update
|
||||
}
|
||||
|
||||
# @arg $1 packages to install
|
||||
install() {
|
||||
apt_install $1
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 package list file to install
|
||||
install_file() {
|
||||
sudo apt-get install -qqyf $(cat $1)
|
||||
refresh
|
||||
}
|
||||
|
||||
# @arg $1 repository to add
|
||||
add_ppa() {
|
||||
sudo add-apt-repository -y ppa:$1
|
||||
}
|
||||
|
||||
# @arg $1 url to add
|
||||
# @arg $2 keyring to add to
|
||||
add_key() {
|
||||
curl -fsSL $1 \
|
||||
| sudo gpg --no-default-keyring --keyring $2 --import -
|
||||
}
|
||||
|
||||
# @arg $1 URL to run
|
||||
# @arg $2 binary to use
|
||||
run() {
|
||||
curl -fsSL $1 | $2
|
||||
}
|
||||
|
||||
# Symlink contents of source folder to target
|
||||
#
|
||||
# @arg $1 source folder
|
||||
# @arg $2 target folder
|
||||
link_folder() {
|
||||
mkdir -p $2
|
||||
cp -srf $1/. $2
|
||||
}
|
||||
|
||||
# @arg $1 binary to test
|
||||
not_installed() {
|
||||
! [ -x "$(command -v $1)" ]
|
||||
}
|
||||
|
||||
# Refreshes PATH
|
||||
refresh() {
|
||||
hash -r
|
||||
}
|
||||
|
||||
# Add to PATH and refresh
|
||||
# @arg $1 path to add to PATH
|
||||
add_path() {
|
||||
export PATH="$1:$PATH"
|
||||
refresh
|
||||
}
|
||||
14
scripts/bootstrap.sh
Executable file
14
scripts/bootstrap.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
NAME=`basename "$0"`
|
||||
REL_DIR=`dirname "$0"`
|
||||
ABS_DIR=`readlink -f $REL_DIR/../` # Scripts are nested inside of /scripts
|
||||
|
||||
# TODO
|
||||
# Migrate to config.fish
|
||||
rm $HOME/.bashrc
|
||||
rm $HOME/.profile
|
||||
|
||||
echo "Stowing $ABS_DIR to $HOME"
|
||||
stow --dir=$ABS_DIR --target=$HOME files
|
||||
54
scripts/install.sh
Executable file
54
scripts/install.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
TIME=${TIME:-`date`}
|
||||
UUID=${UUID:-`uuidgen`}
|
||||
HOST=${HOST:-`hostname`}
|
||||
|
||||
NAME=`basename "$0"`
|
||||
REL_DIR=`dirname "$0"`
|
||||
ABS_DIR=`readlink -f $REL_DIR/../` # Scripts are nested inside of /scripts
|
||||
|
||||
LOG_DIR="$ABS_DIR/logs"
|
||||
mkdir -p $LOG_DIR
|
||||
LOG_TARGET=${LOG_TARGET:-$LOG_DIR/$UUID.log}
|
||||
|
||||
|
||||
main() {
|
||||
echo "Running $NAME at $TIME"
|
||||
echo "Running as $USER on $HOST"
|
||||
|
||||
# Prevent running as root
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
echo "Failed: Running as sudo. Please run as user"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Loading utils"
|
||||
source $REL_DIR/_utils.sh
|
||||
|
||||
apt_update
|
||||
|
||||
echo "Installing jq..."
|
||||
apt_install jq
|
||||
|
||||
echo "Installing apt dependencies..."
|
||||
for dep in `jq -r ".apt_dependencies[]" $ABS_DIR/config.json`; do
|
||||
apt_install $dep
|
||||
done
|
||||
|
||||
figlet -c "bootstrapping..."
|
||||
$ABS_DIR/scripts/bootstrap.sh
|
||||
source $HOME/.profile
|
||||
|
||||
figlet -c "installing..."
|
||||
export INSTALL_DIR="$REL_DIR/install"
|
||||
for script in $INSTALL_DIR/*.sh; do
|
||||
figlet -c `basename $script`
|
||||
source $script
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
echo "main: Logging to $LOG_TARGET"
|
||||
main 2>&1 |tee $LOG_TARGET
|
||||
4
scripts/install/00-apt-pkglist
Normal file
4
scripts/install/00-apt-pkglist
Normal file
@@ -0,0 +1,4 @@
|
||||
apt-transport-https
|
||||
software-properties-common
|
||||
ripgrep
|
||||
universal-ctags
|
||||
2
scripts/install/00-apt.sh
Executable file
2
scripts/install/00-apt.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
cat /etc/os-release
|
||||
@@ -1,22 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "fish"; then
|
||||
echo "installing fish..."
|
||||
add_ppa "fish-shell/release-3"
|
||||
update
|
||||
install fish
|
||||
fi
|
||||
|
||||
echo "fish is installed"
|
||||
fish --version
|
||||
|
||||
fisher_location="$XDG_CONFIG_HOME/fish/functions/fisher.fish"
|
||||
fisher_location="$HOME/.config/fish/functions/fisher.fish"
|
||||
if ! [ -f "$fisher_location" ]; then
|
||||
echo "Installing fisher..."
|
||||
curl https://git.io/fisher --create-dirs -sLo "$fisher_location"
|
||||
fish -c "fisher install jorgebucaran/fisher"
|
||||
fi
|
||||
echo "fisher is installed, updating..."
|
||||
fish -c "fisher update";
|
||||
|
||||
fish -c "fisher --version"
|
||||
@@ -1,14 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# ssh key exists
|
||||
ssh_target="$HOME/.ssh"
|
||||
ssh_key="$ssh_target/id_rsa"
|
||||
ssh_pub="$ssh_key.pub"
|
||||
if [ ! -f "$ssh_key" ]; then
|
||||
echo "generating ssh key..."
|
||||
ssh-keygen -t rsa -b 4096 -f "$ssh_key"
|
||||
fi
|
||||
echo "ssh key exists"
|
||||
|
||||
cat "$ssh_pub"
|
||||
@@ -2,9 +2,9 @@ build-essential
|
||||
libssl-dev
|
||||
libbz2-dev
|
||||
libreadline-dev
|
||||
libreadline6
|
||||
libreadline6-dev
|
||||
libsqlite3-dev
|
||||
libxml2-dev
|
||||
libxmlsec1-dev
|
||||
llvm
|
||||
libncurses5-dev
|
||||
libncursesw5-dev
|
||||
18
scripts/install/10-pyenv.sh
Executable file
18
scripts/install/10-pyenv.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
if not_installed "pyenv"; then
|
||||
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
|
||||
pyenv_list_file="$INSTALL_DIR/10-pyenv-pkglist"
|
||||
install_file "$pyenv_list_file"
|
||||
|
||||
# see https://github.com/pyenv/pyenv-installer
|
||||
run "https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
|
||||
bash
|
||||
fi
|
||||
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
|
||||
pyenv update
|
||||
|
||||
pyenv --version
|
||||
@@ -1,18 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
# python3 and pip3 are installed
|
||||
if not_installed "pip3"; then
|
||||
|
||||
echo "Installing python3 and pip3..."
|
||||
|
||||
pyenv install 3.7.0
|
||||
pyenv global 3.7.0
|
||||
pyenv install 3.9.0
|
||||
pyenv global 3.9.0
|
||||
refresh
|
||||
|
||||
fi
|
||||
echo "python3 and pip3 are installed, upgrading..."
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade pip
|
||||
python3 --version
|
||||
@@ -1,16 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
add_path "$HOME/.local/bin"
|
||||
|
||||
# poetry is installed
|
||||
if not_installed "poetry"; then
|
||||
|
||||
printf "Installing poetry...\n"
|
||||
|
||||
# Install poetry
|
||||
pip3 install --user poetry
|
||||
|
||||
fi
|
||||
printf "poetry is installed, upgrading...\n"
|
||||
|
||||
pip3 install --upgrade poetry
|
||||
poetry --version
|
||||
11
scripts/install/13-nvm.sh
Executable file
11
scripts/install/13-nvm.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
run "https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh" \
|
||||
"bash"
|
||||
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
nvm --version
|
||||
nvm install node
|
||||
nvm use node
|
||||
|
||||
node --version
|
||||
9
scripts/install/14-yarn.sh
Executable file
9
scripts/install/14-yarn.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
if not_installed "yarn"; then
|
||||
add_key https://dl.yarnpkg.com/debian/pubkey.gpg
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||
update
|
||||
sudo apt install --no-install-recommends yarn
|
||||
fi
|
||||
|
||||
yarn --version
|
||||
@@ -1,10 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "java"; then
|
||||
echo "Installing java..."
|
||||
install default-jre
|
||||
fi
|
||||
|
||||
echo "java is installed"
|
||||
java --version
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
|
||||
mkdir -p "$XDG_DATA_HOME/nvim/backup"
|
||||
@@ -13,7 +12,6 @@ echo "Installing neovim support";
|
||||
pip3 install --user neovim pynvim 'python-language-server[all]'
|
||||
nvm use default
|
||||
npm install -g neovim
|
||||
sudo gem install neovim
|
||||
|
||||
echo "Running PlugInstall";
|
||||
nvim --headless +UpdateRemotePlugins +PlugClean! +PlugInstall +PlugUpgrade +PlugUpdate +qall
|
||||
@@ -1,13 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
# docker is installed
|
||||
DOCKER_FOLDER="$HOME/.docker"
|
||||
if not_installed "docker"; then
|
||||
|
||||
printf "Installing docker...\n"
|
||||
|
||||
# Create folder
|
||||
mkdir -p "$DOCKER_FOLDER"
|
||||
|
||||
# Requirements
|
||||
@@ -15,8 +8,9 @@ if not_installed "docker"; then
|
||||
software-properties-common
|
||||
|
||||
# Add repository
|
||||
distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]') # cast to lowercase
|
||||
add_key "https://download.docker.com/linux/$distro/gpg" "docker-apt-key"
|
||||
distro=$(lsb_release -si | tr "[:upper:]" "[:lower:]") # cast to lowercase
|
||||
add_key "https://download.docker.com/linux/$distro/gpg" \
|
||||
"gnupg-ring:/etc/apt/trusted.gpg.d/docker-apt-key.gpg"
|
||||
sudo add-apt-repository -y \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/$distro \
|
||||
$(lsb_release -cs) \
|
||||
@@ -31,31 +25,19 @@ if not_installed "docker"; then
|
||||
sudo chmod g+rwx "$DOCKER_FOLDER" -R
|
||||
|
||||
fi
|
||||
printf "docker is installed\n"
|
||||
docker --version
|
||||
|
||||
# docker-compose if installed
|
||||
if not_installed "docker-compose"; then
|
||||
|
||||
printf "Installing docker-compose...\n"
|
||||
|
||||
# Docker-compose
|
||||
pip3 install --user docker-compose
|
||||
|
||||
fi
|
||||
printf "docker-compose is installed, upgrading\n"
|
||||
pip3 install --upgrade docker-compose
|
||||
docker-compose --version
|
||||
|
||||
# docker group exists
|
||||
readonly docker_group='docker'
|
||||
readonly docker_group="docker"
|
||||
if ! grep -q "$docker_group" /etc/group; then
|
||||
sudo groupadd "$docker_group"
|
||||
fi
|
||||
printf "group '$docker_group' is created\n"
|
||||
|
||||
# user is in docker group
|
||||
if ! groups "$USER" | grep -q "\b$docker_group\b"; then
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
printf "user '$USER' is in '$docker_group' group\n"
|
||||
@@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "gcloud"; then
|
||||
echo "Installing gcloud..."
|
||||
# Add the Cloud SDK distribution URI as a package source
|
||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" \
|
||||
| sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
|
||||
# Import the Google Cloud Platform public key
|
||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
|
||||
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
|
||||
| sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
|
||||
update
|
||||
install google-cloud-sdk
|
||||
refresh
|
||||
@@ -1,8 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
if not_installed "firebase"; then
|
||||
echo "Installing firebase..."
|
||||
run "https://firebase.tools" "bash"
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
||||
temp_dir=$(mktemp -d)
|
||||
unzip awscliv2.zip -d "$temp_dir"
|
||||
@@ -1,6 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
tf_version="0.14.6"
|
||||
if not_installed "terraform"; then
|
||||
echo "Installing terraform..."
|
||||
2
scripts/install/98-apt-clean.sh
Executable file
2
scripts/install/98-apt-clean.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
clean
|
||||
2
scripts/install/99-screenfetch.sh
Executable file
2
scripts/install/99-screenfetch.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
screenfetch
|
||||
4
scripts/publish.sh
Normal file
4
scripts/publish.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
echo "Publishing..."
|
||||
29
scripts/setup.sh
Executable file
29
scripts/setup.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
# GitHub repository details
|
||||
AUTHOR=${AUTHOR:-andrejusk}
|
||||
REPOSITORY=${REPOSITORY:-dotfiles}
|
||||
BRANCH=${BRANCH:-master}
|
||||
echo "Using repository $AUTHOR/$REPOSITORY at $BRANCH"
|
||||
|
||||
# Target folder to checkout to
|
||||
DOTFILES_DIR=${DOTFILES_DIR:-$HOME/.dotfiles}
|
||||
mkdir -p $DOTFILES_DIR
|
||||
if [ -z `ls -A $DOTFILES_DIR` ]; then
|
||||
echo "Setting up $DOTFILES_DIR"
|
||||
else
|
||||
echo "Failed: Setup directory not empty $DOTFILES_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download and untar repo
|
||||
tmp_dir=`mktemp -d`
|
||||
tmp_dest="$tmp_dir/dotfiles.tar.gz"
|
||||
wget "https://github.com/$AUTHOR/$REPOSITORY/archive/$BRANCH.tar.gz" -qO $tmp_dest
|
||||
tar -C $tmp_dir -zxf $tmp_dest
|
||||
mv $tmp_dir/$REPOSITORY-$BRANCH/* $DOTFILES_DIR
|
||||
rm -rf $tmp_dir
|
||||
|
||||
echo "Done!"
|
||||
$DOTFILES_DIR/scripts/install.sh
|
||||
9
scripts/test.sh
Executable file
9
scripts/test.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
tag=`uuidgen`
|
||||
docker build . \
|
||||
-t dotfiles:$tag \
|
||||
--target test
|
||||
|
||||
docker run dotfiles:$tag
|
||||
46
setup.pl
46
setup.pl
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
use Archive::Tar;
|
||||
use File::Copy;
|
||||
use File::Temp ();
|
||||
use IPC::System::Simple qw(capture);
|
||||
use LWP::Simple;
|
||||
|
||||
|
||||
print "Setting up...\n";
|
||||
|
||||
# GitHub repository to clone
|
||||
my $author = $ENV{'DOTFILES_AUTHOR'} // 'andrejusk';
|
||||
my $repository = $ENV{'DOTFILES_REPOSITORY'} // 'dotfiles';
|
||||
my $branch = $ENV{'DOTFILES_BRANCH'} // 'master';
|
||||
print "Using repository $author/$repository at $branch\n";
|
||||
|
||||
# Install location
|
||||
my $dotfiles_dir = $ENV{'DOTFILES_DIR'} // "$ENV{'HOME'}/.dotfiles";
|
||||
|
||||
# Download repo
|
||||
my $repository_url = "https://github.com/$author/$repository/archive/$branch.tar.gz";
|
||||
my $temp_handle = File::Temp->new();
|
||||
my $repository_temp = $temp_handle->filename;
|
||||
print "Downloading $repository_url to $repository_temp\n";
|
||||
getstore($repository_url, $repository_temp);
|
||||
|
||||
# Extract repo
|
||||
my $temp_dir = File::Temp->newdir();
|
||||
my $tar = Archive::Tar->new;
|
||||
print "Extracting $repository_temp to $temp_dir\n";
|
||||
$tar->read($repository_temp);
|
||||
$tar->setcwd($temp_dir);
|
||||
$tar->extract();
|
||||
|
||||
# Move dotfiles out of temporary dir
|
||||
my $temp_dotfiles_dir = "$temp_dir/$repository-$branch";
|
||||
print "Moving $temp_dotfiles_dir to $dotfiles_dir\n";
|
||||
move($temp_dotfiles_dir, $dotfiles_dir);
|
||||
|
||||
# Install repo
|
||||
print "Running installer\n";
|
||||
`$dotfiles_dir/install.pl`;
|
||||
3
tests/.gitignore
vendored
Normal file
3
tests/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# pytest
|
||||
**/__pycache__
|
||||
**/.pytest_cache
|
||||
@@ -1 +1 @@
|
||||
3.7.0
|
||||
3.9.0
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
SHELL := /bin/bash
|
||||
all:
|
||||
poetry install
|
||||
poetry run pytest
|
||||
136
tests/poetry.lock
generated
136
tests/poetry.lock
generated
@@ -1,19 +1,18 @@
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Atomic file writes."
|
||||
marker = "sys_platform == \"win32\""
|
||||
name = "atomicwrites"
|
||||
version = "1.3.0"
|
||||
description = "Atomic file writes."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "1.3.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Classes Without Boilerplate"
|
||||
name = "attrs"
|
||||
version = "19.3.0"
|
||||
description = "Classes Without Boilerplate"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "19.3.0"
|
||||
|
||||
[package.extras]
|
||||
azure-pipelines = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "pytest-azurepipelines"]
|
||||
@@ -22,22 +21,20 @@ docs = ["sphinx", "zope.interface"]
|
||||
tests = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Cross-platform colored terminal text."
|
||||
marker = "sys_platform == \"win32\""
|
||||
name = "colorama"
|
||||
version = "0.4.3"
|
||||
description = "Cross-platform colored terminal text."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
version = "0.4.3"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Read metadata from Python packages"
|
||||
marker = "python_version < \"3.8\""
|
||||
name = "importlib-metadata"
|
||||
version = "1.5.0"
|
||||
description = "Read metadata from Python packages"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
|
||||
version = "1.5.0"
|
||||
|
||||
[package.dependencies]
|
||||
zipp = ">=0.5"
|
||||
@@ -47,115 +44,130 @@ docs = ["sphinx", "rst.linker"]
|
||||
testing = ["packaging", "importlib-resources"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "More routines for operating on iterables, beyond itertools"
|
||||
name = "more-itertools"
|
||||
version = "8.2.0"
|
||||
description = "More routines for operating on iterables, beyond itertools"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
version = "8.2.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Core utilities for Python packages"
|
||||
name = "packaging"
|
||||
version = "20.1"
|
||||
description = "Core utilities for Python packages"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "20.1"
|
||||
|
||||
[package.dependencies]
|
||||
pyparsing = ">=2.0.2"
|
||||
six = "*"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
name = "pluggy"
|
||||
version = "0.13.1"
|
||||
description = "plugin and hook calling mechanisms for python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "0.13.1"
|
||||
|
||||
[package.dependencies]
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=0.12"
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
dev = ["pre-commit", "tox"]
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
name = "py"
|
||||
version = "1.8.1"
|
||||
description = "library with cross-python path, ini-parsing, io, code, log facilities"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
||||
version = "1.8.1"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Python parsing module"
|
||||
name = "pyparsing"
|
||||
version = "2.4.6"
|
||||
description = "Python parsing module"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
version = "2.4.6"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
name = "pytest"
|
||||
version = "5.3.5"
|
||||
description = "pytest: simple powerful testing with Python"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
version = "5.3.5"
|
||||
|
||||
[package.dependencies]
|
||||
atomicwrites = ">=1.0"
|
||||
atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""}
|
||||
attrs = ">=17.4.0"
|
||||
colorama = "*"
|
||||
colorama = {version = "*", markers = "sys_platform == \"win32\""}
|
||||
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
|
||||
more-itertools = ">=4.0.0"
|
||||
packaging = "*"
|
||||
pluggy = ">=0.12,<1.0"
|
||||
py = ">=1.5.0"
|
||||
wcwidth = "*"
|
||||
|
||||
[package.dependencies.importlib-metadata]
|
||||
python = "<3.8"
|
||||
version = ">=0.12"
|
||||
|
||||
[package.extras]
|
||||
checkqa-mypy = ["mypy (v0.761)"]
|
||||
checkqa-mypy = ["mypy (==v0.761)"]
|
||||
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"]
|
||||
|
||||
[[package]]
|
||||
name = "pytest-parallel"
|
||||
version = "0.1.0"
|
||||
description = "a pytest plugin for parallel and concurrent testing"
|
||||
category = "dev"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
name = "six"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
version = "1.14.0"
|
||||
|
||||
[[package]]
|
||||
category = "dev"
|
||||
description = "Measures number of Terminal column cells of wide-character codes"
|
||||
name = "wcwidth"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
version = "0.1.8"
|
||||
|
||||
[package.dependencies]
|
||||
pytest = ">=3.0.0"
|
||||
tblib = "*"
|
||||
|
||||
[[package]]
|
||||
name = "six"
|
||||
version = "1.14.0"
|
||||
description = "Python 2 and 3 compatibility utilities"
|
||||
category = "dev"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
marker = "python_version < \"3.8\""
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
|
||||
|
||||
[[package]]
|
||||
name = "tblib"
|
||||
version = "1.7.0"
|
||||
description = "Traceback serialization library."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[[package]]
|
||||
name = "wcwidth"
|
||||
version = "0.1.8"
|
||||
description = "Measures number of Terminal column cells of wide-character codes"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "zipp"
|
||||
version = "3.0.0"
|
||||
description = "Backport of pathlib-compatible object wrapper for zip files"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
version = "3.0.0"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["jaraco.itertools", "func-timeout"]
|
||||
|
||||
[metadata]
|
||||
content-hash = "76f248e0ec62688089444c71c5e62af7c3ca83978a893d09e6592e3621985fab"
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.7"
|
||||
content-hash = "74334db56ae752441434e742efb55e7b5499d3757b7ba674261897cb0b77c741"
|
||||
|
||||
[metadata.files]
|
||||
atomicwrites = [
|
||||
@@ -198,10 +210,18 @@ pytest = [
|
||||
{file = "pytest-5.3.5-py3-none-any.whl", hash = "sha256:ff615c761e25eb25df19edddc0b970302d2a9091fbce0e7213298d85fb61fef6"},
|
||||
{file = "pytest-5.3.5.tar.gz", hash = "sha256:0d5fe9189a148acc3c3eb2ac8e1ac0742cb7618c084f3d228baaec0c254b318d"},
|
||||
]
|
||||
pytest-parallel = [
|
||||
{file = "pytest-parallel-0.1.0.tar.gz", hash = "sha256:4663a8fb805ac98b51e51de84d35ffd9717017fb71ed270440dc94b862466c20"},
|
||||
{file = "pytest_parallel-0.1.0-py3-none-any.whl", hash = "sha256:10693161e350b59466ca331bad964073555cda114cc0499bd826deeceee512ed"},
|
||||
]
|
||||
six = [
|
||||
{file = "six-1.14.0-py2.py3-none-any.whl", hash = "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"},
|
||||
{file = "six-1.14.0.tar.gz", hash = "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"},
|
||||
]
|
||||
tblib = [
|
||||
{file = "tblib-1.7.0-py2.py3-none-any.whl", hash = "sha256:289fa7359e580950e7d9743eab36b0691f0310fce64dee7d9c31065b8f723e23"},
|
||||
{file = "tblib-1.7.0.tar.gz", hash = "sha256:059bd77306ea7b419d4f76016aef6d7027cc8a0785579b5aad198803435f882c"},
|
||||
]
|
||||
wcwidth = [
|
||||
{file = "wcwidth-0.1.8-py2.py3-none-any.whl", hash = "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603"},
|
||||
{file = "wcwidth-0.1.8.tar.gz", hash = "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8"},
|
||||
|
||||
@@ -9,6 +9,7 @@ python = "^3.7"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest = "^5.3.5"
|
||||
pytest-parallel = "^0.1.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
|
||||
5
tests/run.sh
Normal file
5
tests/run.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
poetry install
|
||||
poetry run pytest
|
||||
@@ -67,7 +67,6 @@ binaries: List[str] = [
|
||||
"node",
|
||||
"npm",
|
||||
"yarn",
|
||||
# "elm",
|
||||
|
||||
# language: java
|
||||
"java",
|
||||
|
||||
Reference in New Issue
Block a user