Module: ChatNotifier
- Defined in:
- lib/chat_notifier.rb,
lib/chat_notifier/app.rb,
lib/chat_notifier/chatter.rb,
lib/chat_notifier/version.rb,
lib/chat_notifier/messenger.rb,
lib/chat_notifier/repository.rb,
lib/chat_notifier/thread_store.rb,
lib/chat_notifier/chatter/debug.rb,
lib/chat_notifier/chatter/slack.rb,
lib/chat_notifier/failure_groups.rb,
lib/chat_notifier/rspec_formatter.rb,
lib/chat_notifier/repository/debug.rb,
lib/chat_notifier/test_environment.rb,
lib/chat_notifier/repository/github.rb,
lib/chat_notifier/test_environment/debug.rb,
lib/chat_notifier/test_environment/github.rb,
lib/chat_notifier/thread_store/slack_metadata.rb
Defined Under Namespace
Classes: App, Chatter, DebugExceptionLocation, DebugSummary, FailureGroups, Messenger, Repository, RspecFormatter, TestEnvironment, ThreadStore
Constant Summary collapse
- STANDARDS =
{ repository: Repository, environment: TestEnvironment, chatter: Chatter, messenger: Messenger }
- VERSION =
"0.4.0"
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
- .app(env: ENV, name: env.fetch("NOTIFY_APP_NAME")) ⇒ Object
- .call(summary:, **kwargs) ⇒ Object
-
.debug!(env, summary:, notifier: :Debug, **kwargs) ⇒ Object
In order to test this locally see
rake chat_notifier:debug.
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
19 20 21 |
# File 'lib/chat_notifier.rb', line 19 def logger @logger end |
Class Method Details
.app(env: ENV, name: env.fetch("NOTIFY_APP_NAME")) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/chat_notifier.rb', line 21 def app(env: ENV, name: env.fetch("NOTIFY_APP_NAME")) name ||= if defined?(::Rails) && Rails.respond_to?(:application) Rails.application.class.module_parent else raise "No app name provided and Rails is not defined" end end |
.call(summary:, **kwargs) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/chat_notifier.rb', line 56 def call(summary:, **kwargs) repository = (kwargs[:repository] || STANDARDS[:repository]).for(ENV) environment = (kwargs[:environment] || STANDARDS[:environment]).for(ENV) chatter = (kwargs[:chatter] || STANDARDS[:chatter]).handling( ENV, repository:, environment: ) if (store = kwargs[:thread_store]) chatter.each { |box| box.thread_store = store } end messenger = (kwargs[:messenger] || STANDARDS[:messenger]).for( summary, app: App.new(name: app, settings: ENV), repository:, environment: ) chatter.each do |box| box.conditional_post(messenger) rescue => exception logger.error("ChatNotifier: #{box.class} #{exception.class}: #{exception.}") end end |
.debug!(env, summary:, notifier: :Debug, **kwargs) ⇒ Object
In order to test this locally see rake chat_notifier:debug
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/chat_notifier.rb', line 37 def debug!(env, summary:, notifier: :Debug, **kwargs) repository = (kwargs[:repository] || STANDARDS[:repository]).for(env) environment = (kwargs[:environment] || STANDARDS[:environment]).for(env) chatter = (kwargs[:chatter] || STANDARDS[:chatter]).const_get(notifier).new( settings: env, repository: repository, environment: environment ) messenger = (kwargs[:messenger] || STANDARDS[:messenger]).for( summary, app: App.new(name: app(env:), settings: env), repository:, environment: ) chatter.post(messenger) end |