From dcfb4809ba818a2f13198c1ea9bd6897aa4846e2 Mon Sep 17 00:00:00 2001
From: Andrey Novikov <envek@envek.name>
Date: Tue, 4 Aug 2020 19:19:48 +0300
Subject: [PATCH] 0.6.2: Fix compatibility with yabeda-puma-plugin

---
 CHANGELOG.md                    | 6 ++++++
 lib/yabeda/dsl/class_methods.rb | 1 +
 lib/yabeda/version.rb           | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff75883..85ae83b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
 
+## 0.6.2 - 2020-08-04
+
+### Fixed
+
+ - Compatibility with plugins (like [yabeda-puma-plugin](https://github.com/yabeda-rb/yabeda-puma-plugin)) that for some reason configures itself after Yabeda configuration was already applied by `Yabeda.configure!` (was broken in 0.6.0). [@Envek]
+
 ## 0.6.1 - 2020-07-16
 
 ### Fixed
diff --git a/lib/yabeda/dsl/class_methods.rb b/lib/yabeda/dsl/class_methods.rb
index eb9e765..d304548 100644
--- a/lib/yabeda/dsl/class_methods.rb
+++ b/lib/yabeda/dsl/class_methods.rb
@@ -85,6 +85,7 @@ def register_metric(metric)
         ::Yabeda.define_singleton_method(name) { metric }
         ::Yabeda.metrics[name] = metric
         register_group_for(metric) if metric.group
+        ::Yabeda.adapters.each_value { |adapter| adapter.register!(metric) } if ::Yabeda.configured?
         metric
       end
 
diff --git a/lib/yabeda/version.rb b/lib/yabeda/version.rb
index 72d8492..c313a66 100644
--- a/lib/yabeda/version.rb
+++ b/lib/yabeda/version.rb
@@ -1,5 +1,5 @@
 # frozen_string_literal: true
 
 module Yabeda
-  VERSION = "0.6.1"
+  VERSION = "0.6.2"
 end