Giter Club home page Giter Club logo

dotfiles-rs's Introduction

dotfiles-rs

Build Status Rust Documentation

Rust Documentation

Dotfiles-rs is an automation framework that can be used for dotfiles configuration. It was inspired by anishathalye/dotbot and rewritten in rust in part to improve maintainability and in part for curiosity about the Rust language.

Core Concepts

A dotfiles-rs configuration is, in practice, a list of steps (actions) that execute linearly. This configuration is expressed across one or multiple files, to allow for modularization and reuse of these configurations.

Directives & Actions

A directive is a type of action that dotfiles-rs can execute, currently the following directives are supported:

  • apt: uses apt to install packages
  • brew: uses homebrew to install formulae, casks or Mac App Store apps via mas
  • create: creates a new directory
  • exec: runs a command in zsh
  • link: creates a symlink to a file or directory
  • subconfig: calls into another configuration file, this allows modularization

Directives are used to instantiate actions, which make up the steps that dotfiles-rs executes. In order to instantiate you need to specify them in the steps object in a YAML configuration file.

steps:
 - create:
  - ~/src
 - exec:
   - 'cd ~/src && git clone git://github.com/miguelandres/dotfiles_v2'
 - create:
  - dir: ~/.oh-my-zsh/custom
    create_parent_dirs: true
 - link:
  - ~/.oh-my-zsh/custom/something: ~/src/dotfiles_v2/something
  - ~/.oh-my-zsh/custom/something_else: something_else_in_this_dir

Notice that in the example above:

  • Directives can be invoked more than once to generate the actions in the right order
  • Some directives (create, link, exec) have short-hand versions and versions where more settings can be specified
  • Directives support both absolute paths (or relative to the home dir, ~) and paths relative to the configuration file

Hint: All directives have a skip_in_ci setting, which defaults to false, if you set it to true all the steps generated by that directive will be skipped if dotfiles-rs determines that it's being run in a known CI environment.

Defaults

Defaults are settings for each directive that can be shared across multiple actions of the same directive in the same file or context.

For example, if you always (or almost always) use the same setting for a specific directive, you can set it up in a defaults section and then only specify it in cases where you need to override that default.

That means that the following file ...

steps:
 - create:
  - ~/src
  - dir: ~/.vim/plugins
    create_parent_dirs: true
  - path: ~/.oh-my-zsh/custom
    create_parent_dirs: true

... would be equivalent to ...

defaults:
  create:
   create_parent_dirs: true

steps:
 - create:
  - dir: ~/src
    create_parent_dirs: false
  - ~/.vim/plugins
  - ~/.oh-my-zsh/custom

Configurations and contexts

  • Each file is a Context. A context contains defaults for the entire context, and subcontexts
  • A subcontext is created by invoking a file from another using the subconfig directive. Defaults are inherited from the parent context (file) and can be overriden at any level if necessary
  • All paths in a file are relative to the directory where the file is located, though all symlinks will resolve the absolute path and point to the absolute path
  • exec actions run with the current directory set to the directory that contains the configuration file

dotfiles-rs's People

Contributors

dependabot[bot] avatar miguelandres avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.