/localbox

Provision ubuntu desktop from scratch

Primary LanguageShellMozilla Public License 2.0MPL-2.0

Localbox

Localbox is a collection of scripts and dotfiles intended to

  • Install various formatters, linters, devops tools and apps
  • Configure various applications and tools via dotfiles

Provisioning

Process for provisioning the ubuntu desktop is taken in steps outlined below.

Preparation

sudo apt install -y make git
git clone https://github.com/stephenmoloney/localbox.git
cd localbox

Provisioning with GUI apps

make provision

Provisioning without GUI apps

make provision headless=true

Provisioning using environment versions

The recommended way to install particular versions of the the dependencies is to change the version specified in .env. However, it is possible to use only the default fallback versions specified in the installation files.

To use the versions specified in the .env file

make provision

To use default fallback versions and ignore .env

make provision fallback_versions=true headless=false

Emulate installation locally

To emulate the installation process locally, ideally a VM is used. However, it is possible to emulate the installation process in a docker container to some extent.

make provision_emulate

or alternatively

docker build \
  --tag local/shellspec-ubuntu:latest \
  -f shellspec.Dockerfile ./ &&
docker run \
  -ti \
  --kernel-memory=8g \
  --cpus=4 \
  -v $PWD:/localbox \
  --user ubuntu \
  local/shellspec-ubuntu:latest \
  bash -c 'sudo apt install -y make && make provision headless=true'

Installation

Installation can be run as a distinct step before configuration

make install

Configuration

Configuration can be run as a distinct step after installation

make configure

Integration tests

Running tests on a VM

While the command source ./ci/test.sh "serial" && execute_tests can run the test suite sequentially on a single VM. It is not really recommended due to

  • The possibility on state being altered from one test to the next
  • The time it would take to run them all on a single image

Instead, each test should be run in isolation on a new VM.

Running tests singularly

while IFS=' ' read -r -a specs; do
  make test_spec spec_file=spec/bin/${specs[0]}_spec.sh use_docker=false
done < <(ls -A ./spec/bin | sed 's/_spec//g' | sed 's/\.sh//g')

Running tests on docker

Running tests locally on VMS would be time-consuming to setup. An alternative approach which may suffice for local testing would be to run the tests on local docker containers.

Running all tests locally using docker

make test_all_docker;

Running tests singularly using docker

while IFS=' ' read -r -a specs; do
  make test_spec spec_file=spec/bin/${specs[0]}_spec.sh use_docker=true
done < <(ls -A ./spec/bin | sed 's/_spec//g' | sed 's/\.sh//g')

or

docker build \
  --tag local/shellspec-ubuntu:latest \
  -f shellspec.Dockerfile ./ &&
docker run \
  -ti \
  --kernel-memory=8g \
  --cpus=4 \
  -v $PWD:/localbox \
  --user ubuntu \
  local/shellspec-ubuntu:latest \
  bash -c \
    'make test_spec spec_file=spec/bin/debian_pkgs_spec.sh use_docker=false'

Vim keys

Common Actions

Key Pattern Action Notes
\ Leader key Special vim precursor command key
or k Up arrow Move up
or j Down arrow Move down
or h Left arrow Move left
or l Right arrow Move right
:q⏎ Close window without saving Will usually block you if there unsaved work
:qa⏎ Force close window without saving Quits without saving
go Open tab from nerdtree Opens a vim tab in current window pane
gs Open tab from nerdtree Opens a new vertically split vim pane
control + ww Toggle between vim panes Handy when moving from nerdtree to the text editorpane
za Toggle open/close current fold Toggles open/close the current fold in selection
zc Toggle close a fold Closes the current fold in selection if open or parent fold if already closed
zk Moves cursor to next fold up Moves cursor to next fold up
zj Moves cursor to next fold down Moves cursor to next fold down
zR Open all folds Opens all folds
zM Close all folds Closes all folds
ShiftTab Trigger open autocompelte menu Triggers the opening of the autocompettion menu. Hand in yaml for example.

Plugin Actions

Key Pattern Action Notes
\ww MarkdownPreviewToggle Toggles the markdown to be viewer in a newly opened browser window
\ee NERDTreeToggle Toggles open and close the nerdtree vim pane
\tt NERDTreeRefreshRoot Reload the nerdtree vim pane
\uu UndotreeToggle Toggles the undotree menu to popup
\rr TabBarToggle Toggles the tagbar menu to popup
\nn NnnPicker Opens the Nnn file picker
\aa AnyFoldActivate Toggles the anyfold activation. Action will depend on set foldlevel settings
\tm ToggleTableMode Enters into table mode making it easy for table formatting
Control + k Move selection up Moves the selected text in visual mode up
Control + j Move selection down Moves the selected text in visual mode down
\ff Open esearch Opens esearch at the selected folder in nerdtree
\cc Comment code Comments highlighted block of code in visual mode
\cu Uncomments code Uncomments highlighted block of code in visual mode

Nice themes

License

Mozilla Public License 2.0 MPL-2.0