From c210326f1bc0d0170d6ab7f2fdf28f3be90164fe Mon Sep 17 00:00:00 2001 From: Jeremy Jackson Date: Mon, 13 Mar 2023 20:16:30 -0600 Subject: [PATCH 1/5] Rails 6 --- Gemfile | 2 +- Gemfile.lock | 151 +++++++++++++++++++-------------------- activeexperiment.gemspec | 2 +- 3 files changed, 74 insertions(+), 81 deletions(-) diff --git a/Gemfile b/Gemfile index d398f4a..10d8403 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } gemspec -gem "rails" +gem "rails", "~> 6.0.0" gem "puma" gem "minitest" diff --git a/Gemfile.lock b/Gemfile.lock index a460be8..f4c36ca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,77 +2,67 @@ PATH remote: . specs: activeexperiment (0.1.1.alpha) - activesupport (>= 7.0.4) + activesupport (>= 6.0.0) globalid (>= 0.3.6) GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + actioncable (6.0.6.1) + actionpack (= 6.0.6.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actionmailbox (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.4) - actionpack (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activesupport (= 7.0.4) + actionmailer (6.0.6.1) + actionpack (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4) - actionview (= 7.0.4) - activesupport (= 7.0.4) - rack (~> 2.0, >= 2.2.0) + actionpack (6.0.6.1) + actionview (= 6.0.6.1) + activesupport (= 6.0.6.1) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4) - actionpack (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) - globalid (>= 0.6.0) + actiontext (6.0.6.1) + actionpack (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) nokogiri (>= 1.8.5) - actionview (7.0.4) - activesupport (= 7.0.4) + actionview (6.0.6.1) + activesupport (= 6.0.6.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4) - activesupport (= 7.0.4) + activejob (6.0.6.1) + activesupport (= 6.0.6.1) globalid (>= 0.3.6) - activemodel (7.0.4) - activesupport (= 7.0.4) - activerecord (7.0.4) - activemodel (= 7.0.4) - activesupport (= 7.0.4) - activestorage (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activesupport (= 7.0.4) + activemodel (6.0.6.1) + activesupport (= 6.0.6.1) + activerecord (6.0.6.1) + activemodel (= 6.0.6.1) + activesupport (= 6.0.6.1) + activestorage (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.4) + activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) ast (2.4.2) bootsnap (1.15.0) msgpack (~> 1.2) @@ -80,9 +70,10 @@ GEM concurrent-ruby (1.1.10) connection_pool (2.3.0) crass (1.0.6) + date (3.3.3) docile (1.4.0) erubi (1.11.0) - globalid (1.0.0) + globalid (1.1.0) activesupport (>= 5.0) i18n (1.12.0) concurrent-ruby (~> 1.0) @@ -90,7 +81,7 @@ GEM loofah (2.19.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.8.0) + mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop @@ -100,7 +91,8 @@ GEM mini_mime (1.1.2) minitest (5.16.3) msgpack (1.6.0) - net-imap (0.3.1) + net-imap (0.3.4) + date net-protocol net-pop (0.1.2) net-protocol @@ -124,32 +116,32 @@ GEM rack (2.2.4) rack-test (2.0.2) rack (>= 1.3) - rails (7.0.4) - actioncable (= 7.0.4) - actionmailbox (= 7.0.4) - actionmailer (= 7.0.4) - actionpack (= 7.0.4) - actiontext (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activemodel (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) - bundler (>= 1.15.0) - railties (= 7.0.4) + rails (6.0.6.1) + actioncable (= 6.0.6.1) + actionmailbox (= 6.0.6.1) + actionmailer (= 6.0.6.1) + actionpack (= 6.0.6.1) + actiontext (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + activemodel (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) + bundler (>= 1.3.0) + railties (= 6.0.6.1) + sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.3) loofah (~> 2.3) - railties (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + railties (6.0.6.1) + actionpack (= 6.0.6.1) + activesupport (= 6.0.6.1) method_source - rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) rainbow (3.1.1) rake (13.0.6) rdoc (6.4.0) @@ -179,7 +171,7 @@ GEM rubocop-performance (1.15.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.17.3) + rubocop-rails (2.18.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -201,14 +193,15 @@ GEM sqlite3 (1.5.4-x86_64-darwin) stringio (3.0.2) thor (1.2.1) - timeout (0.3.1) - tzinfo (2.0.5) - concurrent-ruby (~> 1.0) + thread_safe (0.3.6) + timeout (0.3.2) + tzinfo (1.2.11) + thread_safe (~> 0.1) unicode-display_width (2.3.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.6) + zeitwerk (2.6.7) PLATFORMS arm64-darwin-22 @@ -219,7 +212,7 @@ DEPENDENCIES bootsnap minitest puma - rails + rails (~> 6.0.0) rdoc redis rubocop (>= 1.25.1) diff --git a/activeexperiment.gemspec b/activeexperiment.gemspec index 4005ee3..2942e4a 100644 --- a/activeexperiment.gemspec +++ b/activeexperiment.gemspec @@ -34,6 +34,6 @@ Gem::Specification.new do |s| "rubygems_mfa_required" => "true", } - s.add_dependency "activesupport", ">= 7.0.4" # TODO: use `version` here + s.add_dependency "activesupport", ">= 6.0.0" # TODO: use `version` here s.add_dependency "globalid", ">= 0.3.6" end From 14951a6746b52b086bb351e370563a47f8806b0e Mon Sep 17 00:00:00 2001 From: Jeremy Jackson Date: Mon, 13 Mar 2023 20:24:26 -0600 Subject: [PATCH 2/5] Rails 5, Ruby 2.5 --- Gemfile | 2 +- Gemfile.lock | 104 +++++++++++++++++---------------------- activeexperiment.gemspec | 4 +- 3 files changed, 47 insertions(+), 63 deletions(-) diff --git a/Gemfile b/Gemfile index 10d8403..d398f4a 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } gemspec -gem "rails", "~> 6.0.0" +gem "rails" gem "puma" gem "minitest" diff --git a/Gemfile.lock b/Gemfile.lock index f4c36ca..9db077a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,67 +2,54 @@ PATH remote: . specs: activeexperiment (0.1.1.alpha) - activesupport (>= 6.0.0) + activesupport (>= 5.0.0) globalid (>= 0.3.6) GEM remote: https://rubygems.org/ specs: - actioncable (6.0.6.1) - actionpack (= 6.0.6.1) + actioncable (5.2.8.1) + actionpack (= 5.2.8.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - mail (>= 2.7.1) - actionmailer (6.0.6.1) - actionpack (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) + actionmailer (5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.6.1) - actionview (= 6.0.6.1) - activesupport (= 6.0.6.1) + actionpack (5.2.8.1) + actionview (= 5.2.8.1) + activesupport (= 5.2.8.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.6.1) - actionpack (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - nokogiri (>= 1.8.5) - actionview (6.0.6.1) - activesupport (= 6.0.6.1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.8.1) + activesupport (= 5.2.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.6.1) - activesupport (= 6.0.6.1) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.8.1) + activesupport (= 5.2.8.1) globalid (>= 0.3.6) - activemodel (6.0.6.1) - activesupport (= 6.0.6.1) - activerecord (6.0.6.1) - activemodel (= 6.0.6.1) - activesupport (= 6.0.6.1) - activestorage (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) - marcel (~> 1.0) - activesupport (6.0.6.1) + activemodel (5.2.8.1) + activesupport (= 5.2.8.1) + activerecord (5.2.8.1) + activemodel (= 5.2.8.1) + activesupport (= 5.2.8.1) + arel (>= 9.0) + activestorage (5.2.8.1) + actionpack (= 5.2.8.1) + activerecord (= 5.2.8.1) + marcel (~> 1.0.0) + activesupport (5.2.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + arel (9.0.0) ast (2.4.2) bootsnap (1.15.0) msgpack (~> 1.2) @@ -116,32 +103,30 @@ GEM rack (2.2.4) rack-test (2.0.2) rack (>= 1.3) - rails (6.0.6.1) - actioncable (= 6.0.6.1) - actionmailbox (= 6.0.6.1) - actionmailer (= 6.0.6.1) - actionpack (= 6.0.6.1) - actiontext (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) - activemodel (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) + rails (5.2.8.1) + actioncable (= 5.2.8.1) + actionmailer (= 5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + activemodel (= 5.2.8.1) + activerecord (= 5.2.8.1) + activestorage (= 5.2.8.1) + activesupport (= 5.2.8.1) bundler (>= 1.3.0) - railties (= 6.0.6.1) + railties (= 5.2.8.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.3) loofah (~> 2.3) - railties (6.0.6.1) - actionpack (= 6.0.6.1) - activesupport (= 6.0.6.1) + railties (5.2.8.1) + actionpack (= 5.2.8.1) + activesupport (= 5.2.8.1) method_source rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + thor (>= 0.19.0, < 2.0) rainbow (3.1.1) rake (13.0.6) rdoc (6.4.0) @@ -201,7 +186,6 @@ GEM websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.7) PLATFORMS arm64-darwin-22 @@ -212,7 +196,7 @@ DEPENDENCIES bootsnap minitest puma - rails (~> 6.0.0) + rails rdoc redis rubocop (>= 1.25.1) diff --git a/activeexperiment.gemspec b/activeexperiment.gemspec index 2942e4a..165caef 100644 --- a/activeexperiment.gemspec +++ b/activeexperiment.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.summary = "Experiment framework with pluggable rollouts and instrumentation." s.description = "Declare experiments using classes that can be run in different layers of an application." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 2.5.0" s.license = "MIT" @@ -34,6 +34,6 @@ Gem::Specification.new do |s| "rubygems_mfa_required" => "true", } - s.add_dependency "activesupport", ">= 6.0.0" # TODO: use `version` here + s.add_dependency "activesupport", ">= 5.0.0" # TODO: use `version` here s.add_dependency "globalid", ">= 0.3.6" end From 9887a24213cc36d3cc348a406b98fde7b9ff4570 Mon Sep 17 00:00:00 2001 From: Jeremy Jackson Date: Mon, 13 Mar 2023 20:37:44 -0600 Subject: [PATCH 3/5] Removes usage of `...` splat argument --- lib/active_experiment/core.rb | 8 ++++---- lib/active_experiment/rollouts/percent_rollout.rb | 2 +- lib/active_experiment/test_helper.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/active_experiment/core.rb b/lib/active_experiment/core.rb index 1fddab6..8e74380 100644 --- a/lib/active_experiment/core.rb +++ b/lib/active_experiment/core.rb @@ -66,12 +66,12 @@ def experiment_name end private - def control(...) - variant(:control, ...) + def control(*filters, **options, &block) + variant(:control, *filters, **options, &block) end - def variant(name, ...) - register_variant_callback(name, ...) + def variant(name, *filters, **options, &block) + register_variant_callback(name, *filters, **options, &block) end end diff --git a/lib/active_experiment/rollouts/percent_rollout.rb b/lib/active_experiment/rollouts/percent_rollout.rb index 927732b..afafaa7 100644 --- a/lib/active_experiment/rollouts/percent_rollout.rb +++ b/lib/active_experiment/rollouts/percent_rollout.rb @@ -35,7 +35,7 @@ module Rollouts # ActiveExperiment::Base.default_rollout = :percent # Rails.application.config.active_experiment.default_rollout = :percent class PercentRollout < BaseRollout - def initialize(experiment_class, ...) # :nodoc: + def initialize(experiment_class, *args, **options, &block) # :nodoc: super validate!(experiment_class) diff --git a/lib/active_experiment/test_helper.rb b/lib/active_experiment/test_helper.rb index 8701303..a433d8f 100644 --- a/lib/active_experiment/test_helper.rb +++ b/lib/active_experiment/test_helper.rb @@ -225,7 +225,7 @@ def assert_experiment_with(experiment_class, context: nil, options: nil, variant # stub out the rollout of an experiment in a test. It can also be inherited # and customized. class MockRollout < Rollouts::BaseRollout - def initialize(...) + def initialize(experiment_class, *args, **options, &block) @assigned = 0 super end From 018c4321cee52283c929934b2c8fd1b5858cdf66 Mon Sep 17 00:00:00 2001 From: Jeremy Jackson Date: Tue, 21 Mar 2023 16:07:14 -0600 Subject: [PATCH 4/5] Resolves warnings and ups to ruby >= 2.7 --- Gemfile | 2 +- Gemfile.lock | 212 ----------------------- lib/active_experiment/instrumentation.rb | 3 + 3 files changed, 4 insertions(+), 213 deletions(-) delete mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile index d398f4a..5b3dd70 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } gemspec -gem "rails" +gem "rails", "~> 5.2.5" gem "puma" gem "minitest" diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 9db077a..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,212 +0,0 @@ -PATH - remote: . - specs: - activeexperiment (0.1.1.alpha) - activesupport (>= 5.0.0) - globalid (>= 0.3.6) - -GEM - remote: https://rubygems.org/ - specs: - actioncable (5.2.8.1) - actionpack (= 5.2.8.1) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailer (5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (5.2.8.1) - actionview (= 5.2.8.1) - activesupport (= 5.2.8.1) - rack (~> 2.0, >= 2.0.8) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.8.1) - activesupport (= 5.2.8.1) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.8.1) - activesupport (= 5.2.8.1) - globalid (>= 0.3.6) - activemodel (5.2.8.1) - activesupport (= 5.2.8.1) - activerecord (5.2.8.1) - activemodel (= 5.2.8.1) - activesupport (= 5.2.8.1) - arel (>= 9.0) - activestorage (5.2.8.1) - actionpack (= 5.2.8.1) - activerecord (= 5.2.8.1) - marcel (~> 1.0.0) - activesupport (5.2.8.1) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - arel (9.0.0) - ast (2.4.2) - bootsnap (1.15.0) - msgpack (~> 1.2) - builder (3.2.4) - concurrent-ruby (1.1.10) - connection_pool (2.3.0) - crass (1.0.6) - date (3.3.3) - docile (1.4.0) - erubi (1.11.0) - globalid (1.1.0) - activesupport (>= 5.0) - i18n (1.12.0) - concurrent-ruby (~> 1.0) - json (2.6.2) - loofah (2.19.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.8.1) - mini_mime (>= 0.1.1) - net-imap - net-pop - net-smtp - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - minitest (5.16.3) - msgpack (1.6.0) - net-imap (0.3.4) - date - net-protocol - net-pop (0.1.2) - net-protocol - net-protocol (0.2.1) - timeout - net-smtp (0.3.3) - net-protocol - nio4r (2.5.8) - nokogiri (1.13.10-arm64-darwin) - racc (~> 1.4) - nokogiri (1.13.10-x86_64-darwin) - racc (~> 1.4) - parallel (1.22.1) - parser (3.1.3.0) - ast (~> 2.4.1) - psych (4.0.6) - stringio - puma (6.0.0) - nio4r (~> 2.0) - racc (1.6.1) - rack (2.2.4) - rack-test (2.0.2) - rack (>= 1.3) - rails (5.2.8.1) - actioncable (= 5.2.8.1) - actionmailer (= 5.2.8.1) - actionpack (= 5.2.8.1) - actionview (= 5.2.8.1) - activejob (= 5.2.8.1) - activemodel (= 5.2.8.1) - activerecord (= 5.2.8.1) - activestorage (= 5.2.8.1) - activesupport (= 5.2.8.1) - bundler (>= 1.3.0) - railties (= 5.2.8.1) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (5.2.8.1) - actionpack (= 5.2.8.1) - activesupport (= 5.2.8.1) - method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) - rainbow (3.1.1) - rake (13.0.6) - rdoc (6.4.0) - psych (>= 4.0.0) - redis (5.0.5) - redis-client (>= 0.9.0) - redis-client (0.11.2) - connection_pool - regexp_parser (2.6.1) - rexml (3.2.5) - rubocop (1.39.0) - json (~> 2.3) - parallel (~> 1.10) - parser (>= 3.1.2.1) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.24.0) - parser (>= 3.1.1.0) - rubocop-minitest (0.24.0) - rubocop (>= 0.90, < 2.0) - rubocop-packaging (0.5.2) - rubocop (>= 1.33, < 2.0) - rubocop-performance (1.15.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.18.0) - activesupport (>= 4.2.0) - rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - ruby-progressbar (1.11.0) - simplecov (0.21.2) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) - simplecov_json_formatter (0.1.4) - sprockets (4.1.1) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) - sqlite3 (1.5.4-arm64-darwin) - sqlite3 (1.5.4-x86_64-darwin) - stringio (3.0.2) - thor (1.2.1) - thread_safe (0.3.6) - timeout (0.3.2) - tzinfo (1.2.11) - thread_safe (~> 0.1) - unicode-display_width (2.3.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - -PLATFORMS - arm64-darwin-22 - x86_64-darwin-21 - -DEPENDENCIES - activeexperiment! - bootsnap - minitest - puma - rails - rdoc - redis - rubocop (>= 1.25.1) - rubocop-minitest - rubocop-packaging - rubocop-performance - rubocop-rails - simplecov - sprockets-rails - sqlite3 (~> 1.4) - -BUNDLED WITH - 2.3.24 diff --git a/lib/active_experiment/instrumentation.rb b/lib/active_experiment/instrumentation.rb index 22b0ab5..2ef9999 100644 --- a/lib/active_experiment/instrumentation.rb +++ b/lib/active_experiment/instrumentation.rb @@ -26,6 +26,9 @@ def instrument(operation, **payload, &block) return ActiveSupport::Notifications.instrument(operation, payload) unless block.present? ActiveSupport::Notifications.instrument(operation, payload) do |event_payload| + @variant = nil unless defined?(@variant) + @halted_callback = nil unless defined?(@halted_callback) + variant = @variant results = block.call From 4fc2b0b99be90811ff2d8f75d27b08e47e08daa2 Mon Sep 17 00:00:00 2001 From: Jeremy Jackson Date: Tue, 21 Mar 2023 16:07:26 -0600 Subject: [PATCH 5/5] Resolves warnings and ups to ruby >= 2.7 --- Gemfile.lock | 208 +++++++++++++++++++++++++++++++++++++++ activeexperiment.gemspec | 2 +- 2 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..9e66350 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,208 @@ +PATH + remote: . + specs: + activeexperiment (0.1.1.alpha) + activesupport (>= 5.0.0) + globalid (>= 0.3.6) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.8.1) + actionpack (= 5.2.8.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.8.1) + actionview (= 5.2.8.1) + activesupport (= 5.2.8.1) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.8.1) + activesupport (= 5.2.8.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.8.1) + activesupport (= 5.2.8.1) + globalid (>= 0.3.6) + activemodel (5.2.8.1) + activesupport (= 5.2.8.1) + activerecord (5.2.8.1) + activemodel (= 5.2.8.1) + activesupport (= 5.2.8.1) + arel (>= 9.0) + activestorage (5.2.8.1) + actionpack (= 5.2.8.1) + activerecord (= 5.2.8.1) + marcel (~> 1.0.0) + activesupport (5.2.8.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (9.0.0) + ast (2.4.2) + bootsnap (1.16.0) + msgpack (~> 1.2) + builder (3.2.4) + concurrent-ruby (1.2.2) + connection_pool (2.3.0) + crass (1.0.6) + date (3.3.3) + docile (1.4.0) + erubi (1.12.0) + globalid (1.1.0) + activesupport (>= 5.0) + i18n (1.12.0) + concurrent-ruby (~> 1.0) + json (2.6.3) + loofah (2.19.1) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + method_source (1.0.0) + mini_mime (1.1.2) + minitest (5.18.0) + msgpack (1.6.1) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.8) + nokogiri (1.14.2-x86_64-darwin) + racc (~> 1.4) + parallel (1.22.1) + parser (3.2.1.1) + ast (~> 2.4.1) + psych (5.1.0) + stringio + puma (6.1.1) + nio4r (~> 2.0) + racc (1.6.2) + rack (2.2.6.4) + rack-test (2.1.0) + rack (>= 1.3) + rails (5.2.8.1) + actioncable (= 5.2.8.1) + actionmailer (= 5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + activemodel (= 5.2.8.1) + activerecord (= 5.2.8.1) + activestorage (= 5.2.8.1) + activesupport (= 5.2.8.1) + bundler (>= 1.3.0) + railties (= 5.2.8.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) + railties (5.2.8.1) + actionpack (= 5.2.8.1) + activesupport (= 5.2.8.1) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rainbow (3.1.1) + rake (13.0.6) + rdoc (6.5.0) + psych (>= 4.0.0) + redis (5.0.6) + redis-client (>= 0.9.0) + redis-client (0.14.0) + connection_pool + regexp_parser (2.7.0) + rexml (3.2.5) + rubocop (1.48.1) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.26.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.27.0) + parser (>= 3.2.1.0) + rubocop-minitest (0.29.0) + rubocop (>= 1.39, < 2.0) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-performance (1.16.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rails (2.18.0) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + ruby-progressbar (1.13.0) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sprockets (4.2.0) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + sqlite3 (1.6.1-x86_64-darwin) + stringio (3.0.5) + thor (1.2.1) + thread_safe (0.3.6) + timeout (0.3.2) + tzinfo (1.2.11) + thread_safe (~> 0.1) + unicode-display_width (2.4.2) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + +PLATFORMS + x86_64-darwin-21 + +DEPENDENCIES + activeexperiment! + bootsnap + minitest + puma + rails (~> 5.2.5) + rdoc + redis + rubocop (>= 1.25.1) + rubocop-minitest + rubocop-packaging + rubocop-performance + rubocop-rails + simplecov + sprockets-rails + sqlite3 (~> 1.4) + +BUNDLED WITH + 2.3.13 diff --git a/activeexperiment.gemspec b/activeexperiment.gemspec index 165caef..bec0143 100644 --- a/activeexperiment.gemspec +++ b/activeexperiment.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.summary = "Experiment framework with pluggable rollouts and instrumentation." s.description = "Declare experiments using classes that can be run in different layers of an application." - s.required_ruby_version = ">= 2.5.0" + s.required_ruby_version = ">= 2.7.0" s.license = "MIT"