Sha256: b0437aadaa285a4cced77170014c249831bc6292161251c35820184e6f46ac47

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

require 'dry/system/container'
require 'pg_export/lib/pg_export/types'

class PgExport
  class Container < Dry::System::Container
    configure do
      config.root = Pathname(__FILE__).realpath.dirname
      config.name = :pg_export
      config.default_namespace = 'pg_export'
      config.auto_register = %w[lib]
    end

    load_paths!('lib')

    boot(:ftp) do
      init do
        require 'pg_export/lib/pg_export/factories/ftp_adapter_factory'
      end

      start do
        use :config

        register('factories.ftp_adapter_factory') do
          ::PgExport::Factories::FtpAdapterFactory.new
        end
      end
    end

    boot(:main) do
      init do
        require 'pg_export/lib/pg_export/operations/encrypt_dump'
        require 'pg_export/lib/pg_export/operations/decrypt_dump'
        require 'pg_export/lib/pg_export/operations/remove_old_dumps_from_ftp'
        require 'pg_export/lib/pg_export/operations/open_ftp_connection'
      end

      start do
        use :ftp
        register('operations.encrypt_dump') { ::PgExport::Operations::EncryptDump.new }
        register('operations.decrypt_dump') { ::PgExport::Operations::DecryptDump.new }
        register('operations.remove_old_dumps_from_ftp') { ::PgExport::Operations::RemoveOldDumpsFromFtp.new }
        register('operations.open_ftp_connection') { ::PgExport::Operations::OpenFtpConnection.new }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pg_export-0.7.7 lib/pg_export/container.rb
pg_export-0.7.6 lib/pg_export/container.rb
pg_export-0.7.5 lib/pg_export/container.rb
pg_export-0.7.4 lib/pg_export/container.rb
pg_export-0.7.3 lib/pg_export/container.rb
pg_export-0.7.2 lib/pg_export/container.rb
pg_export-0.7.1 lib/pg_export/container.rb
pg_export-0.7.0 lib/pg_export/container.rb