All Projects → bkuhlmann → runcom

bkuhlmann / runcom

Licence: other
An XDG enhanced run command manager for command line interfaces.

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to runcom

Hashi Helper
Disaster Recovery and Configuration Management for Consul and Vault
Stars: ✭ 155 (+868.75%)
Mutual labels:  configuration-management
Xconf
分布式配置中心
Stars: ✭ 185 (+1056.25%)
Mutual labels:  configuration-management
Fusioninventory For Glpi
FusionInventory plugin for GLPI
Stars: ✭ 241 (+1406.25%)
Mutual labels:  configuration-management
Salt
Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
Stars: ✭ 12,086 (+75437.5%)
Mutual labels:  configuration-management
Fusioninventory Agent
FusionInventory Agent
Stars: ✭ 177 (+1006.25%)
Mutual labels:  configuration-management
Cdist
usable configuration management
Stars: ✭ 210 (+1212.5%)
Mutual labels:  configuration-management
Profiles
🔎 Profiles (mobileconfig files) for macOS.
Stars: ✭ 149 (+831.25%)
Mutual labels:  configuration-management
ini
📝 Go INI config management. support multi file load, data override merge. parse ENV variable, parse variable reference. Dotenv file parse and loader. INI配置读取管理,支持多文件加载,数据覆盖合并, 解析ENV变量, 解析变量引用。DotEnv 解析加载
Stars: ✭ 72 (+350%)
Mutual labels:  configuration-management
Microconfig
Modern tool for microservice configuration management
Stars: ✭ 180 (+1025%)
Mutual labels:  configuration-management
Kconfiglib
A flexible Python 2/3 Kconfig implementation and library
Stars: ✭ 231 (+1343.75%)
Mutual labels:  configuration-management
Apollo.net
Apollo配置中心.Net客户端
Stars: ✭ 165 (+931.25%)
Mutual labels:  configuration-management
Pearl
Pearl is a lightweight package manager for automating reproducible environments between different systems (Linux and OSX). It can be used for dotfiles, plugins, programs and any form of code accessible via git.
Stars: ✭ 166 (+937.5%)
Mutual labels:  configuration-management
Deck
decK: Configuration management and drift detection for Kong
Stars: ✭ 211 (+1218.75%)
Mutual labels:  configuration-management
Libelektra
Elektra serves as a universal and secure framework to access configuration parameters in a global, hierarchical key database.
Stars: ✭ 155 (+868.75%)
Mutual labels:  configuration-management
go-uci
Native Go bindings for OpenWrt's UCI.
Stars: ✭ 69 (+331.25%)
Mutual labels:  configuration-management
Qconf
Qihoo Distributed Configuration Management System
Stars: ✭ 1,843 (+11418.75%)
Mutual labels:  configuration-management
Habitat
Modern applications with built-in automation
Stars: ✭ 2,334 (+14487.5%)
Mutual labels:  configuration-management
bmcbutler
BMC configuration management tool
Stars: ✭ 70 (+337.5%)
Mutual labels:  configuration-management
WDR
Jython framework aiming for simplified WebSphere Application Server scripting
Stars: ✭ 43 (+168.75%)
Mutual labels:  configuration-management
Mgmt
Next generation distributed, event-driven, parallel config management!
Stars: ✭ 2,708 (+16825%)
Mutual labels:  configuration-management

Runcom

Runcom is a Run Command portmanteau (i.e. run
[com]mand = runcom
) which provides common functionality for Command Line Interfaces (CLIs) in which to manage global, local, or multiple caches, configurations, or data in general. It does this by leveraging the XDG Base Directory Specification built atop the XDG implementation. In other words, Runcom is an advanced version of XDG.

Features

  • Wraps the XDG implementation which provides access to the following environment variables:

    • $XDG_CACHE_HOME

    • $XDG_CONFIG_HOME

    • $XDG_CONFIG_DIRS

    • $XDG_DATA_HOME

    • $XDG_DATA_DIRS

    • $XDG_STATE_HOME

  • Enhances the XDG cache, config, data, and state implementation. For the config, the following is supported:

    • Supports loading of CLI-specific YAML configuration file.

    • Supports loading and merging of nested/complex configurations.

    • Supports hash representation of configuration.

Requirements

Setup

To install, run:

gem install runcom

Add the following to your Gemfile:

gem "runcom"

Usage

The following describes the enhancements built atop the XDG implementation.

Overview

While there isn’t an environment convenience object as found in the XDG namespace, you can instantiate each object individually:

cache = Runcom::Cache.new "example/data.json"
config = Runcom::Config.new "example/configuration.yml"
data = Runcom::Data.new "example/store.dat"
state = Runcom::State.new "example/history.log"

Each of the above objects share the same API:

  • #relative - Answers the relative path from which the object was constructed.

  • #namespace - Answers the relative namespace as a pathname object from which the object was constructed. The namespace must be identical across the cache, config, and data objects as this is what uniquely identifies and organizes all files associated with your program.

  • #file_name - Answers the file name from which the object was constructed.

  • #current - Answers first existing file system path computed by $XDG_*HOME followed by each computed $XDG*_DIRS path in order defined. Otherwise, nil is answered back.

  • #all - Answers all file system paths which is the combined $XDG_*HOME and $XDG*DIRS values in order defined. These paths _may or may not exist on the file system.

  • #inspect - Answers a string representation of default XDG home and directory paths for debugging purposes.

Using the cache object (created above) as an example, here is what each method answers back:

cache.relative # => #<Pathname:example/data.json>
cache.namespace # #<Pathname:example>
cache.file_name # #<Pathname:data.json>
cache.current # #<Pathname:/Users/bkuhlmann/.cache/example/data.json>
cache.all # [#<Pathname:/Users/bkuhlmann/.cache/example/data.json>]
cache.inspect # "XDG_CACHE_HOME=/Users/bkuhlmann/.cache"

Variable Priority

Path precedence is determined in the following order (with the first taking highest priority):

  1. Local Configuration - If a $XDG_*HOME or $XDG*_DIRS path relative to the current working directory is detected, it will take precedence over the global configuration. This is the same behavior as found in Git where the local .git/config takes precedence over the global $HOME/.gitconfig.

  2. Global Configuration - When a local configuration isn’t found, the global configuration is used as defined by the XDG Base Directory Specification.

Configuration Specialization

The Runcom::Config deserves additional highlighting as it provides support for loading custom CLI configurations directly from the command line or from custom locations. It is meant to be used within your program(s).

An object is initialized as follows:

configuration = Runcom::Config.new "example/configuration.yml"

Default settings can be initialized as well:

configuration = Runcom::Config.new "example/configuration.yml", defaults: {name: "Example"}

Once a configuration has been initialized, a hash representation can be obtained:

configuration.to_h

A configuration can be merged with another hash (handy for runtime overrides):

updated_configuration = configuration.merge {name: "Updated Name"}

A configuration can also be merged with another configuration:

updated_configuration = configuration.merge Runcom::Config.new("other", defaults: {a: 1})

The current path of the configuration can be asked for as well:

configuration.current # "~/.config/example/configuration.yml"

For further details, study the public interface as provided by the Runcom::Config object.

Examples

Examples of gems built atop this gem are:

  • Rubysmith - A command line interface for smithing Ruby projects.

  • Gemsmith - A command line interface for smithing new Ruby gems.

  • Git Lint - Enforces consistent Git commits.

  • Milestoner - A command line interface for releasing Git repository milestones.

  • Pennyworth - A command line interface that enhances and extends Alfred with Ruby support.

  • Pragmater - A command line interface for managing/formatting source file pragma comments.

  • Sublime Text Kit - A command line interface for managing Sublime Text metadata.

  • Tocer - A command line interface for generating table of contents for Markdown files.

Development

To contribute, run:

git clone https://github.com/bkuhlmann/runcom
cd runcom
bin/setup

You can also use the IRB console for direct access to all objects:

bin/console

Tests

To test, run:

bin/rake

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].