Home

Awesome

Factor.io Logo

Code Climate Coverage Status Dependency Status Build Status Gem Version Inline docs

What is Factor.io?

Factor.io a Ruby-based DSL for defining and running workflows connecting popular developer tools and services. It is designed to run from the command line, run locally without other service dependencies, very easily extensible, and workflow definitions are stored in files so they can be checked into your project repos. Workflows can run tasks on various tools and services (e.g. create a Github issue, post to Slack, make a HTTP POST call), and they can listen for events too (e.g. listen for a pattern in Slack, open a web hook, or listen for a git push on a branch in Github). Lastly, it supports great concurrency control so you can run many tasks in parallel and aggregate the results.

Install and Setup

This is a gem with a command line interface factor. To install:

gem install factor

Basic Usage

First, we need to install the dependencies (via Bundler).

Gemfile:

source "https://rubygems.org"

# Using code from Github for latest (as opposed to RubyGems).
gem 'factor', git: 'https://github.com/factor-io/factor.git'
gem 'factor-connector-web', git: 'https://github.com/factor-io/connector-web.git'

In a new project directory create a new file workflow.rb like this:

workflow.rb:

require 'factor-connector-web'

web_hook = run 'web::hook'

web_hook.on(:trigger) do |post_info|
  if post_info[:configured]
    success 'Configured and listening on...'
    success post_info[:configured][:url]
  else
    info post_info
  end
end

web_hook.on(:log) do |log_info|
  debug log_info[:message]
end

web_hook.execute
web_hook.wait

Now run this from the command line:

bundle install
bundle exec factor w workflow.rb

Next