GithubHelp home page GithubHelp logo

ecfg-ruby's Introduction

Ecfg for Ruby (WIP)

This is an alternate implementation of the ecfg(5) spec

Don't use this yet.

10-second demo:

input = <<~'EOF'
  ---
  yaml: |
    stuff
    words

  # asdf
  h: [3, "yaml", !!str "so many features", null]

  # Just like with ejson, underscore prefix prevents encryption.
  _b: !!str c
  c:
    - 42
    - "a\tb"
    - 'a\tb'
    - true
    - c
  d:
EOF

encrypter   = Ecfg::Crypto::Encrypter.new("6ea8ba92a66f795c17f9ba4dd3d3f445c1e4b9c34728b17aea370479eff1246d")
parser      = Ecfg::Parser::YAML.new # or TOML, or JSON
transformer = Ecfg::Transformer.new

puts transformer.transform(input, parser, &encrypter)

String values are encrypted, preserving structure and comments.

---
yaml: "EJ[1:QvMd4gferRRmyEvb81SI+i9QojuzqPnabxKu3g1eP00=:GLxcXxX/+c4IP76pq2+LnTBwIxmg9JLT:aWhsKYAFVMciiCZg3T2f/3NmbkyCBXX4IJkFCQ==]"
# asdf
h: [3, "EJ[1:QvMd4gferRRmyEvb81SI+i9QojuzqPnabxKu3g1eP00=:UKq1jKUUnMPE7/mcCwtAC/XKPszetqrG:U0QVfiE8IeCBx7bpkKuYyADyfi4=]", !!str "EJ[1:QvMd4gferRRmyEvb81SI+i9QojuzqPnabxKu3g1eP00=:m0amlXrx7Mv9p0CpRdTpv4CDNDvXyd5u:pIa0ql6FeM1ZhadSymShUKHuT/UXVwntusnuTE2G5lo=]", null]

# Just like with ejson, underscore prefix prevents encryption.
_b: !!str c
c:
  - 42
  - "EJ[1:QvMd4gferRRmyEvb81SI+i9QojuzqPnabxKu3g1eP00=:GlsopadN+GBnmiXOT9Gc4j44um+U1rbx:j69WBIobHzQKuyl7z5rlyrso5A==]"
  - "EJ[1:QvMd4gferRRmyEvb81SI+i9QojuzqPnabxKu3g1eP00=:XjytZAoIXqKNooj6P9FvMxGGH7egFYI4:06+JyXE5GTShdD78IHYGf2SsLfw=]"
  - true
  - "EJ[1:QvMd4gferRRmyEvb81SI+i9QojuzqPnabxKu3g1eP00=:Vd95Z4h//lkYZgVahe3MKUjb+A2ThEWw:m9dRCWKrXNTSypLLF/NqWkA=]"
d:

ecfg-ruby's People

Contributors

burke avatar jules2689 avatar

Stargazers

 avatar

Watchers

 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.