Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kairichard/lace

Lace - dotfile management
https://github.com/kairichard/lace

cucumber dotfile-manager lace pkg ruby

Last synced: 9 days ago
JSON representation

Lace - dotfile management

Awesome Lists containing this project

README

        



Lace - dotfile management
========
[![Build Status](https://travis-ci.org/kairichard/lace.png?branch=master)](https://travis-ci.org/kairichard/lace) [![Gem Version](https://badge.fury.io/rb/lace.png)](http://badge.fury.io/rb/lace) [![Dependency Status](https://gemnasium.com/kairichard/lace.svg)](https://gemnasium.com/kairichard/lace) [![Coverage Status](https://coveralls.io/repos/kairichard/lace/badge.png?branch=master)](https://coveralls.io/r/kairichard/lace?branch=master)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fkairichard%2Flace.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkairichard%2Flace?ref=badge_shield)

Logging in to different machines at work or at home I just wanted to have an elegant solution to install .dotfiles on them. Lace provides. Also I wanted something that makes it real easy to bootstrap a new maschine, even if they are differently flavored. Lace provides. Updating these should be a breeze. Lace provides. And I hoped for something that lets you share common .dotfiles with your teammates by just installing them next to your own dotfiles. Lace provides.
Lace is inspired by brew.
###### Synopsis
```bash
lace [--name=] [--version] [--no-hooks] [--force]
```
Installing
-------------
Lace comes as a gem, so given you have ruby installed simply do the following
```bash
> gem install lace
#or
> git clone https://github.com/kairichard/lace.git
> cd lace
> gem build lace.gemspec
> gem install lace-*.gem
```
Usage
-----------
### Writing a .lace.yml
Put a file named `.lace.yml` in the root of your dotfiles. This file describes how your dotfiles will be installed and what is included in them. Example:

```yaml
---
homepage: https://somewhere
version: 1.0

osx: &osx # using a name for a config
config_files: # all files that should appear in $HOME
- bash # bash will become .bash can be directory or file
- config/**/* # globbing is supported this will only link files that are not present in $HOME/config yet
- tmux.conf
- vimrc

setup: # this is run the first time the package is installed
- <%= @package_path/"bootstrap/osx/brew" %>
- <%= @package_path/"bootstrap/osx/defaults" %>
- <%= @package_path/"bootstrap/osx/fonts" %>

post:
   update: # do this after `lace update`
     - *vim_bundles

flavors: # manage multiple flavors of dotfiles
osx: *osx
ubuntu-desktop: *ubuntu-desktop
```
For a full example visit https://github.com/kairichard/dotfiles/blob/master/.lace.yml

### Installing a Package
Its possible to install a Package either locally via the files system or by specifying a remote git repo,
local git repos also work.

```bash
# install something from disk
> lace fetch somewhere/mydofiles
> lace setup mydofiles
# or from github
> lace fetch https://github.com/user/repo.git
> lace setup user
# also works if the exact path is not present on disk
> lace fetch user/repo.git # or
> lace fetch user/repo
# or name it the way you like
> lace fetch https://github.com/user/repo.git --name=prod
> lace setup prod
# for some config files to take effect it may be required to reload your current terminal session
```

### Playing around with a non intrusive example package
Most likely you dont want to override your existing config files just to get a feeling on how lace
behaves. Therefore I prepared an example package for you to just install and play around with.
```bash
> lace fetch https://github.com/kairichard/lace_example_dotfile_pkg.git
> lace setup lace_example_dotfile_pkg
```

```
Example usage:
Synopsis:
lace [] [--name=] [--version] [--no-hooks] [--force]

lace ls

lace fetch
lace fetch

lace setup
lace setup

lace diff
lace diff

lace activate
lace activate

lace deactivate
lace deactivate

lace remove
lace update

Troubleshooting:
lace help
lace info
lace validate
```
- - -
## Learning how to make your own package
A good staring point is to look at the output of `lace inspect`. Given you have installed the lace_example_dotfile_pkg
you can run the following command:
```bash
> lace inspect lace_example_dotfile_pkg
Inspection of lace_example_dotfile_pkg:
active: true
flavors: osx, linux, production
version: 0.1
upgradeable: true
manifest: ~/.cassias/lace_example_dotfile_pkg/.lace.yml
homepage: https://github.com/kairichard/lace_example_dotfile_pkg
```
Than just take a look at the `.lace.yml` to learn some more and eventually make your own package.
### Validating your own package
When packaging your lace-package you may want to validate your `.lace.yml` to do that just run the following and study the output to improve your package
```bash
> lace validate somewhere/on/mydisk
Lace-Manifest Validation Report:
config-files: [ error ]
# arkrc is missing from this package
version: [ missing ]
# adding a version to the manifest improves
# a future update experince
homepage: [ missing ]
# adding a homepage improves the credibility
# of your package
setup: [ error ]
# ~/.vim/install_bundles cannot be found
# ~/.bootstrap/osx/brew cannot be found
# ~/.bootstrap/osx/defaults cannot be found
# ~/.bootstrap/osx/fonts cannot be found
post-update hook: [ error ]
# ~/.vim/install_bundles cannot be found
# ~/.bootstrap/osx/brew cannot be found
```
**NOTE** `lace validate` only works with local directories

## Contributing Code

If you want to contribute code, please try to:

* Follow the same coding style as used in the project. Pay attention to the
usage of tabs, spaces, newlines and brackets. Try to copy the aesthetics the
best you can.
* Add a scenario under `features` that verifies your change (test with `rake features`). Look at the existing test
suite to get an idea for the kind of tests I like. If you do not provide a
test, explain why.
* Write [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
explain what your patch does, and why it is needed.
* Keep it simple: Any patch that changes a lot of code or is difficult to
understand should be discussed before you put in the effort.

Once you have tried the above, create a GitHub pull request to notify me of your
changes.

## TODO

- [ ] Determine if a package is "active" or partially active using the new `diff`.
- [ ] Use `diff` to apply/activate changes.
- [ ] Add mothership communication to notify about changes in different environments.
- [ ] Add description in `lace ls`.
- [ ] Provide a name in the package itself.
- [ ] Allow updates without having to deactivate:
- [ ] Determine the active flavor by finding the one with the smallest delta of matching to non-matching config files.
- [x] Build the diff between the old and new config.
- [ ] Only link the diff.
- [ ] ---Decide whether to track events with PStore.---
- [ ] Define a `pkg.lace` to allow multiple packages to be fetched and set up.
- [ ] Refactor:
- [ ] Move hooks away from the package itself into Utils.
- [ ] Revise hook invocation.
- [ ] Refactor `validate.rb`.
- [ ] Refactor facts key access.

License
--------
MIT License (MIT)

Attribution
--------
Thanks to the people creating and maintaining Homebrew. Without their prior work this tool would probably not exist.
And if it did it would be in a worse state than it is today.

Logo
--------
by Mark Beltran -> https://www.instagram.com/elhoncho/

## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fkairichard%2Flace.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkairichard%2Flace?ref=badge_large)