13 unstable releases (3 breaking)

0.4.1 Dec 27, 2023
0.4.0 Dec 16, 2023
0.3.4 Dec 8, 2023
0.3.3 Nov 27, 2023
0.1.0 Jul 17, 2023

#155 in Configuration

Custom license

57KB
1.5K SLoC

rrcm

Crates.io Workflow Status codecov

A cross-platform compatible tool for deploying multiple dotfiles repositories.

Introduction

  • Deploy configuration files and directories using symbolic links.
  • Configuration files and directories are managed in a git repository.
  • Provides deployment on multiple OS from the same directory.

Provides the location of these directories by leveraging the mechanisms defined by

Direcotry

The configuration file specifies the mapping between deployment sources and destinations for each platform. rrcm creates symbolic links to files and directories directly under the deployment targets in the deployment destination.

(dotfiles repository download directory)
dotiles
│   (local repositroy)
├── example1
│   │   (deploy target)
│   ├── home
│   │   │               (symbolic link)
│   │   ├── .profile <- $HOME/.profile     (on Linux and Mac)
│   │   │               %PROFILE%\.profile (on Win)
│   │   ├── .vim     <- $HOME/.vim         (on Linux and Mac)
│   │   │               %PROFILE%\.vim     (on Win)
│   │   └── ...
│   │
│   └── .config
│       ├── nvim     <- $HOME/.config/nvim                  (on Linux and Mac),
│       │               %PROFILE%\AppData\LocalAppData\nvim (on Win)
│       └── ...
│
└── example2 (next local repositroy)
    └── ...

Under the deployment target dierctory, files and directorys are deployed by symbolic link. Windows needs to be run as administrator.

Configuration

configuration file path:

  • Unix: $HOME/.config/rrcm/config.yaml
  • Win: %PROFILE%\AppData\Roaming\rrcm\config.yaml
---
# dotfiles repositroy download directory
dotfiles:
  windows: "%USERPROFILE%\\dotfiles"
  mac: "${HOME}/.dotfiles"
  linux: "${HOME}/.dotfiles"

# repositories. multiple repositories can be specified.
repos:

    # local repository name
  - name: example1

    # git repository url
    url: 'git@github:example/example1'

    # deploy configuration
    deploy:

      # deploy target
      # Example: deploy home directory to $HOME or %USERPROFILE%
      home:

        # deploy destination on each OS.
        # if OS not defined, it will not be deployed.
        windows: "%USERPROFILE%"
        mac: "${HOME}"
        linux: "${HOME}"

      # Example: deploy .config directory to XDG_CONFIG_HOME or %USERPROFILE%\AppData\Roaming
      .config:
        windows: "%FOLDERID_RoamingAppData%"
        mac: "${XDG_CONFIG_HOME}"
        linux: "${XDG_CONFIG_HOME}"

      # Example: deploy .config-LocalAppData to XDG_CONFIG_HOME or %USERPROFILE%\AppData\Local
      .config-LocalAppData:
        windows: "%FOLDERID_LocalAppData%"
        mac: "${XDG_CONFIG_HOME}"
        linux: "${XDG_CONFIG_HOME}"

    # next repository
  - name: example2
    url: 'git@github:example/example2'
    ...

Deployment destination

Environment variables can be used in deployment destination.

Format

  • Unix: ${ENVIRONMENT_VARIABLE_NAME}
  • Windows: %ENVIRONMENT_VARIABLE_NAME%

The following special variables are available.

  • Unix XDG base directory if the environment variable is not set, the default value is used.
    • ${XDG_CONFIG_HOME}
    • ${XDG_DATA_HOME}
  • Windows Known Folder ID
    • %FOLDERID_RoamingAppData%
    • %FOLDERID_LocalAppData%
    • %FOLDERID_Documents%
    • %FOLDERID_Desktop%

Install

Cargo

cargo install rrcm

Usage

initialize config file

rrcm init
# or initialize config file from http
rrcm init <url>

I recommend using gist like this. my config.yaml

update(git clone or pull) repositories and deploy

rrcm update

show deploy status

rrcm status

Dependencies

~8–42MB
~673K SLoC