Skip to content

Commit 1a8b717

Browse files
author
Maciej Skierkowski
committed
Update README.md
1 parent db86b85 commit 1a8b717

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

README.md

+34-9
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,50 @@ This is a gem with a command line interface `factor`. To install:
1616
gem install factor
1717

1818
## Basic Usage
19-
First, we need to install the dependencies
19+
First, we need to install the dependencies (via Bundler).
20+
21+
**Gemfile**:
2022
```
21-
gem install factor-connector-web
23+
source "https://rubygems.org"
24+
25+
# Using code from Github for latest (as opposed to RubyGems).
26+
gem 'factor', git: 'https://github.com/factor-io/factor.git'
27+
gem 'factor-connector-web', git: 'https://github.com/factor-io/connector-web.git'
2228
```
2329

2430
In a new project directory create a new file `workflow.rb` like this:
25-
**workflow.rb**
31+
32+
**workflow.rb**:
2633
```ruby
34+
require 'factor-connector-web'
35+
2736
web_hook = run 'web::hook'
37+
2838
web_hook.on(:trigger) do |post_info|
29-
if post_info[:configured]
30-
success "Workflow is listening on #{hook_info[:configured][:url]}"
31-
else
32-
info "Received a hook call: #{post_info}"
33-
end
39+
if post_info[:configured]
40+
success 'Configured and listening on...'
41+
success post_info[:configured][:url]
42+
else
43+
info post_info
44+
end
3445
end
3546

47+
web_hook.on(:log) do |log_info|
48+
debug log_info[:message]
49+
end
50+
51+
web_hook.execute
3652
web_hook.wait
3753
```
3854

3955
Now run this from the command line:
40-
`factor w`
56+
```
57+
bundle install
58+
bundle exec factor w workflow.rb
59+
```
60+
61+
## Next
62+
63+
- [Workflow Syntax](https://github.com/factor-io/factor/wiki/Workflow-Syntax): Factor.io workflows can do all sorts of magic, like running in parallel, aggregating command results, defining sequences, error handling, and more.
64+
- [Connectors](https://github.com/factor-io/factor/wiki/Connectors): These are the officially support Connectors (integrations).
65+
- [Custom Connectors](https://github.com/factor-io/factor/wiki/Creating-a-custom-connector): A guide for creating a custom Connector.

0 commit comments

Comments
 (0)