Sha256: 9f282014dd0cdee2ee027ec4009fe0cfa89e83cc4c7e0c75e212328a76fe6b2a

Contents?: true

Size: 723 Bytes

Versions: 23

Compression:

Stored size: 723 Bytes

Contents

require "os"

module Imap::Backup
  class Serializer; end

  class Serializer::Directory
    DIRECTORY_PERMISSIONS = 0o700

    attr_reader :relative
    attr_reader :path

    def initialize(path, relative)
      @path = path
      @relative = relative
    end

    def ensure_exists
      if !File.directory?(full_path)
        Utils.make_folder(
          path, relative, DIRECTORY_PERMISSIONS
        )
      end

      return if OS.windows?
      return if Utils.mode(full_path) == DIRECTORY_PERMISSIONS

      FileUtils.chmod DIRECTORY_PERMISSIONS, full_path
    end

    private

    def full_path
      containing_directory = File.join(path, relative)
      File.expand_path(containing_directory)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
imap-backup-9.3.2 lib/imap/backup/serializer/directory.rb
imap-backup-9.4.0.pre1 lib/imap/backup/serializer/directory.rb
imap-backup-9.3.1 lib/imap/backup/serializer/directory.rb
imap-backup-9.3.0 lib/imap/backup/serializer/directory.rb
imap-backup-9.2.0 lib/imap/backup/serializer/directory.rb
imap-backup-9.1.1 lib/imap/backup/serializer/directory.rb
imap-backup-9.1.0 lib/imap/backup/serializer/directory.rb
imap-backup-9.0.2 lib/imap/backup/serializer/directory.rb
imap-backup-9.0.1.rc1 lib/imap/backup/serializer/directory.rb
imap-backup-9.0.0 lib/imap/backup/serializer/directory.rb
imap-backup-9.0.0.rc1 lib/imap/backup/serializer/directory.rb
imap-backup-8.0.2 lib/imap/backup/serializer/directory.rb
imap-backup-8.0.1 lib/imap/backup/serializer/directory.rb
imap-backup-8.0.0 lib/imap/backup/serializer/directory.rb
imap-backup-8.0.0.rc1 lib/imap/backup/serializer/directory.rb
imap-backup-7.0.2 lib/imap/backup/serializer/directory.rb
imap-backup-7.0.0.rc1 lib/imap/backup/serializer/directory.rb
imap-backup-6.3.0 lib/imap/backup/serializer/directory.rb
imap-backup-6.2.1 lib/imap/backup/serializer/directory.rb
imap-backup-6.1.0 lib/imap/backup/serializer/directory.rb