Sha256: 4713911566b63e6c99389ba0a5edf1dc5d51f306912c7a285fce77fd897ba1d1

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

# frozen_string_literal: true

require 'colorize'
require 'pathname'

module Branch
  module Name
    module Locatable
      module_function

      def home_folder
        Dir.home
      end
      alias_method :global_folder, :home_folder
      singleton_class.alias_method :global_folder, :home_folder

      def local_folder
        Dir.pwd
      end

      def system_folder
        system_folder = Pathname.new('/')
        unless system_folder.exist? && system_folder.directory?
          puts "WARNING: system folder #{system_folder} does not exist, " \
            "using global folder instead (#{global_folder})".red

          return global_folder
        end
        system_folder.to_s
      end

      def project_folder(options: {})
        return home_folder if options.blank?

        home_folder
      end

      def system_folder_equals_global_folder?
        syetem_folder == global_folder
      end

      def temp_folder
        Dir.tmpdir
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
branch-name-0.1.0.pre.alpha lib/branch/name/locatable.rb