项目作者: benchOS

项目描述 :
The Official Library For Benny's Benfile Parsing and Execution
高级语言: JavaScript
项目地址: git://github.com/benchOS/bennyfile.git
创建时间: 2018-06-05T01:20:01Z
项目社区:https://github.com/benchOS/bennyfile

开源协议:MIT License

下载


Bennyfile (Benfile Parser For Benny)

benOSShield-OfficialbenOSShield-UtilsbenOSShield-Utilsbuild statusJavaScript Style Guide
benOSRepoHeader


Benfile parsing library that converts a Benfile to a JSON object and then back to the original format.

Table of Contents

Background

Benfiles are basically installer-steps for Benny, benOS’ native container builder and management software. This library was created to parse and delivery the installation steps within a Benfile in JSON format, to Benny for execution.

benOSRepoHeader

With NPM

  1. npm install bennyfile

With YARN

  1. yarn add bennyfile

Usage

  1. var bennyfile = require('bennyfile')
  2. var parsedBenny = bennyfile.parseBenny(`
  3. FROM ubuntu:xenial
  4. RUN rm -f /etc/resolv.conf && echo '8.8.8.8' > /etc/resolv.conf
  5. RUN apt-get update
  6. RUN apt-get install -y git vim curl
  7. RUN curl -fs https://raw.githubusercontent.com/benchOS/getnjs/master/go | sh
  8. RUN node-install 8.9.1
  9. `)
  10. // prints the parsedBenny file
  11. console.log(parsedBenny)
  12. // serializes it again
  13. console.log(bennyfile.stringify(parsedBenny))

Syntax

The Benfile formatting is similar to a Dockerfile, just easier and shorter.

  1. VIA os:version
  2. GO shell-command
  3. TO from/local/file /to/container/path
  4. IN key=value key2=value2
  5. DO key=value

Alternatively if you are referencing another Benfile or disk image you can do

  1. VIA ./path/to/disk/image/or/Benfile

If your shell command is long you can split it into multiple lines using the familiar \\ syntax

  1. GO apt-get update && \\
  2. apt-get install -y git vim curl

To comment out a line add # infront.

To force run a command (i.e. cache bust it) you can prefix any command with FORCE.

API

var parsedBenny = bennyfile.parseBenny(string)

Parse the content of a Benfile.
Returns an array of objects, each representing a line.

  1. // VIA os:version
  2. {
  3. type: 'via',
  4. image: 'os',
  5. version: 'version',
  6. path: null
  7. }
  8. // VIA ./path
  9. {
  10. type: 'via',
  11. image: null,
  12. version: null,
  13. path: './path'
  14. }
  15. // GO command
  16. {
  17. type: 'go',
  18. command: 'command'
  19. }
  20. // TO from to
  21. {
  22. type: 'to',
  23. from: 'from',
  24. to: 'to'
  25. }
  26. // IN key=value key2="value 2" ...
  27. {
  28. type: 'in',
  29. env: [{
  30. key: 'key',
  31. value: 'value'
  32. }, {
  33. key: 'key2',
  34. value: 'value 2'
  35. }]
  36. }
  37. // DO key=value
  38. {
  39. type: 'do',
  40. key: 'key',
  41. value: 'value'
  42. }
  43. // DO key
  44. {
  45. type: 'do',
  46. key: 'key',
  47. value: null
  48. }

If a command is prefixed with FORCE, force: true will be set on the object.

var str = bennyfile.stringify(parsedBenny)

Convert a parsedBenny JS object (JSON Formatted version of Benfile) back to the original Benfile format

  • benOS - benOS Decentralized Operating System
  • benny - benOS Native Container Builder
  • gospawn - Bootstrap Spawner For Benny
  • bennyfile - Build File Library For Benny Containers
  • thinbit - BitField Library For Benny

Why The Internet Must Have A Decentralized Alternative

Today, the internet is more censored than ever and it’s only getting worse. Our mission with the dWeb Protocol was to create a truly powerful P2P protocol, around benOS, dBrowser and many of benOS’ underlying libraries to bring the most powerful P2P products to life. In the last few months, by rebuilding P2P technologies that have existed since the early 2000s, we have built a powerful suite of decentralized libraries for benOS and the Bench Network, that will only improve over time. But we also brought new ideas to life, like:

and more! These were the protocols and libraries that we needed to create a completely decentralized operating system, where everything was distributed, protected and people were once again in control of their data. benOS is made up of over 1100+ different libraries that we are releasing on a day-by-day basis as we move them to a stable/production state. While financial support is great for this open source project, we need developers who want to be some of the first to build the dApps and dSites of the future. We have to take back what our forefathers originally designed for freedom, by making our code the law, instead of releasing weak and highly centralized applications where law cannot be applied because the code lacks the foundation to implement a legal framework for itself. Join us for a truly historic journey on the BenchLabs Telegram. See you there.

Bench On The dWeb

dweb://bench.dnames.io // dNames Short Link
dweb://3EDAE09848B77401445B7739CAFCE442DDE1752AED63025A1F94E6A86D7E9F04 // dWeb Key Link

In order to make the links above clickable or to view these links period, you will need dBrowser (Available for Mac OSX, Linux, Windows and soon to be available on iOS/Android)

“The Code Is The Law” - Stan Larimer - Godfather of BitShares.

License

MIT



JavaScript Style Guide


forthebadge


dWebShield

Copyright (c) 2018 Bench Open Systems. All rights reserved.