Sha256: 69385ef02959b8933f15ba467898527466b92a3dc1f1162d77960594f2ef88c3

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'logger'
module Sym
  module Constants
    module Bash

      BASH_FILES = Dir.glob("#{File.expand_path('../../../bin', __FILE__)}/sym.*.bash").freeze

      Config = {}

      class << self
        def register_bash_files!
          BASH_FILES.each do |bash_file|
            register_bash_extension bash_file, Config
          end
        end

        private

        def register_bash_extension(bash_file, hash)
          source_file = File.basename(bash_file)
          home_file   = "#{Dir.home}/.#{source_file}"

          hash[source_file.gsub(/sym\./, '').gsub(/\.bash/, '').to_sym] = {
              dest:   home_file,
              source: bash_file,
              script: "[[ -f #{home_file} ]] && source #{home_file}"
          }
        end
      end

      self.register_bash_files!
    end

    module Log
      NIL = Logger.new(nil).freeze # empty logger
      LOG = Logger.new(STDERR).freeze
    end

    ENV_ARGS_VARIABLE_NAME = 'SYM_ARGS'.freeze
    SYM_KEY_FILE           = "#{ENV['HOME']}/.sym.key"

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sym-2.8.5 lib/sym/constants.rb
sym-2.8.4 lib/sym/constants.rb
sym-2.8.2 lib/sym/constants.rb
sym-2.8.1 lib/sym/constants.rb