Skip to content
Ubuntu / OS X dotfiles using at Dwarves Foundation
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead of cowboy:master.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ansible/roles Add basic ubuntu ansible playbook. Nov 21, 2014
bin check if cli tool has been installed on mac Apr 8, 2019
conf
config
copy
init Forked and update packages Apr 8, 2019
link
source
test Add array_join and array_join_filter functions. Mar 27, 2017
vendor Cleanup Mar 27, 2017
.gitignore Remove byobu in favor of just tmux. Mar 21, 2017
.gitmodules Forked and update packages Apr 8, 2019
CONTRIBUTING.md Forked and update packages Apr 8, 2019
LICENSE Forked and update packages Apr 8, 2019
README.md check if cli tool has been installed on mac Apr 8, 2019

README.md

Dotfiles

Share configuration with dotfiles

In UNIX, the files start with a dot “.” are hidden. If you list files in the directory, they don’t show up and keep them safe from the end users. Because of that reason, the developer usually uses it to store configurations of their tools.

Those files are so-called dotfiles. 'Dotfile' become a generalized term for a UNIX configuration file, typically prefixed with a dot (e.g., .vimrc) and found in your home directory. Most UNIX programs, including Vim, will load a dotfile during launch.

We recommend using dotfiles to customize your tools and environment to suit your preferences, reduce typing, and get work done. Check them into a git repository for safe-keeping and open-source for the benefit of others.

Automate your development environment

We use MacOS and Ubuntu as a environment for development. We depend on compilers, databases, programming languages, package management systems, installers, and other critical programs for our daily activities.

Using an automated setup helps us to stay up-to-date with new operating system and program versions. Also, because the setup is standardized, new team members are able to quickly join a project without wasting time re-configuring their machine.

Installation

OS X Prerequisite

You need to have XCode or, at the very minimum, the XCode Command Line Tools, which are available as a much smaller download.

The easiest way to install the XCode Command Line Tools in OSX 10.9+ is to open up a terminal, type xcode-select --install and follow the prompts.

Tested in OSX 10.10

Ubuntu Prerequisite

You might want to set up your ubuntu server like I do it, but then again, you might not.

Either way, you should at least update/upgrade APT with sudo apt-get -qq update && sudo apt-get -qq dist-upgrade first.

Tested in Ubuntu 14.04 LTS

Actual installation

Since you'll be using the dotfiles command on subsequent runs, you'll only have to set the DOTFILES_GH_USER variable for the initial install, but if you have a custom branch, you will need to export DOTFILES_GH_BRANCH for subsequent runs.

There's a lot of stuff that requires admin access via sudo, so be warned that you might need to enter your password here or there.

export DOTFILES_GH_USER=dwarvesf
export DOTFILES_GH_BRANCH=master

Ubuntu

bash -c "$(wget -qO- https://bit.ly/df-dotfiles)" && source ~/.bashrc

macOS

bash -c "$(curl -fsSL https://bit.ly/df-dotfiles)" && source ~/.bashrc

Aliases and Functions

To keep things easy, the ~/.bashrc and ~/.bash_profile files are extremely simple, and should never need to be modified. Instead, add your aliases, functions, settings, etc into one of the files in the source subdirectory, or add a new file. They're all automatically sourced when a new shell is opened. Take a look, I have a lot of aliases and functions.

Scripts

In addition to the aforementioned dotfiles script, there are a few other bin scripts.

  • dotfiles - (re)initialize dotfiles. It might ask for your password (for sudo).
  • src - (re)source all files in /source directory
  • Look through the bin subdirectory for a few more.

How the "dotfiles" command works

When dotfiles is run for the first time, it does a few things:

  1. In Ubuntu, Git is installed if necessary via APT (it's already there in OSX).
  2. This repo is cloned into your user directory, under ~/.dotfiles.
  3. Files in /copy are copied into ~/. (read more)
  4. Files in /link are symlinked into ~/. (read more)
  5. You are prompted to choose scripts in /init to be executed. The installer attempts to only select relevant scripts, based on the detected OS and the script filename.
  6. Your chosen init scripts are executed (in alphanumeric order, hence the funky names). (read more)

On subsequent runs, step 1 is skipped, step 2 just updates the already-existing repo, and step 5 remembers what you selected the last time. The other steps are the same.

Other subdirectories

  • The /backups directory gets created when necessary. Any files in ~/ that would have been overwritten by files in /copy or /link get backed up there.
  • The /bin directory contains executable shell scripts (including the dotfiles script) and symlinks to executable shell scripts. This directory is added to the path.
  • The /caches directory contains cached files, used by some scripts or functions.
  • The /conf directory just exists. If a config file doesn't need to go in ~/, reference it from the /conf directory.
  • The /source directory contains files that are sourced whenever a new shell is opened (in alphanumeric order, hence the funky names).
  • The /test directory contains unit tests for especially complicated bash functions.
  • The /vendor directory contains third-party libraries.

The "copy" step

Any file in the /copy subdirectory will be copied into ~/. Any file that needs to be modified with personal information (like copy/.gitconfig which contains an email address and private key) should be copied into ~/. Because the file you'll be editing is no longer in ~/.dotfiles, it's less likely to be accidentally committed into your public dotfiles repo.

The "link" step

Any file in the /link subdirectory gets symlinked into ~/ with ln -s. Edit one or the other, and you change the file in both places. Don't link files containing sensitive data, or you might accidentally commit that data! If you're linking a directory that might contain sensitive data (like ~/.ssh) add the sensitive files to your .gitignore file!

The "init" step

Scripts in the /init subdirectory will be executed. A whole bunch of things will be installed, but only if they aren't already.

OS X

Ubuntu

Both

Hacking the dotfiles

Because the dotfiles script is completely self-contained, you should be able to delete everything else from your dotfiles repo fork, and it will still work. The only thing it really cares about are the /copy, /link and /init subdirectories, which will be ignored if they are empty or don't exist.

Contributing

The main purpose of this repository is to continue to evolve the way we setup development environment, making it faster and easier to use. Development happens in the open on GitHub, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving it.

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes.

License

MIT @ Dwarves Foundation

You can’t perform that action at this time.