Coder Social home page Coder Social logo

omniverse's Introduction

Omniverse

Omniverse allows to substitute strings in a set of files

Key Feature

String substitution

Omniverse is a tiny command line tool. It's main purpose is to perform string substitution on multiple files in a correct manner. It does so by reading a source directory and its configuration file (manifest) and creating an altered copy of the directories content in a destination directory using another manifest.

The manifests are a simple mappings of the strings that are required to substitute.

Thats is

Omniverse does nothing other than that: No complex templating or other logic is applied other than string substitution. This is considered a feature.

Install

Binary Download

Navigate to Releases, grab the package that matches your operating system and architecture. Unpack the archive and put the binary file somewhere in your $PATH

From Source

Make sure you have go installed, then run:

# go get -u https://github.com/unprofession-al/omniverse

Configuration

Omniverse takes an input directory and an output directory as arguments. Both of these directories need to have an manifest file in it's root. These files must be named .alterverse.yml. The manifest are written in YAML markup and must look similar to this:

---
manifest:
  env: production
  loadbalancer: prod.lb.example.com

Given the example from above is located in the root uppermost directory of the source directory and the destination directory contains a .alterverse.yml file with the following content:

---
manifest:
  env: test
  loadbalancer: test.lb.example.com

An arbitrary file present the source folder with the content of...

resource "aws_lb" "production" {
  name               = "production_lb"
  internal           = false
  load_balancer_type = "network"
  subnets            = ["${aws_subnet.public.*.id}"]

  tags = {
    Environment = "production"
    DNSRecord = "prod.lb.example.com"
  }
}

... would be rendered to the destination directory with the content of...

resource "aws_lb" "test" {
  name               = "test_lb"
  internal           = false
  load_balancer_type = "network"
  subnets            = ["${aws_subnet.public.*.id}"]

  tags = {
    Environment = "test"
    DNSRecord = "test.lb.example.com"
  }
}

Run

# omniverse help
Create a copy of a directory with deviations

Usage:
  omniverse [command]

Available Commands:
  deduce      Deduce an alterverse
  help        Help about any command
  version     Print version info

Flags:
  -h, --help   help for omniverse

Use "omniverse [command] --help" for more information about a command.

To execute the example from the Configuration section run:

omniverse deduce --from /tmp/prod --to /tmp/test

omniverse's People

Contributors

sontags avatar juerg-liechti avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Forkers

hpchrist

omniverse's Issues

Verify source encoding

Obviously omniverse has a hard time to handle weird windows encoded files. The encoding should be therefore checked when reading files and exited if the encoding cannot be read.

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.