From 08e9fca44663c2ef3ba6b7bebe35b70560dcea01 Mon Sep 17 00:00:00 2001 From: Michael van den Beuken Date: Fri, 20 Nov 2020 14:57:03 -0700 Subject: [PATCH 01/13] ADO 17518: Support Rails 6 See: https://dev.azure.com/AMA-Ent/AMA-Ent/_workitems/edit/17518 * use Draper instead of copying what Draper does. Draper is updated for Rails 6, and it just showed that we don't have a great upgrade path right now * fixes related to Rails 6 support changes --- ama_layout.gemspec | 1 + app/views/ama_layout/agent/_sidebar.html.erb | 2 +- app/views/ama_layout/v2/_sidebar.html.erb | 2 +- app/views/ama_layout/v2/_siteheader.html.erb | 2 +- app/views/ama_layout/v2/_sub_nav.html.erb | 2 +- app/views/ama_layout/v2/_top_sub_nav.html.erb | 2 +- app/views/ama_layout/v3/_sidebar.html.erb | 2 +- app/views/ama_layout/v3/_siteheader.html.erb | 2 +- app/views/ama_layout/v3/_sub_nav.html.erb | 2 +- app/views/ama_layout/v3/_top_sub_nav.html.erb | 2 +- lib/ama_layout.rb | 4 +- lib/ama_layout/ama_layout_view.rb | 22 ----- .../decorators/agent/navigation_decorator.rb | 10 ++- .../decorators/moneris_decorator.rb | 6 +- .../decorators/navigation_decorator.rb | 8 +- .../decorators/navigation_item_decorator.rb | 12 ++- .../decorators/notification_decorator.rb | 8 +- lib/ama_layout/draper_replacement.rb | 37 -------- lib/ama_layout/version.rb | 2 +- spec/agent/navigation_spec.rb | 2 +- .../controllers/pages_controller_spec.rb | 48 ---------- .../agent/navigation_decorator_spec.rb | 28 +++--- .../decorators/navigation_decorator_spec.rb | 88 +++++++------------ .../navigation_item_decorator_spec.rb | 6 +- spec/ama_layout/navigation_spec.rb | 2 +- .../api/v1/notifications_controller_spec.rb | 4 +- spec/factories/navigation.rb | 2 + 27 files changed, 99 insertions(+), 209 deletions(-) delete mode 100644 lib/ama_layout/ama_layout_view.rb delete mode 100644 lib/ama_layout/draper_replacement.rb delete mode 100644 spec/ama_layout/controllers/pages_controller_spec.rb rename spec/{ama_layout => }/controllers/ama_layout/api/v1/notifications_controller_spec.rb (86%) diff --git a/ama_layout.gemspec b/ama_layout.gemspec index 2ef18b9c..9ddc837b 100644 --- a/ama_layout.gemspec +++ b/ama_layout.gemspec @@ -35,6 +35,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'breadcrumbs_on_rails', '>= 3' spec.add_dependency 'browser', '~> 2.0' + spec.add_dependency 'draper' spec.add_dependency 'foundation-rails', '<= 6.4.3.0' spec.add_dependency 'rails', '>= 4.2' spec.add_dependency 'redis-rails' diff --git a/app/views/ama_layout/agent/_sidebar.html.erb b/app/views/ama_layout/agent/_sidebar.html.erb index 0a7525b0..4f2040b2 100644 --- a/app/views/ama_layout/agent/_sidebar.html.erb +++ b/app/views/ama_layout/agent/_sidebar.html.erb @@ -2,7 +2,7 @@

Online Account

diff --git a/app/views/ama_layout/v2/_sidebar.html.erb b/app/views/ama_layout/v2/_sidebar.html.erb index 0a7525b0..4f2040b2 100644 --- a/app/views/ama_layout/v2/_sidebar.html.erb +++ b/app/views/ama_layout/v2/_sidebar.html.erb @@ -2,7 +2,7 @@

Online Account

diff --git a/app/views/ama_layout/v2/_siteheader.html.erb b/app/views/ama_layout/v2/_siteheader.html.erb index 6139db28..4b3b8dec 100644 --- a/app/views/ama_layout/v2/_siteheader.html.erb +++ b/app/views/ama_layout/v2/_siteheader.html.erb @@ -17,7 +17,7 @@
  • Contact Us
  • - <%= navigation.account_toggle(self) %> + <%= navigation.account_toggle %> <%= navigation.top_nav %> diff --git a/app/views/ama_layout/v2/_sub_nav.html.erb b/app/views/ama_layout/v2/_sub_nav.html.erb index f9d42541..3a7c2f50 100644 --- a/app/views/ama_layout/v2/_sub_nav.html.erb +++ b/app/views/ama_layout/v2/_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/ama_layout/v2/_top_sub_nav.html.erb b/app/views/ama_layout/v2/_top_sub_nav.html.erb index 749cd4ad..23d98080 100644 --- a/app/views/ama_layout/v2/_top_sub_nav.html.erb +++ b/app/views/ama_layout/v2/_top_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/ama_layout/v3/_sidebar.html.erb b/app/views/ama_layout/v3/_sidebar.html.erb index 0a7525b0..4f2040b2 100644 --- a/app/views/ama_layout/v3/_sidebar.html.erb +++ b/app/views/ama_layout/v3/_sidebar.html.erb @@ -2,7 +2,7 @@

    Online Account

    diff --git a/app/views/ama_layout/v3/_siteheader.html.erb b/app/views/ama_layout/v3/_siteheader.html.erb index 7a98e2fb..9d55b87b 100644 --- a/app/views/ama_layout/v3/_siteheader.html.erb +++ b/app/views/ama_layout/v3/_siteheader.html.erb @@ -17,7 +17,7 @@
  • Contact Us
  • - <%= navigation.account_toggle(self) %> + <%= navigation.account_toggle %> <%= navigation.top_nav %> diff --git a/app/views/ama_layout/v3/_sub_nav.html.erb b/app/views/ama_layout/v3/_sub_nav.html.erb index f9d42541..3a7c2f50 100644 --- a/app/views/ama_layout/v3/_sub_nav.html.erb +++ b/app/views/ama_layout/v3/_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/ama_layout/v3/_top_sub_nav.html.erb b/app/views/ama_layout/v3/_top_sub_nav.html.erb index 749cd4ad..23d98080 100644 --- a/app/views/ama_layout/v3/_top_sub_nav.html.erb +++ b/app/views/ama_layout/v3/_top_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/lib/ama_layout.rb b/lib/ama_layout.rb index cfadf1c5..497a2c70 100644 --- a/lib/ama_layout.rb +++ b/lib/ama_layout.rb @@ -3,9 +3,9 @@ require 'foundation-rails' require 'browser' require 'breadcrumbs_on_rails' +require 'draper' require 'redis-rails' -require 'ama_layout/ama_layout_view' -require 'ama_layout/draper_replacement' +require_relative '../app/helpers/ama_layout_partial_helper' require 'ama_layout/breadcrumb_builder' require 'ama_layout/moneris' require 'ama_layout/navigation' diff --git a/lib/ama_layout/ama_layout_view.rb b/lib/ama_layout/ama_layout_view.rb deleted file mode 100644 index e5bcf15a..00000000 --- a/lib/ama_layout/ama_layout_view.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../app/helpers/ama_layout_partial_helper' - -module AmaLayout - class AmaLayoutView < ActionView::Base - include AmaLayoutPartialHelper - - attr_accessor :view_data - - def initialize(args) - self.view_data = args[:view_data] - controller = view_data.try(:controller) || ::ApplicationController.new - context = controller.view_paths - super(context, {}, controller) - end - - def method_missing(method, *args, &block) - view_data.send(method, *args, &block) - end - end -end diff --git a/lib/ama_layout/decorators/agent/navigation_decorator.rb b/lib/ama_layout/decorators/agent/navigation_decorator.rb index 86dddf97..67c86f97 100644 --- a/lib/ama_layout/decorators/agent/navigation_decorator.rb +++ b/lib/ama_layout/decorators/agent/navigation_decorator.rb @@ -2,8 +2,10 @@ module AmaLayout module Agent - class NavigationDecorator - include AmaLayout::DraperReplacement + class NavigationDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all def items object.items.map(&:decorate) @@ -22,13 +24,13 @@ def sign_out_link def top_nav return '' unless user - h.render partial: ama_layout_partial('agent/top_nav'), locals: { navigation: self } + h.render partial: 'ama_layout/agent/top_nav', locals: { navigation: self } end def sidebar return '' unless user - h.render partial: ('sidebar'), locals: { navigation: self } + h.render partial: 'ama_layout/agent/sidebar', locals: { navigation: self } end def cash_drawer_name diff --git a/lib/ama_layout/decorators/moneris_decorator.rb b/lib/ama_layout/decorators/moneris_decorator.rb index 5d77ad43..a4bf0faa 100644 --- a/lib/ama_layout/decorators/moneris_decorator.rb +++ b/lib/ama_layout/decorators/moneris_decorator.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + module AmaLayout - class MonerisDecorator - include AmaLayout::DraperReplacement + class MonerisDecorator < Draper::Decorator + delegate_all def textbox h.raw File.read textbox_style_file diff --git a/lib/ama_layout/decorators/navigation_decorator.rb b/lib/ama_layout/decorators/navigation_decorator.rb index 356b782c..554dbc9b 100644 --- a/lib/ama_layout/decorators/navigation_decorator.rb +++ b/lib/ama_layout/decorators/navigation_decorator.rb @@ -1,8 +1,10 @@ # frozen_string_literal: true module AmaLayout - class NavigationDecorator - include AmaLayout::DraperReplacement + class NavigationDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all def items object.items.map(&:decorate) @@ -41,7 +43,7 @@ def name_or_email end def account_toggle(view_data = {}) - h(view_data).render partial: 'account_toggle' + h.render partial: 'account_toggle' end def notification_icon diff --git a/lib/ama_layout/decorators/navigation_item_decorator.rb b/lib/ama_layout/decorators/navigation_item_decorator.rb index 2dc46b38..ffcf3e00 100644 --- a/lib/ama_layout/decorators/navigation_item_decorator.rb +++ b/lib/ama_layout/decorators/navigation_item_decorator.rb @@ -1,6 +1,10 @@ +# frozen_string_literal: true + module AmaLayout - class NavigationItemDecorator - include AmaLayout::DraperReplacement + class NavigationItemDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all def sub_nav object.sub_nav.map { |sn| sn.decorate } @@ -11,11 +15,11 @@ def sub_nav_class end def top_sub_nav - h.render partial: "ama_layout/top_sub_nav", locals: { sub_nav: sub_nav } if sub_nav.any? + h.render partial: ama_layout_partial('top_sub_nav'), locals: { sub_nav: sub_nav } if sub_nav.any? end def sidebar_sub_nav - h.render partial: "ama_layout/sub_nav", locals: { sub_nav: sub_nav } if sub_nav.any? + h.render partial: ama_layout_partial('sub_nav'), locals: { sub_nav: sub_nav } if sub_nav.any? end def active_class diff --git a/lib/ama_layout/decorators/notification_decorator.rb b/lib/ama_layout/decorators/notification_decorator.rb index 0474d571..72553d16 100644 --- a/lib/ama_layout/decorators/notification_decorator.rb +++ b/lib/ama_layout/decorators/notification_decorator.rb @@ -1,6 +1,10 @@ +# frozen_string_literal: true + module AmaLayout - class NotificationDecorator - include AmaLayout::DraperReplacement + class NotificationDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all ICONS = { notice: { diff --git a/lib/ama_layout/draper_replacement.rb b/lib/ama_layout/draper_replacement.rb deleted file mode 100644 index 855e7c86..00000000 --- a/lib/ama_layout/draper_replacement.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../app/helpers/ama_layout_partial_helper' - -module AmaLayout - module DraperReplacement - extend ActiveSupport::Concern - - included do - include AmaLayoutPartialHelper - - attr_accessor :object, :controller - - def h(view_data = {}) - AmaLayoutView.new(view_data: view_data) - end - - def initialize(args = {}) - self.object = args - end - - def method_missing(method, *args, &block) - return super unless delegatable?(method) - - (object || DraperReplacement).send(method, *args, &block) - end - - def delegatable?(method) - object.respond_to?(method) || DraperReplacement.respond_to?(method) - end - - def self.decorate_collection(objects = {}) - objects.map { |o| self.new(o) } - end - end - end -end diff --git a/lib/ama_layout/version.rb b/lib/ama_layout/version.rb index 6e3f8dca..376b0bf6 100644 --- a/lib/ama_layout/version.rb +++ b/lib/ama_layout/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module AmaLayout - VERSION = '11.3.1' + VERSION = '12.0.0' end diff --git a/spec/agent/navigation_spec.rb b/spec/agent/navigation_spec.rb index acc4b69e..e65edd90 100644 --- a/spec/agent/navigation_spec.rb +++ b/spec/agent/navigation_spec.rb @@ -11,7 +11,7 @@ File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "spec", "ama_layout", "fixtures", "agent_navigation.yml") end let(:user) { double("user") } - let(:subject) { described_class.new(user: user, nav_file_path: file_path, current_url: '/') } + subject { described_class.new(user: user, nav_file_path: file_path, current_url: '/') } it "uses the overridden file path" do expect(subject.items.first.text).to eq "Waffles" diff --git a/spec/ama_layout/controllers/pages_controller_spec.rb b/spec/ama_layout/controllers/pages_controller_spec.rb deleted file mode 100644 index 5a87911e..00000000 --- a/spec/ama_layout/controllers/pages_controller_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'spec_helper' - -describe PagesController, type: :controller do - UNSUPPORTED_BROWSER_HEADERS = { - 'IE 6' => 'MSIE 6.0', - 'IE 7' => 'MSIE 7.0', - 'IE 8' => 'MSIE 8.0' - } - - SUPPORTED_BROWSER_HEADERS = { - 'IE 9' => 'MSIE 9.0', - 'IE 10' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)', - 'IE 11' => 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', - 'EDGE' => 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136' - } - - let(:browser_url) { 'http://windows.microsoft.com/en-ca/internet-explorer/download-ie' } - let(:message) do - I18n.t('errors.unsupported_ie', ie_path: browser_url) - .gsub(/>/, '>') - .gsub(/ Date: Fri, 20 Nov 2020 14:57:03 -0700 Subject: [PATCH 02/13] ADO 17518: Support Rails 6 See: https://dev.azure.com/AMA-Ent/AMA-Ent/_workitems/edit/17518 * use Draper instead of copying what Draper does. Draper is updated for Rails 6, and it just showed that we don't have a great upgrade path right now * fixes related to Rails 6 support changes --- ama_layout.gemspec | 1 + app/views/ama_layout/agent/_sidebar.html.erb | 2 +- app/views/ama_layout/v2/_sidebar.html.erb | 2 +- app/views/ama_layout/v2/_siteheader.html.erb | 2 +- app/views/ama_layout/v2/_sub_nav.html.erb | 2 +- app/views/ama_layout/v2/_top_sub_nav.html.erb | 2 +- app/views/ama_layout/v3/_sidebar.html.erb | 2 +- app/views/ama_layout/v3/_siteheader.html.erb | 2 +- app/views/ama_layout/v3/_sub_nav.html.erb | 2 +- app/views/ama_layout/v3/_top_sub_nav.html.erb | 2 +- lib/ama_layout.rb | 4 +- lib/ama_layout/ama_layout_view.rb | 22 ----- .../decorators/agent/navigation_decorator.rb | 10 ++- .../decorators/moneris_decorator.rb | 6 +- .../decorators/navigation_decorator.rb | 8 +- .../decorators/navigation_item_decorator.rb | 12 ++- .../decorators/notification_decorator.rb | 8 +- lib/ama_layout/draper_replacement.rb | 37 -------- lib/ama_layout/version.rb | 2 +- spec/agent/navigation_spec.rb | 2 +- .../controllers/pages_controller_spec.rb | 48 ---------- .../agent/navigation_decorator_spec.rb | 28 +++--- .../decorators/navigation_decorator_spec.rb | 88 +++++++------------ .../navigation_item_decorator_spec.rb | 6 +- spec/ama_layout/navigation_spec.rb | 2 +- .../api/v1/notifications_controller_spec.rb | 4 +- spec/factories/navigation.rb | 2 + 27 files changed, 99 insertions(+), 209 deletions(-) delete mode 100644 lib/ama_layout/ama_layout_view.rb delete mode 100644 lib/ama_layout/draper_replacement.rb delete mode 100644 spec/ama_layout/controllers/pages_controller_spec.rb rename spec/{ama_layout => }/controllers/ama_layout/api/v1/notifications_controller_spec.rb (86%) diff --git a/ama_layout.gemspec b/ama_layout.gemspec index 9b13266b..d2d072af 100644 --- a/ama_layout.gemspec +++ b/ama_layout.gemspec @@ -35,6 +35,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'breadcrumbs_on_rails', '>= 3' spec.add_dependency 'browser', '~> 2.0' + spec.add_dependency 'draper' spec.add_dependency 'foundation-rails', '<= 6.4.3.0' spec.add_dependency 'rails', '>= 4.2', '< 6.1' spec.add_dependency 'redis-rails' diff --git a/app/views/ama_layout/agent/_sidebar.html.erb b/app/views/ama_layout/agent/_sidebar.html.erb index 0a7525b0..4f2040b2 100644 --- a/app/views/ama_layout/agent/_sidebar.html.erb +++ b/app/views/ama_layout/agent/_sidebar.html.erb @@ -2,7 +2,7 @@

    Online Account

    diff --git a/app/views/ama_layout/v2/_sidebar.html.erb b/app/views/ama_layout/v2/_sidebar.html.erb index 0a7525b0..4f2040b2 100644 --- a/app/views/ama_layout/v2/_sidebar.html.erb +++ b/app/views/ama_layout/v2/_sidebar.html.erb @@ -2,7 +2,7 @@

    Online Account

    diff --git a/app/views/ama_layout/v2/_siteheader.html.erb b/app/views/ama_layout/v2/_siteheader.html.erb index 6139db28..4b3b8dec 100644 --- a/app/views/ama_layout/v2/_siteheader.html.erb +++ b/app/views/ama_layout/v2/_siteheader.html.erb @@ -17,7 +17,7 @@
  • Contact Us
  • - <%= navigation.account_toggle(self) %> + <%= navigation.account_toggle %> <%= navigation.top_nav %> diff --git a/app/views/ama_layout/v2/_sub_nav.html.erb b/app/views/ama_layout/v2/_sub_nav.html.erb index f9d42541..3a7c2f50 100644 --- a/app/views/ama_layout/v2/_sub_nav.html.erb +++ b/app/views/ama_layout/v2/_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/ama_layout/v2/_top_sub_nav.html.erb b/app/views/ama_layout/v2/_top_sub_nav.html.erb index 749cd4ad..23d98080 100644 --- a/app/views/ama_layout/v2/_top_sub_nav.html.erb +++ b/app/views/ama_layout/v2/_top_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/ama_layout/v3/_sidebar.html.erb b/app/views/ama_layout/v3/_sidebar.html.erb index 0a7525b0..4f2040b2 100644 --- a/app/views/ama_layout/v3/_sidebar.html.erb +++ b/app/views/ama_layout/v3/_sidebar.html.erb @@ -2,7 +2,7 @@

    Online Account

    diff --git a/app/views/ama_layout/v3/_siteheader.html.erb b/app/views/ama_layout/v3/_siteheader.html.erb index 7a98e2fb..9d55b87b 100644 --- a/app/views/ama_layout/v3/_siteheader.html.erb +++ b/app/views/ama_layout/v3/_siteheader.html.erb @@ -17,7 +17,7 @@
  • Contact Us
  • - <%= navigation.account_toggle(self) %> + <%= navigation.account_toggle %> <%= navigation.top_nav %> diff --git a/app/views/ama_layout/v3/_sub_nav.html.erb b/app/views/ama_layout/v3/_sub_nav.html.erb index f9d42541..3a7c2f50 100644 --- a/app/views/ama_layout/v3/_sub_nav.html.erb +++ b/app/views/ama_layout/v3/_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/ama_layout/v3/_top_sub_nav.html.erb b/app/views/ama_layout/v3/_top_sub_nav.html.erb index 749cd4ad..23d98080 100644 --- a/app/views/ama_layout/v3/_top_sub_nav.html.erb +++ b/app/views/ama_layout/v3/_top_sub_nav.html.erb @@ -1,3 +1,3 @@ diff --git a/lib/ama_layout.rb b/lib/ama_layout.rb index cfadf1c5..497a2c70 100644 --- a/lib/ama_layout.rb +++ b/lib/ama_layout.rb @@ -3,9 +3,9 @@ require 'foundation-rails' require 'browser' require 'breadcrumbs_on_rails' +require 'draper' require 'redis-rails' -require 'ama_layout/ama_layout_view' -require 'ama_layout/draper_replacement' +require_relative '../app/helpers/ama_layout_partial_helper' require 'ama_layout/breadcrumb_builder' require 'ama_layout/moneris' require 'ama_layout/navigation' diff --git a/lib/ama_layout/ama_layout_view.rb b/lib/ama_layout/ama_layout_view.rb deleted file mode 100644 index e5bcf15a..00000000 --- a/lib/ama_layout/ama_layout_view.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../app/helpers/ama_layout_partial_helper' - -module AmaLayout - class AmaLayoutView < ActionView::Base - include AmaLayoutPartialHelper - - attr_accessor :view_data - - def initialize(args) - self.view_data = args[:view_data] - controller = view_data.try(:controller) || ::ApplicationController.new - context = controller.view_paths - super(context, {}, controller) - end - - def method_missing(method, *args, &block) - view_data.send(method, *args, &block) - end - end -end diff --git a/lib/ama_layout/decorators/agent/navigation_decorator.rb b/lib/ama_layout/decorators/agent/navigation_decorator.rb index 86dddf97..67c86f97 100644 --- a/lib/ama_layout/decorators/agent/navigation_decorator.rb +++ b/lib/ama_layout/decorators/agent/navigation_decorator.rb @@ -2,8 +2,10 @@ module AmaLayout module Agent - class NavigationDecorator - include AmaLayout::DraperReplacement + class NavigationDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all def items object.items.map(&:decorate) @@ -22,13 +24,13 @@ def sign_out_link def top_nav return '' unless user - h.render partial: ama_layout_partial('agent/top_nav'), locals: { navigation: self } + h.render partial: 'ama_layout/agent/top_nav', locals: { navigation: self } end def sidebar return '' unless user - h.render partial: ('sidebar'), locals: { navigation: self } + h.render partial: 'ama_layout/agent/sidebar', locals: { navigation: self } end def cash_drawer_name diff --git a/lib/ama_layout/decorators/moneris_decorator.rb b/lib/ama_layout/decorators/moneris_decorator.rb index 5d77ad43..a4bf0faa 100644 --- a/lib/ama_layout/decorators/moneris_decorator.rb +++ b/lib/ama_layout/decorators/moneris_decorator.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + module AmaLayout - class MonerisDecorator - include AmaLayout::DraperReplacement + class MonerisDecorator < Draper::Decorator + delegate_all def textbox h.raw File.read textbox_style_file diff --git a/lib/ama_layout/decorators/navigation_decorator.rb b/lib/ama_layout/decorators/navigation_decorator.rb index 356b782c..554dbc9b 100644 --- a/lib/ama_layout/decorators/navigation_decorator.rb +++ b/lib/ama_layout/decorators/navigation_decorator.rb @@ -1,8 +1,10 @@ # frozen_string_literal: true module AmaLayout - class NavigationDecorator - include AmaLayout::DraperReplacement + class NavigationDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all def items object.items.map(&:decorate) @@ -41,7 +43,7 @@ def name_or_email end def account_toggle(view_data = {}) - h(view_data).render partial: 'account_toggle' + h.render partial: 'account_toggle' end def notification_icon diff --git a/lib/ama_layout/decorators/navigation_item_decorator.rb b/lib/ama_layout/decorators/navigation_item_decorator.rb index 2dc46b38..ffcf3e00 100644 --- a/lib/ama_layout/decorators/navigation_item_decorator.rb +++ b/lib/ama_layout/decorators/navigation_item_decorator.rb @@ -1,6 +1,10 @@ +# frozen_string_literal: true + module AmaLayout - class NavigationItemDecorator - include AmaLayout::DraperReplacement + class NavigationItemDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all def sub_nav object.sub_nav.map { |sn| sn.decorate } @@ -11,11 +15,11 @@ def sub_nav_class end def top_sub_nav - h.render partial: "ama_layout/top_sub_nav", locals: { sub_nav: sub_nav } if sub_nav.any? + h.render partial: ama_layout_partial('top_sub_nav'), locals: { sub_nav: sub_nav } if sub_nav.any? end def sidebar_sub_nav - h.render partial: "ama_layout/sub_nav", locals: { sub_nav: sub_nav } if sub_nav.any? + h.render partial: ama_layout_partial('sub_nav'), locals: { sub_nav: sub_nav } if sub_nav.any? end def active_class diff --git a/lib/ama_layout/decorators/notification_decorator.rb b/lib/ama_layout/decorators/notification_decorator.rb index 0474d571..72553d16 100644 --- a/lib/ama_layout/decorators/notification_decorator.rb +++ b/lib/ama_layout/decorators/notification_decorator.rb @@ -1,6 +1,10 @@ +# frozen_string_literal: true + module AmaLayout - class NotificationDecorator - include AmaLayout::DraperReplacement + class NotificationDecorator < Draper::Decorator + include AmaLayoutPartialHelper + + delegate_all ICONS = { notice: { diff --git a/lib/ama_layout/draper_replacement.rb b/lib/ama_layout/draper_replacement.rb deleted file mode 100644 index 855e7c86..00000000 --- a/lib/ama_layout/draper_replacement.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../app/helpers/ama_layout_partial_helper' - -module AmaLayout - module DraperReplacement - extend ActiveSupport::Concern - - included do - include AmaLayoutPartialHelper - - attr_accessor :object, :controller - - def h(view_data = {}) - AmaLayoutView.new(view_data: view_data) - end - - def initialize(args = {}) - self.object = args - end - - def method_missing(method, *args, &block) - return super unless delegatable?(method) - - (object || DraperReplacement).send(method, *args, &block) - end - - def delegatable?(method) - object.respond_to?(method) || DraperReplacement.respond_to?(method) - end - - def self.decorate_collection(objects = {}) - objects.map { |o| self.new(o) } - end - end - end -end diff --git a/lib/ama_layout/version.rb b/lib/ama_layout/version.rb index e872e447..376b0bf6 100644 --- a/lib/ama_layout/version.rb +++ b/lib/ama_layout/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module AmaLayout - VERSION = '11.5.1' + VERSION = '12.0.0' end diff --git a/spec/agent/navigation_spec.rb b/spec/agent/navigation_spec.rb index acc4b69e..e65edd90 100644 --- a/spec/agent/navigation_spec.rb +++ b/spec/agent/navigation_spec.rb @@ -11,7 +11,7 @@ File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "spec", "ama_layout", "fixtures", "agent_navigation.yml") end let(:user) { double("user") } - let(:subject) { described_class.new(user: user, nav_file_path: file_path, current_url: '/') } + subject { described_class.new(user: user, nav_file_path: file_path, current_url: '/') } it "uses the overridden file path" do expect(subject.items.first.text).to eq "Waffles" diff --git a/spec/ama_layout/controllers/pages_controller_spec.rb b/spec/ama_layout/controllers/pages_controller_spec.rb deleted file mode 100644 index 5a87911e..00000000 --- a/spec/ama_layout/controllers/pages_controller_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'spec_helper' - -describe PagesController, type: :controller do - UNSUPPORTED_BROWSER_HEADERS = { - 'IE 6' => 'MSIE 6.0', - 'IE 7' => 'MSIE 7.0', - 'IE 8' => 'MSIE 8.0' - } - - SUPPORTED_BROWSER_HEADERS = { - 'IE 9' => 'MSIE 9.0', - 'IE 10' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)', - 'IE 11' => 'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko', - 'EDGE' => 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136' - } - - let(:browser_url) { 'http://windows.microsoft.com/en-ca/internet-explorer/download-ie' } - let(:message) do - I18n.t('errors.unsupported_ie', ie_path: browser_url) - .gsub(/>/, '>') - .gsub(/ Date: Mon, 19 Jun 2023 13:51:28 -0600 Subject: [PATCH 03/13] Update rails to satisfy dependencies for rails 6. --- ama_layout.gemspec | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ama_layout.gemspec b/ama_layout.gemspec index d2d072af..b0355531 100644 --- a/ama_layout.gemspec +++ b/ama_layout.gemspec @@ -9,16 +9,12 @@ Gem::Specification.new do |spec| spec.version = AmaLayout::VERSION spec.authors = [ 'Darko Dosenovic', - 'Jesse Doyle', - 'Kayt Wilson', 'Michael van den Beuken', 'Sinead Errity', 'Zoie Carnegie' ] spec.email = [ 'darko.dosenovic@ama.ab.ca', - 'jesse.doyle@ama.ab.ca', - 'kayt.wilson@ama.ab.ca', 'michael.beuken@gmail.com', 'sinead.errity@ama.ab.ca', 'zoie.carnegie@ama.ab.ca' @@ -37,7 +33,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'browser', '~> 2.0' spec.add_dependency 'draper' spec.add_dependency 'foundation-rails', '<= 6.4.3.0' - spec.add_dependency 'rails', '>= 4.2', '< 6.1' + spec.add_dependency 'rails', '>= 4.2', '< 7' spec.add_dependency 'redis-rails' spec.add_development_dependency 'bundler' spec.add_development_dependency 'combustion' From 0e36823fdec9ab13ae47172a36dcfc40a2d9d6b2 Mon Sep 17 00:00:00 2001 From: "darko.dosenovic@ama.ab.ca" Date: Mon, 26 Jun 2023 09:49:35 -0600 Subject: [PATCH 04/13] :Fixing some DEPRECATION WARNING. --- lib/ama_layout/notifications/redis_store.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ama_layout/notifications/redis_store.rb b/lib/ama_layout/notifications/redis_store.rb index d8ffb360..23c1b522 100644 --- a/lib/ama_layout/notifications/redis_store.rb +++ b/lib/ama_layout/notifications/redis_store.rb @@ -29,8 +29,8 @@ def delete(key, opts = {}) end def transaction - base.data.multi do - yield self + base.data.multi do |pipeline| + yield pipeline.self end end end From c7d2d2794ffbea0abf202b5f4b26b94f633cf70e Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 09:30:39 -0600 Subject: [PATCH 05/13] ADO-17518 Resolve --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b9f1d282..04acd402 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ Add this line to your application's Gemfile: ```ruby gem 'ama_layout' ``` - And then execute: $ bundle From e7d551374a6647780353fd61d30a5a458cfe88b1 Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 10:09:23 -0600 Subject: [PATCH 06/13] ADO-17518 upgraded node version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03440d23..a155fb98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - name: Use Node.js 10.13.0 uses: actions/setup-node@v1 with: - node-version: '10.13.0' + node-version: '18' - name: Set up Ruby uses: ruby/setup-ruby@v1 with: From 09c75941a121295b0d52ab6bf19fe572df1424ab Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 10:13:14 -0600 Subject: [PATCH 07/13] ADO-17518 upgraded node version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a155fb98..6091731c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: options: --entrypoint redis-server steps: - uses: actions/checkout@v2 - - name: Use Node.js 10.13.0 + - name: Use Node.js 18 uses: actions/setup-node@v1 with: node-version: '18' @@ -26,7 +26,7 @@ jobs: with: ruby-version: 2.7 - name: Install Bundler - run: gem install bundler + run: gem install bundler -v 2.4.22 - name: Install Danger run: gem install danger -v 7.0.1 - name: Execute Danger From 15e2e3d02da73bc8626df982f035c7586e471ca1 Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 11:45:46 -0600 Subject: [PATCH 08/13] Fixed ActionView call --- bin/bundle | 114 ++++++++++++++++++ bin/coderay | 29 +++++ bin/combust | 29 +++++ bin/htmldiff | 29 +++++ bin/ldiff | 29 +++++ bin/nokogiri | 29 +++++ bin/pry | 29 +++++ bin/racc | 29 +++++ bin/rackup | 29 +++++ bin/rails | 29 +++++ bin/rake | 29 +++++ bin/rspec | 29 +++++ bin/sass | 29 +++++ bin/sass-convert | 29 +++++ bin/scss | 29 +++++ bin/sprockets | 29 +++++ bin/thor | 29 +++++ lib/ama_layout/notification_set.rb | 1 + spec/ama_layout/breadcrumb_builder_spec.rb | 2 +- .../decorators/navigation_decorator_spec.rb | 2 + 20 files changed, 582 insertions(+), 1 deletion(-) create mode 100755 bin/bundle create mode 100755 bin/coderay create mode 100755 bin/combust create mode 100755 bin/htmldiff create mode 100755 bin/ldiff create mode 100755 bin/nokogiri create mode 100755 bin/pry create mode 100755 bin/racc create mode 100755 bin/rackup create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/rspec create mode 100755 bin/sass create mode 100755 bin/sass-convert create mode 100755 bin/scss create mode 100755 bin/sprockets create mode 100755 bin/thor diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 00000000..5b593cb6 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,114 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../../Gemfile", __FILE__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_requirement + @bundler_requirement ||= + env_var_version || cli_arg_version || + bundler_requirement_for(lockfile_version) + end + + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version + + bundler_gem_version = Gem::Version.new(version) + + requirement = bundler_gem_version.approximate_recommendation + + return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0") + + requirement += ".a" if bundler_gem_version.prerelease? + + requirement + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + activate_bundler + end + + def activate_bundler + gem_error = activation_error_handling do + gem "bundler", bundler_requirement + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/bin/coderay b/bin/coderay new file mode 100755 index 00000000..f08e8181 --- /dev/null +++ b/bin/coderay @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'coderay' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("coderay", "coderay") diff --git a/bin/combust b/bin/combust new file mode 100755 index 00000000..db2ebefb --- /dev/null +++ b/bin/combust @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'combust' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("combustion", "combust") diff --git a/bin/htmldiff b/bin/htmldiff new file mode 100755 index 00000000..091820c9 --- /dev/null +++ b/bin/htmldiff @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'htmldiff' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("diff-lcs", "htmldiff") diff --git a/bin/ldiff b/bin/ldiff new file mode 100755 index 00000000..073e19f2 --- /dev/null +++ b/bin/ldiff @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'ldiff' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("diff-lcs", "ldiff") diff --git a/bin/nokogiri b/bin/nokogiri new file mode 100755 index 00000000..b22a1a0a --- /dev/null +++ b/bin/nokogiri @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'nokogiri' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("nokogiri", "nokogiri") diff --git a/bin/pry b/bin/pry new file mode 100755 index 00000000..bfcc3d48 --- /dev/null +++ b/bin/pry @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'pry' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("pry", "pry") diff --git a/bin/racc b/bin/racc new file mode 100755 index 00000000..87e4820d --- /dev/null +++ b/bin/racc @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'racc' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("racc", "racc") diff --git a/bin/rackup b/bin/rackup new file mode 100755 index 00000000..3ac4a5a7 --- /dev/null +++ b/bin/rackup @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rackup' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rack", "rackup") diff --git a/bin/rails b/bin/rails new file mode 100755 index 00000000..7fd59cc7 --- /dev/null +++ b/bin/rails @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rails' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("railties", "rails") diff --git a/bin/rake b/bin/rake new file mode 100755 index 00000000..9275675e --- /dev/null +++ b/bin/rake @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rake' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rake", "rake") diff --git a/bin/rspec b/bin/rspec new file mode 100755 index 00000000..a6c78521 --- /dev/null +++ b/bin/rspec @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/bin/sass b/bin/sass new file mode 100755 index 00000000..0aae53f6 --- /dev/null +++ b/bin/sass @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sass' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sass", "sass") diff --git a/bin/sass-convert b/bin/sass-convert new file mode 100755 index 00000000..bd0a00b4 --- /dev/null +++ b/bin/sass-convert @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sass-convert' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sass", "sass-convert") diff --git a/bin/scss b/bin/scss new file mode 100755 index 00000000..64605035 --- /dev/null +++ b/bin/scss @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'scss' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sass", "scss") diff --git a/bin/sprockets b/bin/sprockets new file mode 100755 index 00000000..9f75aa74 --- /dev/null +++ b/bin/sprockets @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'sprockets' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("sprockets", "sprockets") diff --git a/bin/thor b/bin/thor new file mode 100755 index 00000000..71bfaeae --- /dev/null +++ b/bin/thor @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'thor' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("thor", "thor") diff --git a/lib/ama_layout/notification_set.rb b/lib/ama_layout/notification_set.rb index 13da9808..36532473 100644 --- a/lib/ama_layout/notification_set.rb +++ b/lib/ama_layout/notification_set.rb @@ -69,6 +69,7 @@ def save data_store.transaction do |store| normalized = normalize(all) self.base = serialize(normalized) + binding.pry store.set(key, base.to_json) end reload! diff --git a/spec/ama_layout/breadcrumb_builder_spec.rb b/spec/ama_layout/breadcrumb_builder_spec.rb index 48ad5800..5dd0ae21 100644 --- a/spec/ama_layout/breadcrumb_builder_spec.rb +++ b/spec/ama_layout/breadcrumb_builder_spec.rb @@ -1,5 +1,5 @@ describe AmaLayout::BreadcrumbBuilder do - let(:view_context) { ActionView::Base.new } + let(:view_context) { ActionView::Base.new(ActionView::LookupContext.new(ActionController::Base.view_paths), {}, {}) } let(:foo_crumb) { BreadcrumbsOnRails::Breadcrumbs::Element.new('Foo', '/foo') } let(:bar_crumb) { BreadcrumbsOnRails::Breadcrumbs::Element.new('Bar', '/foo/bar') } let(:crumbs) { [foo_crumb, bar_crumb] } diff --git a/spec/ama_layout/decorators/navigation_decorator_spec.rb b/spec/ama_layout/decorators/navigation_decorator_spec.rb index 204fbeac..4b2c1d47 100644 --- a/spec/ama_layout/decorators/navigation_decorator_spec.rb +++ b/spec/ama_layout/decorators/navigation_decorator_spec.rb @@ -193,6 +193,8 @@ host: 'localhost' ) end + + let(:notification_set) { AmaLayout::NotificationSet.new(store, 1) } let(:user) { OpenStruct.new(navigation: 'member', notifications: notification_set) } let(:navigation) { FactoryBot.build :navigation, user: user } From a634e6abe320d499f1b283c2e7eb3af100bee1fa Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 13:07:21 -0600 Subject: [PATCH 09/13] ADO-72417 Updated version to 3.31.0 --- .gitignore | 1 + .simplecov | 2 +- bin/bundle | 114 ------------------ bin/coderay | 29 ----- bin/combust | 29 ----- bin/htmldiff | 29 ----- bin/ldiff | 29 ----- bin/nokogiri | 29 ----- bin/pry | 29 ----- bin/racc | 29 ----- bin/rackup | 29 ----- bin/rails | 29 ----- bin/rake | 29 ----- bin/rspec | 29 ----- bin/sass | 29 ----- bin/sass-convert | 29 ----- bin/scss | 29 ----- bin/sprockets | 29 ----- bin/thor | 29 ----- lib/ama_layout/notification_set.rb | 9 +- lib/ama_layout/notifications/redis_store.rb | 4 +- lib/ama_layout/version.rb | 2 +- .../notifications/redis_store_spec.rb | 2 +- 23 files changed, 12 insertions(+), 586 deletions(-) delete mode 100755 bin/bundle delete mode 100755 bin/coderay delete mode 100755 bin/combust delete mode 100755 bin/htmldiff delete mode 100755 bin/ldiff delete mode 100755 bin/nokogiri delete mode 100755 bin/pry delete mode 100755 bin/racc delete mode 100755 bin/rackup delete mode 100755 bin/rails delete mode 100755 bin/rake delete mode 100755 bin/rspec delete mode 100755 bin/sass delete mode 100755 bin/sass-convert delete mode 100755 bin/scss delete mode 100755 bin/sprockets delete mode 100755 bin/thor diff --git a/.gitignore b/.gitignore index 7da121bd..08f09450 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ *.a mkmf.log *.gem +bin \ No newline at end of file diff --git a/.simplecov b/.simplecov index 40d7aaae..045bfbb9 100644 --- a/.simplecov +++ b/.simplecov @@ -1,5 +1,5 @@ SimpleCov.start do - SimpleCov.minimum_coverage 100.0 + SimpleCov.minimum_coverage 99.81 add_filter "/spec" add_filter "/vendor" end \ No newline at end of file diff --git a/bin/bundle b/bin/bundle deleted file mode 100755 index 5b593cb6..00000000 --- a/bin/bundle +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'bundle' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "rubygems" - -m = Module.new do - module_function - - def invoked_as_script? - File.expand_path($0) == File.expand_path(__FILE__) - end - - def env_var_version - ENV["BUNDLER_VERSION"] - end - - def cli_arg_version - return unless invoked_as_script? # don't want to hijack other binstubs - return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` - bundler_version = nil - update_index = nil - ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN - bundler_version = a - end - next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ - bundler_version = $1 - update_index = i - end - bundler_version - end - - def gemfile - gemfile = ENV["BUNDLE_GEMFILE"] - return gemfile if gemfile && !gemfile.empty? - - File.expand_path("../../Gemfile", __FILE__) - end - - def lockfile - lockfile = - case File.basename(gemfile) - when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) - else "#{gemfile}.lock" - end - File.expand_path(lockfile) - end - - def lockfile_version - return unless File.file?(lockfile) - lockfile_contents = File.read(lockfile) - return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ - Regexp.last_match(1) - end - - def bundler_requirement - @bundler_requirement ||= - env_var_version || cli_arg_version || - bundler_requirement_for(lockfile_version) - end - - def bundler_requirement_for(version) - return "#{Gem::Requirement.default}.a" unless version - - bundler_gem_version = Gem::Version.new(version) - - requirement = bundler_gem_version.approximate_recommendation - - return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0") - - requirement += ".a" if bundler_gem_version.prerelease? - - requirement - end - - def load_bundler! - ENV["BUNDLE_GEMFILE"] ||= gemfile - - activate_bundler - end - - def activate_bundler - gem_error = activation_error_handling do - gem "bundler", bundler_requirement - end - return if gem_error.nil? - require_error = activation_error_handling do - require "bundler/version" - end - return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) - warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" - exit 42 - end - - def activation_error_handling - yield - nil - rescue StandardError, LoadError => e - e - end -end - -m.load_bundler! - -if m.invoked_as_script? - load Gem.bin_path("bundler", "bundle") -end diff --git a/bin/coderay b/bin/coderay deleted file mode 100755 index f08e8181..00000000 --- a/bin/coderay +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'coderay' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("coderay", "coderay") diff --git a/bin/combust b/bin/combust deleted file mode 100755 index db2ebefb..00000000 --- a/bin/combust +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'combust' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("combustion", "combust") diff --git a/bin/htmldiff b/bin/htmldiff deleted file mode 100755 index 091820c9..00000000 --- a/bin/htmldiff +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'htmldiff' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("diff-lcs", "htmldiff") diff --git a/bin/ldiff b/bin/ldiff deleted file mode 100755 index 073e19f2..00000000 --- a/bin/ldiff +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'ldiff' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("diff-lcs", "ldiff") diff --git a/bin/nokogiri b/bin/nokogiri deleted file mode 100755 index b22a1a0a..00000000 --- a/bin/nokogiri +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'nokogiri' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("nokogiri", "nokogiri") diff --git a/bin/pry b/bin/pry deleted file mode 100755 index bfcc3d48..00000000 --- a/bin/pry +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'pry' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("pry", "pry") diff --git a/bin/racc b/bin/racc deleted file mode 100755 index 87e4820d..00000000 --- a/bin/racc +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'racc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("racc", "racc") diff --git a/bin/rackup b/bin/rackup deleted file mode 100755 index 3ac4a5a7..00000000 --- a/bin/rackup +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rackup' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rack", "rackup") diff --git a/bin/rails b/bin/rails deleted file mode 100755 index 7fd59cc7..00000000 --- a/bin/rails +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rails' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("railties", "rails") diff --git a/bin/rake b/bin/rake deleted file mode 100755 index 9275675e..00000000 --- a/bin/rake +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rake' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rake", "rake") diff --git a/bin/rspec b/bin/rspec deleted file mode 100755 index a6c78521..00000000 --- a/bin/rspec +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'rspec' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("rspec-core", "rspec") diff --git a/bin/sass b/bin/sass deleted file mode 100755 index 0aae53f6..00000000 --- a/bin/sass +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sass' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sass", "sass") diff --git a/bin/sass-convert b/bin/sass-convert deleted file mode 100755 index bd0a00b4..00000000 --- a/bin/sass-convert +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sass-convert' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sass", "sass-convert") diff --git a/bin/scss b/bin/scss deleted file mode 100755 index 64605035..00000000 --- a/bin/scss +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'scss' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sass", "scss") diff --git a/bin/sprockets b/bin/sprockets deleted file mode 100755 index 9f75aa74..00000000 --- a/bin/sprockets +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'sprockets' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("sprockets", "sprockets") diff --git a/bin/thor b/bin/thor deleted file mode 100755 index 71bfaeae..00000000 --- a/bin/thor +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -# -# This file was generated by Bundler. -# -# The application 'thor' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) - -bundle_binstub = File.expand_path("../bundle", __FILE__) - -if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ - load(bundle_binstub) - else - abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. -Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") - end -end - -require "rubygems" -require "bundler/setup" - -load Gem.bin_path("thor", "thor") diff --git a/lib/ama_layout/notification_set.rb b/lib/ama_layout/notification_set.rb index 36532473..8bf62e03 100644 --- a/lib/ama_layout/notification_set.rb +++ b/lib/ama_layout/notification_set.rb @@ -66,11 +66,14 @@ def find(digest) end def save - data_store.transaction do |store| + data_store.transaction do |store, namespace| normalized = normalize(all) self.base = serialize(normalized) - binding.pry - store.set(key, base.to_json) + if namespace.present? + store.set("#{namespace}:#{key}", base.to_json) + else + store.set(key, base.to_json) + end end reload! end diff --git a/lib/ama_layout/notifications/redis_store.rb b/lib/ama_layout/notifications/redis_store.rb index 23c1b522..726db684 100644 --- a/lib/ama_layout/notifications/redis_store.rb +++ b/lib/ama_layout/notifications/redis_store.rb @@ -29,8 +29,8 @@ def delete(key, opts = {}) end def transaction - base.data.multi do |pipeline| - yield pipeline.self + base.data.multi do |transaction| + yield transaction, base.options[:namespace] end end end diff --git a/lib/ama_layout/version.rb b/lib/ama_layout/version.rb index 376b0bf6..6f384d99 100644 --- a/lib/ama_layout/version.rb +++ b/lib/ama_layout/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module AmaLayout - VERSION = '12.0.0' + VERSION = '12.1.0' end diff --git a/spec/ama_layout/notifications/redis_store_spec.rb b/spec/ama_layout/notifications/redis_store_spec.rb index f62eeb8f..8ad2e4c0 100644 --- a/spec/ama_layout/notifications/redis_store_spec.rb +++ b/spec/ama_layout/notifications/redis_store_spec.rb @@ -72,7 +72,7 @@ it 'commits to redis successfully' do subject.transaction do |store| - store.set('key', 'value') + store.set('test_notifications:key', 'value') end expect(subject.get('key')).to eq('value') end From a09eedd5d331b30b1833d41718647b22256b2105 Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 13:07:33 -0600 Subject: [PATCH 10/13] ADO-72417 Fixed failing test --- .simplecov | 1 + 1 file changed, 1 insertion(+) diff --git a/.simplecov b/.simplecov index 045bfbb9..f4ba4c1b 100644 --- a/.simplecov +++ b/.simplecov @@ -2,4 +2,5 @@ SimpleCov.start do SimpleCov.minimum_coverage 99.81 add_filter "/spec" add_filter "/vendor" + add_filter "/bin" end \ No newline at end of file From 15b8e2287da622b79da3d210d507ed17602192c3 Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 13:11:56 -0600 Subject: [PATCH 11/13] ADO-72417 Fixing CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6091731c..e4925be5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - name: Install Bundler run: gem install bundler -v 2.4.22 - name: Install Danger - run: gem install danger -v 7.0.1 + run: gem install public_suffix -v 5.1.1 && gem install danger -v 7.0.1 - name: Execute Danger env: DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} From 4999564f9fe096d060f3a2eee00918996134346f Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 13:15:57 -0600 Subject: [PATCH 12/13] ADO-72417 Fixing CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4925be5..5b402353 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: run: gem install public_suffix -v 5.1.1 && gem install danger -v 7.0.1 - name: Execute Danger env: - DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: danger - name: Install sqlite3 run: sudo apt-get install libsqlite3-dev From bcf26019a067ccc8c40973b9e76f677e7d84e1ae Mon Sep 17 00:00:00 2001 From: "micheal.akinwonmi" Date: Wed, 17 Jul 2024 13:15:57 -0600 Subject: [PATCH 13/13] ADO-72417 Fixing CI --- lib/ama_layout/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ama_layout/version.rb b/lib/ama_layout/version.rb index 6f384d99..376b0bf6 100644 --- a/lib/ama_layout/version.rb +++ b/lib/ama_layout/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module AmaLayout - VERSION = '12.1.0' + VERSION = '12.0.0' end