Project

zq

0.0
No commit activity in last 3 years
No release in over 3 years
Pull stuff from source then digest and create inside a repository
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

ZQ - Unixy building blocks in ruby

Build Status Gem Version Dependency Status Coverage Status FOSSA Status

This started as a simple proof of concept and looked kinda promising. The hole concept is centered around an Orchestra which has a source where it can read chunks of data from. The data is than passed through chainable composers. The source and the composers just need to implement a certain method each in order to work.

Examples-Orchestras

This is how the Echo-Orchestra looks like

class Echo
  include ZQ::Orchestra
  source ZQ::Sources::IOSource.new $stdin
  compose_with ZQ::Composer::Echo.new
  desc 'prints contents from stdin'
end

Thats fairly verbose to just implement a PIPE. But consider the following

equire 'redis'
require 'zq'

CLIENT = Redis.new(db: 1)

class RedisPull
  include ZQ::Orchestra
  source ZQ::Sources::RedisLPOP.new(CLIENT, "incoming")
  compose_with ZQ::Composer::Echo.new
  desc "reads from redis:key:'incoming' and prints to stdout"
end

Here we print items from a redis list. Checkout the examples directory for more. Also check the lib/source and lib/composers directory and mix and match your tool

Synopsis
zq <cmd> <ORCHESTRA_NAME> [--file=<FILE>]
# or
Commands:
  zq help [COMMAND]       # Describe available commands or one specific command
  zq list                 # List available orchestras.
  zq play ORCHESTRA_NAME  # Start orchestrating.

Options:
  -r, [--file=FILE]  # Require file to load orchestras from
---

Usage:
  zq play ORCHESTRA_NAME

Options:
  -d, [--forever], [--no-forever]  # Keep running even if source is exhausted
  -i, [--interval=N]               # Play orchestra every N seconds
                                   # Default: 0
  -r, [--file=FILE]                # Require file to load orchestras from

Start orchestrating.

Installing

ZQ comes as a gem, so given you have ruby installed simply do the following

> gem install zq

Contributing Code

If you want to contribute code, please try to:

  • Follow the same coding style as used in the project. Pay attention to the usage of tabs, spaces, newlines and brackets. Try to copy the aesthetics the best you can.
  • Add a scenario under features that verifies your change (test with rake features). Look at the existing test suite to get an idea for the kind of tests I like. If you do not provide a test, explain why.
  • Write good commit messages, explain what your patch does, and why it is needed.
  • Keep it simple: Any patch that changes a lot of code or is difficult to understand should be discussed before you put in the effort.

Once you have tried the above, create a GitHub pull request to notify me of your changes.

##TODO

  • add more sources and composers
  • better error handling for transactions

License

FOSSA Status