Project

populus

0.01
No commit activity in last 3 years
No release in over 3 years
Consul event definition DSL
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
>= 10.0

Runtime

 Project Readme

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