uniform_notifier-1.16.0/ 0000755 0000041 0000041 00000000000 14235144655 015216 5 ustar www-data www-data uniform_notifier-1.16.0/README.md 0000644 0000041 0000041 00000012741 14235144655 016502 0 ustar www-data www-data # UniformNotifier
[](https://github.com/flyerhzm/uniform_notifier/actions/workflows/ci.yml)
[](https://awesomecode.io/repos/flyerhzm/uniform_notifier)
uniform_notifier is extracted from [bullet][0], it gives you the ability to send notification through rails logger, customized logger, javascript alert, javascript console, xmpp, airbrake, honeybadger and AppSignal.
## Install
### install directly
gem install uniform_notifier
if you want to notify by xmpp, you should install xmpp4r first
gem install xmpp4r
if you want to notify by airbrake, you should install airbrake first
gem install airbrake
if you want to notify by Honeybadger, you should install honeybadger first
gem install honeybadger
if you want to notify by rollbar, you should install rollbar first
gem install rollbar
if you want to notify by bugsnag, you should install bugsnag first
gem install bugsnag
if you want to notify by AppSignal, you should install AppSignal first
gem install appsignal
if you want to notify by slack, you should install slack-notifier first
gem install slack-notifier
if you want to notify by terminal-notifier, you must install it first
gem install terminal-notifier
### add it into Gemfile (Bundler)
gem "uniform_notifier"
you should add xmpp4r, airbrake, bugsnag, honeybadger, slack-notifier, terminal-notifier gem if you want.
## Usage
There are two types of notifications,
one is inline_notify
, for javascript alert and javascript console notifiers, which returns a string and will be combined,
the other is out_of_channel_notify
, for rails logger, customized logger, xmpp, which doesn't return anything, just send the message to the notifiers.
By default, all notifiers are disabled, you should enable them first.
```ruby
# javascript alert
UniformNotifier.alert = true
# javascript alert with options
# the attributes key adds custom attributes to the script tag appended to the body
UniformNotifier.alert = { :attributes => { :nonce => 'mySecret-nonce', 'data-key' => 'value' } }
# javascript console (Safari/Webkit browsers or Firefox w/Firebug installed)
UniformNotifier.console = true
# javascript console with options
# the attributes key adds custom attributes to the script tag appended to the body
UniformNotifier.console = { :attributes => { :nonce => 'mySecret-nonce', 'data-key' => 'value' } }
# rails logger
UniformNotifier.rails_logger = true
# airbrake
UniformNotifier.airbrake = true
# airbrake with options
UniformNotifier.airbrake = { :error_class => Exception }
# AppSignal
UniformNotifier.appsignal = true
# AppSignal with options
UniformNotifier.appsignal = { :namespace => "Background", :tags => { :hostname => "frontend1" } }
# Honeybadger
#
# Reporting live data from development is disabled by default. Ensure
# that the `report_data` option is enabled via configuration.
UniformNotifier.honeybadger = true
# Honeybadger with options
UniformNotifier.honeybadger = { :error_class => 'Exception' }
# rollbar
UniformNotifier.rollbar = true
# rollbar with options (level can be 'debug', 'info', 'warning', 'error' or 'critical')
UniformNotifier.rollbar = { :level => 'warning' }
# bugsnag
UniformNotifier.bugsnag = true
# bugsnag with options
UniformNotifier.bugsnag = { :api_key => 'something' }
# slack
UniformNotifier.slack = true
# slack with options
UniformNotifier.slack = { :webhook_url => 'http://some.slack.url', :channel => '#default', :username => 'notifier' }
# customized logger
logger = File.open('notify.log', 'a+')
logger.sync = true
UniformNotifier.customized_logger = logger
# xmpp
UniformNotifier.xmpp = { :account => 'sender_account@jabber.org',
:password => 'password_for_jabber',
:receiver => 'recipient_account@jabber.org',
:show_online_status => true }
# terminal-notifier
UniformNotifier.terminal_notifier = true
# raise an error
UniformNotifier.raise = true # raise a generic exception
class MyExceptionClass < Exception; end
UniformNotifier.raise = MyExceptionClass # raise a custom exception type
UniformNotifier.raise = false # don't raise errors
```
After that, you can enjoy the notifiers, that's cool!
```ruby
# the notify message will be notified to rails logger, customized logger or xmpp.
UniformNotifier.active_notifiers.each do |notifier|
notifier.out_of_channel_notify("customize message")
end
# the notify message will be wrapped by ,
# you should append the javascript_str at the bottom of http response body.
# for more information, please check https://github.com/flyerhzm/bullet/blob/master/lib/bullet/rack.rb
responses = []
UniformNotifier.active_notifiers.each do |notifier|
responses << notifier.inline_notify("customize message")
end
javascript_str = responses.join("\n")
```
## XMPP/Jabber Support
To get XMPP support up-and-running, follow the steps below:
* Install the xmpp4r gem: gem install xmpp4r
* Make both the sender and the recipient account add each other as contacts.
This will require you to manually log into both accounts, add each other
as contact and confirm each others contact request.
* Boot up your application. UniformNotifier will automatically send an XMPP notification when XMPP is turned on.
[0]: https://github.com/flyerhzm/bullet
uniform_notifier-1.16.0/spec/ 0000755 0000041 0000041 00000000000 14235144655 016150 5 ustar www-data www-data uniform_notifier-1.16.0/spec/spec_helper.rb 0000644 0000041 0000041 00000000270 14235144655 020765 0 ustar www-data www-data # frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'uniform_notifier'
require 'xmpp4r'
require 'slack-notifier'
require 'rspec'
uniform_notifier-1.16.0/spec/uniform_notifier/ 0000755 0000041 0000041 00000000000 14235144655 021526 5 ustar www-data www-data uniform_notifier-1.16.0/spec/uniform_notifier/rails_logger_spec.rb 0000644 0000041 0000041 00000001141 14235144655 025533 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
class Rails
# mock Rails
end
RSpec.describe UniformNotifier::RailsLogger do
it 'should not notify rails logger' do
expect(UniformNotifier::RailsLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
end
it 'should notify rails logger' do
logger = double('logger')
expect(Rails).to receive(:logger).and_return(logger)
expect(logger).to receive(:warn).with('notify rails logger')
UniformNotifier.rails_logger = true
UniformNotifier::RailsLogger.out_of_channel_notify(title: 'notify rails logger')
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/airbrake_spec.rb 0000644 0000041 0000041 00000001504 14235144655 024645 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
class Airbrake
# mock Airbrake
end
RSpec.describe UniformNotifier::AirbrakeNotifier do
it 'should not notify airbrake' do
expect(UniformNotifier::AirbrakeNotifier.out_of_channel_notify(title: 'notify airbrake')).to be_nil
end
it 'should notify airbrake' do
expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), {})
UniformNotifier.airbrake = true
UniformNotifier::AirbrakeNotifier.out_of_channel_notify(title: 'notify airbrake')
end
it 'should notify airbrake' do
expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), { foo: :bar })
UniformNotifier.airbrake = { foo: :bar }
UniformNotifier::AirbrakeNotifier.out_of_channel_notify('notify airbrake')
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/base_spec.rb 0000644 0000041 0000041 00000001404 14235144655 023776 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Base do
context '#inline_channel_notify' do
before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
it 'should keep the compatibility' do
expect(UniformNotifier::Base).to receive(:_inline_notify).once.with({ title: 'something' })
UniformNotifier::Base.inline_notify('something')
end
end
context '#out_of_channel_notify' do
before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
it 'should keep the compatibility' do
expect(UniformNotifier::Base).to receive(:_out_of_channel_notify).once.with({ title: 'something' })
UniformNotifier::Base.out_of_channel_notify('something')
end
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/customized_logger_spec.rb 0000644 0000041 0000041 00000001343 14235144655 026613 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::CustomizedLogger do
it 'should not notify to customized logger' do
expect(UniformNotifier::CustomizedLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
end
it 'should notify to customized logger' do
logger = File.open('test.log', 'a+')
logger.sync = true
now = Time.now
allow(Time).to receive(:now).and_return(now)
UniformNotifier.customized_logger = logger
UniformNotifier::CustomizedLogger.out_of_channel_notify(title: 'notify rails logger')
logger.seek(0)
expect(logger.read).to eq "#{now.strftime('%Y-%m-%d %H:%M:%S')}[WARN] notify rails logger"
File.delete('test.log')
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/bugsnag_spec.rb 0000644 0000041 0000041 00000005720 14235144655 024517 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
class Bugsnag
# mock Bugsnag
end
RSpec.describe UniformNotifier::BugsnagNotifier do
let(:notification_data) { {} }
let(:report) { double('Bugsnag::Report') }
before do
allow(report).to receive(:severity=)
allow(report).to receive(:add_tab)
allow(report).to receive(:grouping_hash=)
end
it 'should not notify bugsnag' do
expect(Bugsnag).not_to receive(:notify)
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
end
context 'with string notification' do
let(:notification_data) { 'notify bugsnag' }
it 'should notify bugsnag' do
expect(Bugsnag).to receive(:notify).with(
UniformNotifier::Exception.new(notification_data)
).and_yield(report)
expect(report).to receive(:severity=).with('warning')
expect(report).to receive(:add_tab).with(:bullet, { title: notification_data })
expect(report).to receive(:grouping_hash=).with(notification_data)
UniformNotifier.bugsnag = true
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
end
it 'should notify bugsnag with additional report configuration' do
expect(Bugsnag).to receive(:notify).with(
UniformNotifier::Exception.new(notification_data)
).and_yield(report)
expect(report).to receive(:meta_data=).with({ foo: :bar })
UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
end
end
context 'with hash notification' do
let(:notification_data) { { user: 'user', title: 'notify bugsnag', url: 'URL', body: 'something' } }
it 'should notify bugsnag' do
expect(Bugsnag).to receive(:notify).with(
UniformNotifier::Exception.new(notification_data[:title])
).and_yield(report)
expect(report).to receive(:severity=).with('warning')
expect(report).to receive(:add_tab).with(:bullet, notification_data)
expect(report).to receive(:grouping_hash=).with(notification_data[:body])
UniformNotifier.bugsnag = true
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
end
it 'should notify bugsnag with option' do
expect(Bugsnag).to receive(:notify).with(
UniformNotifier::Exception.new(notification_data[:title])
).and_yield(report)
expect(report).to receive(:meta_data=).with({ foo: :bar })
UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
end
end
it 'should notify bugsnag with correct backtrace' do
expect(Bugsnag).to receive(:notify) do |error|
expect(error).to be_a UniformNotifier::Exception
expect(error.backtrace).to eq ['bugsnag spec test']
end
UniformNotifier.bugsnag = true
UniformNotifier::BugsnagNotifier.out_of_channel_notify(backtrace: ['bugsnag spec test'])
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/appsignal_spec.rb 0000644 0000041 0000041 00000006257 14235144655 025055 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
class Appsignal
# mock AppSignal
end
RSpec.describe UniformNotifier::AppsignalNotifier do
it 'should not notify appsignal' do
expect(UniformNotifier::AppsignalNotifier.out_of_channel_notify(title: 'notify appsignal')).to be_nil
end
it 'should notify appsignal with keyword title' do
expect(Appsignal).to receive(:send_error).with(UniformNotifier::Exception.new("notify appsignal\n"))
UniformNotifier.appsignal = true
expect(UniformNotifier::AppsignalNotifier.out_of_channel_notify(title: 'notify appsignal'))
end
it 'should notify appsignal with first argument title' do
expect(Appsignal).to receive(:send_error).with(
UniformNotifier::Exception.new("notify appsignal\n")
)
UniformNotifier.appsignal = true
UniformNotifier::AppsignalNotifier.out_of_channel_notify('notify appsignal')
end
it 'should notify appsignal with tags' do
transaction = double('Appsignal::Transaction', set_namespace: nil)
expect(transaction).to receive(:set_tags).with({ foo: :bar })
expect(Appsignal).to receive(:send_error).with(
UniformNotifier::Exception.new("notify appsignal\n")
).and_yield(transaction)
UniformNotifier.appsignal = true
UniformNotifier::AppsignalNotifier.out_of_channel_notify(title: 'notify appsignal', tags: { foo: :bar })
end
it 'should notify appsignal with default namespace' do
transaction = double('Appsignal::Transaction', set_tags: nil)
expect(transaction).to receive(:set_namespace).with('web')
expect(Appsignal).to receive(:send_error).with(
UniformNotifier::Exception.new("notify appsignal\n")
).and_yield(transaction)
UniformNotifier.appsignal = { namespace: 'web' }
UniformNotifier::AppsignalNotifier.out_of_channel_notify('notify appsignal')
end
it 'should notify appsignal with overridden namespace' do
transaction = double('Appsignal::Transaction')
expect(transaction).to receive(:set_tags).with({ foo: :bar })
expect(transaction).to receive(:set_namespace).with('background')
expect(Appsignal).to receive(:send_error).with(
UniformNotifier::Exception.new("notify appsignal\nbody")
).and_yield(transaction)
UniformNotifier.appsignal = { namespace: 'web' }
UniformNotifier::AppsignalNotifier.out_of_channel_notify(
title: 'notify appsignal',
tags: {
foo: :bar
},
namespace: 'background',
body: 'body',
)
end
it 'should notify appsignal with merged tags' do
transaction = double('Appsignal::Transaction')
expect(transaction).to receive(:set_tags).with({ user: 'Bob', hostname: 'frontend2', site: 'first' })
expect(transaction).to receive(:set_namespace).with('background')
expect(Appsignal).to receive(:send_error).with(
UniformNotifier::Exception.new("notify appsignal\nbody")
).and_yield(transaction)
UniformNotifier.appsignal = { namespace: 'web', tags: { hostname: 'frontend1', user: 'Bob' } }
UniformNotifier::AppsignalNotifier.out_of_channel_notify(
title: 'notify appsignal',
tags: {
hostname: 'frontend2',
site: 'first'
},
body: 'body',
namespace: 'background'
)
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/slack_spec.rb 0000644 0000041 0000041 00000004015 14235144655 024162 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Slack do
context 'not enabled' do
it 'should not notify slack' do
expect_any_instance_of(Slack::Notifier).to_not receive(:ping)
expect(UniformNotifier::Slack.out_of_channel_notify(title: 'notify slack')).to be_nil
end
end
context 'configuration' do
context 'no webhook_url is given' do
it 'should raise an error' do
expect { UniformNotifier.slack = {} }.to raise_error(UniformNotifier::NotificationError)
end
it 'should not notify slack' do
begin
UniformNotifier.slack = {}
rescue UniformNotifier::NotificationError
ensure
expect_any_instance_of(Slack::Notifier).to_not receive(:ping)
expect(UniformNotifier::Slack.out_of_channel_notify(title: 'notify slack')).to be_nil
end
end
end
it 'should remove invalid options' do
expect(Slack::Notifier).to receive(:new).with('http://some.slack.url', {}).and_return(true)
UniformNotifier.slack = { webhook_url: 'http://some.slack.url', pizza: 'pepperoni' }
expect(UniformNotifier::Slack.active?).to eq true
end
it 'should allow username and channel config options' do
expect(Slack::Notifier).to receive(:new)
.with('http://some.slack.url', { username: 'The Dude', channel: '#carpets' })
.and_return(true)
UniformNotifier.slack = { webhook_url: 'http://some.slack.url', username: 'The Dude', channel: '#carpets' }
expect(UniformNotifier::Slack.active?).to eq true
end
end
context 'properly configured' do
before(:example) do
@message = 'notify slack'
allow_any_instance_of(Slack::Notifier).to receive(:ping).and_return(@message)
end
it 'should notify slack' do
UniformNotifier.slack = { webhook_url: 'http://some.slack.url' }
expect_any_instance_of(Slack::Notifier).to receive(:ping)
expect(UniformNotifier::Slack.out_of_channel_notify(title: @message)).to eq @message
end
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/javascript_console_spec.rb 0000644 0000041 0000041 00000004336 14235144655 026763 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::JavascriptConsole do
it 'should not notify message' do
expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to be_nil
end
it 'should notify message' do
UniformNotifier.console = true
expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to eq <<~CODE
CODE
end
it 'should accept custom attributes' do
UniformNotifier.console = { attributes: { :nonce => 'my-nonce', 'data-key' => :value } }
expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to eq <<~CODE
CODE
end
it 'should have default attributes if no attributes settings exist' do
UniformNotifier.console = {}
expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to eq <<~CODE
CODE
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/javascript_alert_spec.rb 0000644 0000041 0000041 00000002361 14235144655 026424 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::JavascriptAlert do
it 'should not notify message' do
expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to be_nil
end
it 'should notify message' do
UniformNotifier.alert = true
expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to eq <<~CODE
CODE
end
it 'should accept custom attributes' do
UniformNotifier.alert = { attributes: { :nonce => 'my-nonce', 'data-key' => :value } }
expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to eq <<~CODE
CODE
end
it 'should have default attributes if no attributes settings exist' do
UniformNotifier.alert = {}
expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to eq <<~CODE
CODE
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/raise_spec.rb 0000644 0000041 0000041 00000001707 14235144655 024175 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Raise do
it 'should not notify message' do
expect(UniformNotifier::Raise.out_of_channel_notify(title: 'notification')).to be_nil
end
it 'should raise error of the default class' do
UniformNotifier.raise = true
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }.to raise_error(
UniformNotifier::Exception,
'notification'
)
end
it 'allows the user to override the default exception class' do
klass = Class.new(RuntimeError)
UniformNotifier.raise = klass
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }.to raise_error(klass, 'notification')
end
it 'can be turned from on to off again' do
UniformNotifier.raise = true
UniformNotifier.raise = false
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }.not_to raise_error
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/sentry_spec.rb 0000644 0000041 0000041 00000001456 14235144655 024417 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
class Sentry
# mock Sentry
end
RSpec.describe UniformNotifier::SentryNotifier do
it 'should not notify sentry' do
expect(UniformNotifier::SentryNotifier.out_of_channel_notify(title: 'notify sentry')).to be_nil
end
it 'should notify sentry' do
expect(Sentry).to receive(:capture_exception).with(UniformNotifier::Exception.new('notify sentry'))
UniformNotifier.sentry = true
UniformNotifier::SentryNotifier.out_of_channel_notify(title: 'notify sentry')
end
it 'should notify sentry' do
expect(Sentry).to receive(:capture_exception).with(UniformNotifier::Exception.new('notify sentry'), foo: :bar)
UniformNotifier.sentry = { foo: :bar }
UniformNotifier::SentryNotifier.out_of_channel_notify('notify sentry')
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/honeybadger_spec.rb 0000644 0000041 0000041 00000001572 14235144655 025361 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
class Honeybadger
# mock Honeybadger
end
RSpec.describe UniformNotifier::HoneybadgerNotifier do
it 'should not notify honeybadger' do
expect(UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(title: 'notify honeybadger')).to be_nil
end
it 'should notify honeybadger' do
expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), {})
UniformNotifier.honeybadger = true
UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(title: 'notify honeybadger')
end
it 'should notify honeybadger' do
expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), { foo: :bar })
UniformNotifier.honeybadger = { foo: :bar }
UniformNotifier::HoneybadgerNotifier.out_of_channel_notify('notify honeybadger')
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/rollbar_spec.rb 0000644 0000041 0000041 00000001472 14235144655 024526 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
class Rollbar
# mock Rollbar
end
RSpec.describe UniformNotifier::RollbarNotifier do
it 'should not notify rollbar' do
expect(UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')).to be_nil
end
it 'should notify rollbar' do
expect(Rollbar).to receive(:log).with('info', UniformNotifier::Exception.new('notify rollbar'))
UniformNotifier.rollbar = true
UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')
end
it 'should notify rollbar' do
expect(Rollbar).to receive(:log).with('warning', UniformNotifier::Exception.new('notify rollbar'))
UniformNotifier.rollbar = { level: 'warning' }
UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/terminal_notifier_spec.rb 0000644 0000041 0000041 00000001713 14235144655 026601 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::TerminalNotifier do
it 'should not notify terminal-notifier when disabled' do
expect(UniformNotifier::TerminalNotifier.out_of_channel_notify(title: 'notify terminal')).to be_nil
end
it "should raise an exception when terminal-notifier gem isn't available" do
UniformNotifier.terminal_notifier = true
expect {
UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal')
}.to raise_error(UniformNotifier::NotificationError, /terminal-notifier gem/)
end
it 'should notify terminal-notifier when enabled' do
module TerminalNotifier
# mock TerminalNotifier
end
expect(TerminalNotifier).to receive(:notify).with('body', title: 'notify terminal')
UniformNotifier.terminal_notifier = true
UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal')
end
end
uniform_notifier-1.16.0/spec/uniform_notifier/xmpp_spec.rb 0000644 0000041 0000041 00000004540 14235144655 024054 0 ustar www-data www-data # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Xmpp do
it 'should not notify xmpp' do
expect(UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')).to be_nil
end
it 'should notify xmpp without online status' do
jid = double('jid')
xmpp = double('xmpp')
expect(Jabber::JID).to receive(:new).with('from@gmail.com').and_return(jid)
expect(Jabber::Client).to receive(:new).with(jid).and_return(xmpp)
expect(xmpp).to receive(:connect)
expect(xmpp).to receive(:auth).with('123456')
message = double('message')
expect(Jabber::Message).to receive(:new).with('to@gmail.com', 'notify xmpp').and_return(message)
expect(message).to receive(:set_type).with(:normal).and_return(message)
expect(message).to receive(:set_subject).with('Uniform Notifier').and_return(message)
expect(xmpp).to receive(:send).with(message)
UniformNotifier.xmpp = {
account: 'from@gmail.com',
password: '123456',
receiver: 'to@gmail.com',
show_online_status: false
}
UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')
end
it 'should notify xmpp with online status' do
jid = double('jid')
xmpp = double('xmpp')
expect(Jabber::JID).to receive(:new).with('from@gmail.com').and_return(jid)
expect(Jabber::Client).to receive(:new).with(jid).and_return(xmpp)
expect(xmpp).to receive(:connect)
expect(xmpp).to receive(:auth).with('123456')
presence = double('presence')
now = Time.now
allow(Time).to receive(:now).and_return(now)
expect(Jabber::Presence).to receive(:new).and_return(presence)
expect(presence).to receive(:set_status).with("Uniform Notifier started on #{now}").and_return(presence)
expect(xmpp).to receive(:send).with(presence)
message = double('message')
expect(Jabber::Message).to receive(:new).with('to@gmail.com', 'notify xmpp').and_return(message)
expect(message).to receive(:set_type).with(:normal).and_return(message)
expect(message).to receive(:set_subject).with('Uniform Notifier').and_return(message)
expect(xmpp).to receive(:send).with(message)
UniformNotifier.xmpp = {
account: 'from@gmail.com',
password: '123456',
receiver: 'to@gmail.com',
show_online_status: true
}
UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')
end
end
uniform_notifier-1.16.0/CHANGELOG.md 0000644 0000041 0000041 00000003024 14235144655 017026 0 ustar www-data www-data # Next Release
# 1.16.0 (03/24/2022)
* Drop Growl support
* Move CI from travis to github actions
# 1.15.0 (03/21/2022)
* Fix bugsnag notifications
* Improve appsignal message
# 1.14.2 (03/24/2021)
* Fix `capture_exception` signature
# 1.14.1 (02/28/2021)
* Fix uninitialized constant ``UniformNotifier::SentryNotifier::Raven`` error
# 1.14.0 (02/26/2021)
* Add AppSignal integration
* Fix `UniformNotifier::Raise.active?` when `.rails=` receives a false value
## 1.13.0 (10/05/2019)
* Add Honeybadger class dependecy injection.
* Allow configuration of Rollbar level.
## 1.12.1 (10/30/2018)
* Require Ruby 2.3+
## 1.12.0 (08/17/2018)
* Add [terminal-notifier](https://github.com/julienXX/terminal-notifier) support
* Lots of refactors from Awesome Code
## 1.11.0 (11/13/2017)
* Add Sentry notifier
## 1.10.0 (01/06/2016)
* Add honeybadger notifier
* Eliminate ruby warnings
## 1.9.0 (04/19/2015)
* Add `UniformNotifier::AVAILABLE_NOTIFIERS` constant
## 1.8.0 (03/17/2015)
* Add rollbar notifier
## 1.7.0 (02/08/2015)
* Add slack notifier
## 1.6.0 (04/30/2014)
* Support detail notify data
* Add options for airbrake and bugsnag notifiers
## 1.5.0 (04/26/2014)
* Add bugsnag notifier
* Use custom excaption
## 1.4.0 (11/03/2013)
* Raise should implement `out_of_channel_notify` instead of `inline_notify`
## 1.3.0 (08/28/2012)
* Add raise notifier
## 1.2.0 (03/03/2013)
* Compatible with ruby-growl 4.0 gem
## 1.1.0 (09/28/2012)
* Add growl gntp support
* Add airbrake notifier
## 1.0.0 (11/19/2010)
* First release
uniform_notifier-1.16.0/.gitignore 0000644 0000041 0000041 00000000055 14235144655 017206 0 ustar www-data www-data pkg/*
*.gem
.bundle
.rvmrc
bin/
Gemfile.lock
uniform_notifier-1.16.0/uniform_notifier.gemspec 0000644 0000041 0000041 00000002613 14235144655 022143 0 ustar www-data www-data # frozen_string_literal: true
$LOAD_PATH.push File.expand_path('lib', __dir__)
require 'uniform_notifier/version'
Gem::Specification.new do |s|
s.name = 'uniform_notifier'
s.version = UniformNotifier::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Richard Huang']
s.email = ['flyerhzm@gmail.com']
s.homepage = 'http://rubygems.org/gems/uniform_notifier'
s.summary = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console and xmpp'
s.description = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console and xmpp'
s.license = 'MIT'
s.required_ruby_version = '>= 2.3'
s.add_development_dependency 'rspec', ['> 0']
s.add_development_dependency 'slack-notifier', ['>= 1.0']
s.add_development_dependency 'xmpp4r', ['= 0.5']
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ['lib']
if s.respond_to?(:metadata)
s.metadata['changelog_uri'] = 'https://github.com/flyerhzm/uniform_notifier/blob/master/CHANGELOG.md'
s.metadata['source_code_uri'] = 'https://github.com/flyerhzm/uniform_notifier'
s.metadata['bug_tracker_uri'] = 'https://github.com/flyerhzm/uniform_notifier/issues'
end
end
uniform_notifier-1.16.0/LICENSE 0000644 0000041 0000041 00000002066 14235144655 016227 0 ustar www-data www-data Copyright (c) 2010 Richard Huang (flyerhzm@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
uniform_notifier-1.16.0/Rakefile 0000644 0000041 0000041 00000001137 14235144655 016665 0 ustar www-data www-data # frozen_string_literal: true
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake'
require 'rdoc/task'
require 'rspec'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
end
RSpec::Core::RakeTask.new('spec:progress') do |spec|
spec.rspec_opts = %w[--format progress]
spec.pattern = 'spec/**/*_spec.rb'
end
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "uniform_notifier #{UniformNotifier::VERSION}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
task default: :spec
uniform_notifier-1.16.0/lib/ 0000755 0000041 0000041 00000000000 14235144655 015764 5 ustar www-data www-data uniform_notifier-1.16.0/lib/uniform_notifier.rb 0000644 0000041 0000041 00000003420 14235144655 021666 0 ustar www-data www-data # frozen_string_literal: true
require 'uniform_notifier/base'
require 'uniform_notifier/errors'
require 'uniform_notifier/javascript_alert'
require 'uniform_notifier/javascript_console'
require 'uniform_notifier/honeybadger'
require 'uniform_notifier/xmpp'
require 'uniform_notifier/rails_logger'
require 'uniform_notifier/customized_logger'
require 'uniform_notifier/airbrake'
require 'uniform_notifier/sentry'
require 'uniform_notifier/rollbar'
require 'uniform_notifier/bugsnag'
require 'uniform_notifier/appsignal'
require 'uniform_notifier/slack'
require 'uniform_notifier/raise'
require 'uniform_notifier/terminal_notifier'
class UniformNotifier
AVAILABLE_NOTIFIERS = %i[
alert
console
honeybadger
xmpp
rails_logger
customized_logger
airbrake
rollbar
bugsnag
slack
raise
sentry
appsignal
terminal_notifier
].freeze
NOTIFIERS = [
JavascriptAlert,
JavascriptConsole,
HoneybadgerNotifier,
Xmpp,
RailsLogger,
CustomizedLogger,
AirbrakeNotifier,
RollbarNotifier,
BugsnagNotifier,
Raise,
Slack,
SentryNotifier,
AppsignalNotifier,
TerminalNotifier
].freeze
class NotificationError < StandardError
end
class << self
attr_accessor(*AVAILABLE_NOTIFIERS)
def active_notifiers
NOTIFIERS.select(&:active?)
end
undef xmpp=
def xmpp=(xmpp)
UniformNotifier::Xmpp.setup_connection(xmpp)
end
undef customized_logger=
def customized_logger=(logdev)
UniformNotifier::CustomizedLogger.setup(logdev)
end
undef slack=
def slack=(slack)
UniformNotifier::Slack.setup_connection(slack)
end
undef raise=
def raise=(exception_class)
UniformNotifier::Raise.setup_connection(exception_class)
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/ 0000755 0000041 0000041 00000000000 14235144655 021342 5 ustar www-data www-data uniform_notifier-1.16.0/lib/uniform_notifier/version.rb 0000644 0000041 0000041 00000000116 14235144655 023352 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
VERSION = '1.16.0'
end
uniform_notifier-1.16.0/lib/uniform_notifier/honeybadger.rb 0000644 0000041 0000041 00000001071 14235144655 024155 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class HoneybadgerNotifier < Base
class << self
def active?
!!UniformNotifier.honeybadger
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
opt = {}
opt = UniformNotifier.honeybadger if UniformNotifier.honeybadger.is_a?(Hash)
exception = Exception.new(message)
honeybadger_class = opt[:honeybadger_class] || Honeybadger
honeybadger_class.notify(exception, opt)
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/appsignal.rb 0000644 0000041 0000041 00000001362 14235144655 023647 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class AppsignalNotifier < Base
class << self
def active?
!!UniformNotifier.appsignal
end
protected
def _out_of_channel_notify(data)
opt = UniformNotifier.appsignal.is_a?(Hash) ? UniformNotifier.appsignal : {}
exception = Exception.new("#{data[:title]}\n#{data[:body]}")
exception.set_backtrace(data[:backtrace]) if data[:backtrace]
tags = opt.fetch(:tags, {}).merge(data.fetch(:tags, {}))
namespace = data[:namespace] || opt[:namespace]
Appsignal.send_error(exception) do |transaction|
transaction.set_tags(tags)
transaction.set_namespace(namespace)
end
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/javascript_console.rb 0000644 0000041 0000041 00000001574 14235144655 025566 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class JavascriptConsole < Base
class << self
def active?
!!UniformNotifier.console
end
protected
def _inline_notify(data)
message = data.values.compact.join("\n")
options = UniformNotifier.console.is_a?(Hash) ? UniformNotifier.console : {}
script_attributes = options[:attributes] || {}
code = <<~CODE
if (typeof(console) !== 'undefined' && console.log) {
if (console.groupCollapsed && console.groupEnd) {
console.groupCollapsed(#{'Uniform Notifier'.inspect});
console.log(#{message.inspect});
console.groupEnd();
} else {
console.log(#{message.inspect});
}
}
CODE
wrap_js_association code, script_attributes
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/xmpp.rb 0000644 0000041 0000041 00000003064 14235144655 022656 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class Xmpp < Base
class << self
@receiver = nil
@xmpp = nil
@password = nil
def active?
@xmpp
end
def setup_connection(xmpp_information)
return unless xmpp_information
require 'xmpp4r'
@xmpp = xmpp_information
@receiver = xmpp_information[:receiver]
@password = xmpp_information[:password]
@account = xmpp_information[:account]
@show_online_status = xmpp_information[:show_online_status]
@stay_connected = xmpp_information[:stay_connected].nil? ? true : xmpp_information[:stay_connected]
connect if @stay_connected
rescue LoadError
@xmpp = nil
raise NotificationError, 'You must install the xmpp4r gem to use XMPP notification: `gem install xmpp4r`'
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
notify(message)
end
private
def connect
jid = Jabber::JID.new(@account)
@xmpp = Jabber::Client.new(jid)
@xmpp.connect
@xmpp.auth(@password)
@xmpp.send(presence_status) if @show_online_status
end
def notify(message)
connect unless @stay_connected
message = Jabber::Message.new(@receiver, message).set_type(:normal).set_subject('Uniform Notifier')
@xmpp.send(message)
end
def presence_status
Jabber::Presence.new.set_status("Uniform Notifier started on #{Time.now}")
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/bugsnag.rb 0000644 0000041 0000041 00000001311 14235144655 023311 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class BugsnagNotifier < Base
class << self
def active?
!!UniformNotifier.bugsnag
end
protected
def _out_of_channel_notify(data)
exception = Exception.new(data[:title])
exception.set_backtrace(data[:backtrace]) if data[:backtrace]
return nil if data.empty?
Bugsnag.notify(exception) do |report|
report.severity = "warning"
report.add_tab(:bullet, data)
report.grouping_hash = data[:body] || data[:title]
if UniformNotifier.bugsnag.is_a?(Proc)
UniformNotifier.bugsnag.call(report)
end
end
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/customized_logger.rb 0000644 0000041 0000041 00000001074 14235144655 025416 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class CustomizedLogger < Base
class << self
@logger = nil
def active?
@logger
end
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
@logger.warn message
end
def setup(logdev)
require 'logger'
@logger = Logger.new(logdev)
def @logger.format_message(severity, timestamp, _progname, msg)
"#{timestamp.strftime('%Y-%m-%d %H:%M:%S')}[#{severity}] #{msg}"
end
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/errors.rb 0000644 0000041 0000041 00000000140 14235144655 023176 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class Exception < RuntimeError
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/base.rb 0000644 0000041 0000041 00000001773 14235144655 022611 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class Base
class << self
def active?
false
end
def inline_notify(data)
return unless active?
# For compatibility to the old protocol
data = { title: data } if data.is_a?(String)
_inline_notify(data)
end
def out_of_channel_notify(data)
return unless active?
# For compatibility to the old protocol
data = { title: data } if data.is_a?(String)
_out_of_channel_notify(data)
end
protected
def _inline_notify(data); end
def _out_of_channel_notify(data); end
def wrap_js_association(code, attributes = {})
attributes = { type: 'text/javascript' }.merge(attributes || {})
attributes_string = attributes.map { |k, v| "#{k}=#{v.to_s.inspect}" }.join(' ')
<<~CODE
CODE
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/javascript_alert.rb 0000644 0000041 0000041 00000000767 14235144655 025236 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class JavascriptAlert < Base
class << self
def active?
!!UniformNotifier.alert
end
protected
def _inline_notify(data)
message = data.values.compact.join("\n")
options = UniformNotifier.alert.is_a?(Hash) ? UniformNotifier.alert : {}
script_attributes = options[:attributes] || {}
wrap_js_association "alert( #{message.inspect} );", script_attributes
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/rails_logger.rb 0000644 0000041 0000041 00000000514 14235144655 024340 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class RailsLogger < Base
class << self
def active?
UniformNotifier.rails_logger
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
Rails.logger.warn message
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/sentry.rb 0000644 0000041 0000041 00000000744 14235144655 023220 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class SentryNotifier < Base
class << self
def active?
!!UniformNotifier.sentry
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
opt = {}
opt = UniformNotifier.sentry if UniformNotifier.sentry.is_a?(Hash)
exception = Exception.new(message)
Sentry.capture_exception(exception, **opt)
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/raise.rb 0000644 0000041 0000041 00000000755 14235144655 023001 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class Raise < Base
class << self
def active?
defined?(@exception_class) ? @exception_class : false
end
def setup_connection(exception_class)
@exception_class = exception_class == true ? Exception : exception_class
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
raise @exception_class, message
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/slack.rb 0000644 0000041 0000041 00000002215 14235144655 022764 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class Slack < Base
POSSIBLE_OPTIONS = %i[username channel].freeze
class << self
@slack = nil
def active?
@slack
end
def setup_connection(config = {})
webhook_url, options = parse_config(config)
fail_connection('webhook_url required for Slack notification') unless webhook_url
require 'slack-notifier'
@slack = ::Slack::Notifier.new webhook_url, options
rescue LoadError
fail_connection 'You must install the slack-notifier gem to use Slack notification: `gem install slack-notifier`'
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
notify(message)
end
private
def fail_connection(message)
@slack = nil
raise NotificationError, message
end
def notify(message)
@slack.ping message
end
def parse_config(config)
options = config.select { |name, value| POSSIBLE_OPTIONS.include?(name) && !value.nil? }
[config[:webhook_url], options]
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/terminal_notifier.rb 0000644 0000041 0000041 00000001200 14235144655 025372 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class TerminalNotifier < Base
class << self
def active?
!!UniformNotifier.terminal_notifier
end
protected
def _out_of_channel_notify(data)
unless defined?(::TerminalNotifier)
begin
require 'terminal-notifier'
rescue LoadError
raise NotificationError,
'You must install the terminal-notifier gem to use terminal_notifier: `gem install terminal-notifier`'
end
end
::TerminalNotifier.notify(data[:body], title: data[:title])
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/airbrake.rb 0000644 0000041 0000041 00000000741 14235144655 023451 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class AirbrakeNotifier < Base
class << self
def active?
!!UniformNotifier.airbrake
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
opt = {}
opt = UniformNotifier.airbrake if UniformNotifier.airbrake.is_a?(Hash)
exception = Exception.new(message)
Airbrake.notify(exception, opt)
end
end
end
end
uniform_notifier-1.16.0/lib/uniform_notifier/rollbar.rb 0000644 0000041 0000041 00000001045 14235144655 023324 0 ustar www-data www-data # frozen_string_literal: true
class UniformNotifier
class RollbarNotifier < Base
DEFAULT_LEVEL = 'info'
class << self
def active?
!!UniformNotifier.rollbar
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
exception = Exception.new(message)
level = UniformNotifier.rollbar.fetch(:level, DEFAULT_LEVEL) if UniformNotifier.rollbar.is_a?(Hash)
level ||= DEFAULT_LEVEL
Rollbar.log(level, exception)
end
end
end
end
uniform_notifier-1.16.0/Gemfile 0000644 0000041 0000041 00000000254 14235144655 016512 0 ustar www-data www-data # frozen_string_literal: true
source 'https://rubygems.org'
# Specify your gem's dependencies in uniform_notifier.gemspec
gemspec
gem 'rake'
gem 'rexml' # for Ruby 3.0+
uniform_notifier-1.16.0/.github/ 0000755 0000041 0000041 00000000000 14235144655 016556 5 ustar www-data www-data uniform_notifier-1.16.0/.github/workflows/ 0000755 0000041 0000041 00000000000 14235144655 020613 5 ustar www-data www-data uniform_notifier-1.16.0/.github/workflows/ci.yml 0000644 0000041 0000041 00000000724 14235144655 021734 0 ustar www-data www-data name: CI
on:
- push
- pull_request
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- 2.7
- 3.0
- 3.1
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake