Skip to content
Consul event definition DSL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
examples
lib
test
vendor
.gitignore
.travis.yml
Gemfile
LICENSE
LICENSE.txt
README.md
Rakefile
populus.gemspec

README.md

Populus

[WIP][Will breaking change] Consul event handlers definition DSL

Installation

Add this line to your application's Gemfile:

gem 'populus'

And then execute:

$ bundle

Or install it yourself as:

$ gem install populus

Usage

Usages below are just a draft

Populus.config do
  set :slack_webhook, "https://hooks.slack.com/services/XXXXXX"
end

Populus.watch :event, name: "echo" do
  cond {|data| data.any?{|d| d.has_key?('Payload')} }
  runs do |data|
    event = data.find{|d| d.has_key?('Payload')}
    Populus.logger.info "From populus!!!"
    Populus.logger.info Base64.decode64(event['Payload'])
  end
end

Populus.watch :event, name: "slack" do
  cond {|data| data.any?{|d| d.has_key?('Payload')} }
  runs do |data|
    event = data.first

    notify_to_slack("Hello!!!\nConsul event payload:\n>>> `#{event.inspect}`", channel: '#test', username: "Populus")
  end
end
bundle exec populus watch sample.popl

TODOs

  • Deployment switching by node name
  • Condition phrase against JSON
  • Local/remote execution by specinfra
  • More helpers
  • Omnibusify

Contributing

  1. Fork it ( https://github.com/udzura/populus/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.