Coder Social home page Coder Social logo

nocode's Introduction

Nocode

Execute Ruby code through YAML

Gem Version Ruby Gem CI Maintainability License: MIT

Nocode is a library that provides a YAML interface draped over arbitrary Ruby code. The YAML contains a series of steps with each step mapping to a specific Ruby class. The Ruby classes just have one responsibility: to implement #perform.

Installation

To install through Rubygems:

gem install nocode

You can also add this to your Gemfile using:

bundle add nocode

Examples

Create a file called nocode-csv-to-json.yaml:

CSV-to-JSON File Converter

parameters:
  input_filename: input.csv
  output_filename: output.json

steps:
  - type: io/read
    name: READ FILE
    options:
      path:
        - files
        - << parameters.input_filename >>
  - type: deserialize/csv
  - type: serialize/json
  - type: io/write
    options:
      path:
        - files
        - << parameters.output_filename >>

Create csv file at: files/input.csv

Execute in Ruby:

path = Pathname.new('nocode-csv-to-json.yaml')

Nocode.execute(path)

Or use bundler:

bundle exec nocode nocode-csv-to-json.yaml

A file should have been created at: files/output.json.

Notes:

  • Path can be an array or a string. If its an array then the environment's path separator will be used.
  • The name job key is optional. If present then it will print out on the log.
  • Parameter values can be interpolated with keys and values using << parameters.key >> syntax

Contributing

Development Environment Configuration

Basic steps to take to get this repository compiling:

  1. Install Ruby (check nocode.gemspec for versions supported)
  2. Install bundler (gem install bundler)
  3. Clone the repository (git clone [email protected]:mattruggio/nocode.git)
  4. Navigate to the root folder (cd nocode)
  5. Install dependencies (bundle)

Running Tests

To execute the test suite run:

bin/rspec spec --format documentation

Alternatively, you can have Guard watch for changes:

bin/guard

Also, do not forget to run Rubocop:

bin/rubocop

And auditing the dependencies:

bin/bundler-audit check --update

Publishing

Note: ensure you have proper authorization before trying to publish new versions.

After code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:

  1. Merge Pull Request into main
  2. Update version.rb using semantic versioning
  3. Install dependencies: bundle
  4. Update CHANGELOG.md with release notes
  5. Commit & push main to remote and ensure CI builds main successfully
  6. Run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Code of Conduct

Everyone interacting in this codebase, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

License

This project is MIT Licensed.

nocode's People

Contributors

mattruggio avatar

Watchers

 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.