From 92930a0e8f08b8bab56a02bdbbda6ed9b03e4397 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 15 Sep 2017 12:55:49 +0200 Subject: [PATCH] Refactoring: Namespace cleanup. Mixins should be placed the most specific path possible. --- lib/sequencer/mixin/exchange/folder.rb | 18 --------------- lib/sequencer/unit/exchange/folders/by_ids.rb | 4 +--- .../unit/exchange/folders/id_path_map.rb | 4 +--- .../unit/exchange/folders/mixin/folder.rb | 22 +++++++++++++++++++ .../import/exchange/attribute_examples.rb | 4 +--- .../exchange/folder_contacts/folder_ids.rb | 4 +--- .../exchange/folder_contacts/sub_sequence.rb | 3 +-- .../import/exchange/folder_contacts/sum.rb | 4 +--- 8 files changed, 28 insertions(+), 35 deletions(-) delete mode 100644 lib/sequencer/mixin/exchange/folder.rb create mode 100644 lib/sequencer/unit/exchange/folders/mixin/folder.rb diff --git a/lib/sequencer/mixin/exchange/folder.rb b/lib/sequencer/mixin/exchange/folder.rb deleted file mode 100644 index 0740da383..000000000 --- a/lib/sequencer/mixin/exchange/folder.rb +++ /dev/null @@ -1,18 +0,0 @@ -class Sequencer - module Mixin - module Exchange - module Folder - - def self.included(base) - base.uses :ews_connection - end - - private - - def ews_folder - @ews_folder ||= ::Import::Exchange::Folder.new(ews_connection) - end - end - end - end -end diff --git a/lib/sequencer/unit/exchange/folders/by_ids.rb b/lib/sequencer/unit/exchange/folders/by_ids.rb index 8a08d530f..4c9d2ee77 100644 --- a/lib/sequencer/unit/exchange/folders/by_ids.rb +++ b/lib/sequencer/unit/exchange/folders/by_ids.rb @@ -1,11 +1,9 @@ -require 'sequencer/mixin/exchange/folder' - class Sequencer class Unit module Exchange module Folders class ByIds < Sequencer::Unit::Base - include ::Sequencer::Mixin::Exchange::Folder + include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder uses :ews_folder_ids provides :ews_folders diff --git a/lib/sequencer/unit/exchange/folders/id_path_map.rb b/lib/sequencer/unit/exchange/folders/id_path_map.rb index 9b6d48847..79bc343de 100644 --- a/lib/sequencer/unit/exchange/folders/id_path_map.rb +++ b/lib/sequencer/unit/exchange/folders/id_path_map.rb @@ -1,11 +1,9 @@ -require 'sequencer/mixin/exchange/folder' - class Sequencer class Unit module Exchange module Folders class IdPathMap < Sequencer::Unit::Base - include ::Sequencer::Mixin::Exchange::Folder + include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder provides :ews_folder_id_path_map diff --git a/lib/sequencer/unit/exchange/folders/mixin/folder.rb b/lib/sequencer/unit/exchange/folders/mixin/folder.rb new file mode 100644 index 000000000..870554fe7 --- /dev/null +++ b/lib/sequencer/unit/exchange/folders/mixin/folder.rb @@ -0,0 +1,22 @@ +class Sequencer + class Unit + module Exchange + module Folders + module Mixin + module Folder + + def self.included(base) + base.uses :ews_connection + end + + private + + def ews_folder + @ews_folder ||= ::Import::Exchange::Folder.new(ews_connection) + end + end + end + end + end + end +end diff --git a/lib/sequencer/unit/import/exchange/attribute_examples.rb b/lib/sequencer/unit/import/exchange/attribute_examples.rb index f4c59c45a..f09e30c63 100644 --- a/lib/sequencer/unit/import/exchange/attribute_examples.rb +++ b/lib/sequencer/unit/import/exchange/attribute_examples.rb @@ -1,11 +1,9 @@ -require 'sequencer/mixin/exchange/folder' - class Sequencer class Unit module Import module Exchange class AttributeExamples < Sequencer::Unit::Base - include ::Sequencer::Mixin::Exchange::Folder + include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder uses :ews_folder_ids provides :ews_attributes_examples diff --git a/lib/sequencer/unit/import/exchange/folder_contacts/folder_ids.rb b/lib/sequencer/unit/import/exchange/folder_contacts/folder_ids.rb index 5e29a9cee..87e72073d 100644 --- a/lib/sequencer/unit/import/exchange/folder_contacts/folder_ids.rb +++ b/lib/sequencer/unit/import/exchange/folder_contacts/folder_ids.rb @@ -1,12 +1,10 @@ -require 'sequencer/mixin/exchange/folder' - class Sequencer class Unit module Import module Exchange module FolderContacts class FolderIds < Sequencer::Unit::Base - include ::Sequencer::Mixin::Exchange::Folder + include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder provides :ews_folder_ids diff --git a/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb b/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb index 6ddd1c970..1fd6d7436 100644 --- a/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb +++ b/lib/sequencer/unit/import/exchange/folder_contacts/sub_sequence.rb @@ -1,4 +1,3 @@ -require 'sequencer/mixin/exchange/folder' require 'sequencer/mixin/import_job/resource_loop' class Sequencer @@ -7,7 +6,7 @@ class Sequencer module Exchange module FolderContacts class SubSequence < Sequencer::Unit::Base - include ::Sequencer::Mixin::Exchange::Folder + include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder include ::Sequencer::Mixin::ImportJob::ResourceLoop uses :ews_folder_ids, :import_job diff --git a/lib/sequencer/unit/import/exchange/folder_contacts/sum.rb b/lib/sequencer/unit/import/exchange/folder_contacts/sum.rb index 1f73d01d4..0d940f8f8 100644 --- a/lib/sequencer/unit/import/exchange/folder_contacts/sum.rb +++ b/lib/sequencer/unit/import/exchange/folder_contacts/sum.rb @@ -1,12 +1,10 @@ -require 'sequencer/mixin/exchange/folder' - class Sequencer class Unit module Import module Exchange module FolderContacts class Sum < Sequencer::Unit::Base - include ::Sequencer::Mixin::Exchange::Folder + include ::Sequencer::Unit::Exchange::Folders::Mixin::Folder uses :ews_folder_ids provides :statistics_diff