GithubHelp home page GithubHelp logo

ore's Introduction

Ore: Merging dotfiles together

A way to provide (a simple standard) and merge (a program) dotfiles. Multiple repositories might need to affect the same file (e.g ~/.bashrc), Ore allows that.

Ore is two things:

  1. A Standard for dotfiles repositories to follow and play nice together
  2. A program to merge ore-compatible dotfiles together

The Standard

Every ore repository CAN be a castle, which means:

  • They contain a home directory
  • home contains files which will be symlinked to the user's home

Ore castles follow just one more rule:

  • They don't have files which might be used by other castles

If you have a castle with .bashrc and want to provide it, append _<id> to the file name: .bashrc_phpbrew.

You can search for other Ore compatible repositories on GitHub.

The program

The ore command line is used to merge files from smaller ones:

$ ore ".ssh/config_*" > ~/.ssh/config

The execution above will find all files in your $HOME that start with .ssh/config_ and output its contents to ~/.ssh/config. ore just concatenate files and you are responsible for telling which file they will produce, a couple more examples:

$ ore ".bashrc_*" > ~/.bashrc
$ ore ".bash_environment_*" > ~/.bash_environment
$ ore ".vimrc_*" > ~/.vimrc

The files concatenated by ore are sorted, meaning .vimrc_00-pathogen is output before .vimrc_99-papercolor-colorscheme.

Automating things with hooks

A ore repository can help you by providing three hooks:

  • pre-command and post-command are executed before or after ore
  • load is used to automatically generate files provided by the repository

Hooks MUST be provided inside a .ore directory. If the repository is a castle, then it will have a home/.ore directory. A hook is a shell file that is executed by ore and follow the convention <when>_<_id>:

  • when: Is either pre, post or load
  • id is usually the name of your repository

Examples of hook files are: load_ssh_config_work, load_vim-pathogen, load_docker_aliases, pre_docker_aliases and post_docker_aliases.

Automatically merging files with load hook

The load hook is a text file with the file names provided by the repository after they are merged. If a repository provides ~/.vimrc and has a ~/.vimrc_nice-statusbar then the hook file content can be:

# ~/.ore/load_nice-statusbar
# Comments are ignored
ore "$HOME/.vimrc_* >> $HOME/.vimrc

The load hook is only used when you execute ore without any argument (or ore --only-load). All load hooks differ from pre and post hooks as their content is first read, merged together with all other load hook-scripts available so they can be de-duplicated.

Pre and Post hooks

This hooks must be executable, they can be a shell script or program that gets executed by ore if the user accepts the risks involved.

Installation

Ore is a single script program, just put it in your $PATH or:

$ sh <(curl -sSL http://git.io/sinister) -u http://git.io/ore

The above command, after executed, should provide you with a ore command which you will use. To check if installation was successful, you can:

$ ore --version
Ore 1.0.0

If this fails, please let me know.

ore's People

Contributors

augustohp avatar

Stargazers

Roman avatar Rodrigo Melo avatar  avatar Fabio Ribeiro avatar Jefersson Nathan avatar

Watchers

Ivo Nascimento avatar Henrique Moody avatar  avatar Diego Rabatone Oliveira avatar Vinicius Moraes avatar James Cloos avatar Jefersson Nathan avatar Henrique Holanda avatar  avatar

ore's Issues

Request for comments

This is an idea to be used with homesick, allowing to use multiple dotfiles together.

As I am nearing a point where I feel comfortable coding something, there is still a lot of information on commit messages that are missing or lacking explanation in the README - such as TODOs and exploration of ideas that are just a glimpse.

Any opinion is valuable:

  • How do you manage your dotfiles?
  • How easy is to understand what is written in the README? What are your doubts?
  • Would you use this? How would you use it?

To help you better understand what all the README explains, it is basically this sequence of commands:

$ find -depth 2 -name "config_*" ~/.ssh \
    | sort \ 
    > ~/.ssh/config

Publish https://git.io/ore short-url

This is needed as it is mentioned on the README.md file as installation instructions using Sinister.

  • Have an sh file which I can link raw output to
  • Create the permanent short-url

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.