Migrated custom LDAP import_job.dry_run Unit to shared Unit based on new simple provider structure and delegation pattern.
This commit is contained in:
parent
de6d8c54ae
commit
5a6f3f1a38
4 changed files with 44 additions and 21 deletions
|
@ -7,7 +7,7 @@ class Sequencer
|
||||||
def self.sequence
|
def self.sequence
|
||||||
[
|
[
|
||||||
'Import::Ldap::Users::StaticAttributes',
|
'Import::Ldap::Users::StaticAttributes',
|
||||||
'Import::Ldap::Users::DryRun::Flag',
|
'Import::Common::ImportJob::DryRun',
|
||||||
'Import::Ldap::Users::DryRun::Payload',
|
'Import::Ldap::Users::DryRun::Payload',
|
||||||
'Ldap::Config',
|
'Ldap::Config',
|
||||||
'Ldap::Connection',
|
'Ldap::Connection',
|
||||||
|
|
27
lib/sequencer/unit/common/provider/named.rb
Normal file
27
lib/sequencer/unit/common/provider/named.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
class Sequencer
|
||||||
|
class Unit
|
||||||
|
module Common
|
||||||
|
module Provider
|
||||||
|
class Named < Sequencer::Unit::Common::Provider::Attribute
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
def named_provide
|
||||||
|
name.demodulize.underscore.to_sym
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.inherited(base)
|
||||||
|
base.extend(ClassMethods)
|
||||||
|
base.provides(base.named_provide)
|
||||||
|
|
||||||
|
base.extend(Forwardable)
|
||||||
|
end
|
||||||
|
|
||||||
|
def provides
|
||||||
|
self.class.named_provide
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/sequencer/unit/import/common/import_job/dry_run.rb
Normal file
16
lib/sequencer/unit/import/common/import_job/dry_run.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
class Sequencer
|
||||||
|
class Unit
|
||||||
|
module Import
|
||||||
|
module Common
|
||||||
|
module ImportJob
|
||||||
|
class DryRun < Sequencer::Unit::Common::Provider::Named
|
||||||
|
|
||||||
|
uses :import_job
|
||||||
|
|
||||||
|
delegate dry_run: :import_job
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,20 +0,0 @@
|
||||||
class Sequencer
|
|
||||||
class Unit
|
|
||||||
module Import
|
|
||||||
module Ldap
|
|
||||||
module Users
|
|
||||||
class DryRun
|
|
||||||
class Flag < Sequencer::Unit::Base
|
|
||||||
uses :import_job
|
|
||||||
provides :dry_run
|
|
||||||
|
|
||||||
def process
|
|
||||||
state.provide(:dry_run, import_job.dry_run)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue