Sha256: 4662e1c7d11db933275cdf209535604a8b833f3efe8e55aadf391d73d85cf23b

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

module Getch
  module Tree
    # call class depend of the os choosen
    class Os
      OS_TREE = {
        gentoo: Gentoo,
        void: Void
      }.freeze

      def initialize
        @os = OPTIONS[:os]
        @log = Log.new
      end

      def select
        OS_TREE[@os.to_sym] || @log.fatal('OS no found')
      end
    end

    # call class depend on filesystem choosen.
    class FS
      FS_TREE = {
        true => { # + encrypt
          true => { # + lvm
            ext4: FileSystem::Ext4::Hybrid
          },
          false => { # - lvm
            ext4: FileSystem::Ext4::Encrypt,
            zfs: FileSystem::Zfs::Encrypt
          }
        },
        false => { # - encrypt
          true => { # + lvm
            ext4: FileSystem::Ext4::Lvm
          },
          false => { # - lvm
            ext4: FileSystem::Ext4::Minimal,
            zfs: FileSystem::Zfs::Minimal
          }
        }
      }.freeze

      def initialize
        @encrypt = OPTIONS[:encrypt]
        @lvm = OPTIONS[:lvm]
        @fs = OPTIONS[:fs]
        @log = Log.new
      end

      def select
        FS_TREE[@encrypt][@lvm][@fs.to_sym] || @log.fatal('Error in FS_TREE or no comptatible options')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
getch-0.11.0 lib/getch/tree.rb
getch-0.7.3 lib/getch/tree.rb
getch-0.7.0 lib/getch/tree.rb