Sha256: 1861e74eb4673e3f56592aa7b23cc6146ab011b8731aa0b5554c509e0297374c

Contents?: true

Size: 1.56 KB

Versions: 25

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

require_relative "directory"
require_relative "environment"
require_relative "protoc"
require_relative "nuget"
require_relative "version"
require "rake"

# This module provides classes for the Makit gem.
module Makit
  # This class provide methods for working with the system Environment.
  #
  module Files
    if (Makit::Directories::PROJECT_ROOT != nil)
      Dir.chdir(Makit::Directories::PROJECT_ROOT) do
        CSPROJ = Dir.glob("**/*.csproj")
      end
    else
      CSPROJ = Array.new
    end

    # show all the files constants in a nicely formatted table format with the name of the constant and the value
    def self.show
      # Array of constant names (symbols)
      constant_names = [:CSPROJ]

      # Find the length of the longest constant name and add 1
      max_length = constant_names.map(&:to_s).max_by(&:length).length + 1

      # Iterate through each constant name
      constant_names.each do |constant_name|
        begin
          constant_value = const_get(constant_name)  # Fetch the value of the constant
          if (constant_value != nil && File.exist?(constant_value))
            constant_value = constant_value.colorize(:green)
          end
          # Print the constant name right justified to the max_length
          puts "#{constant_name.to_s.rjust(max_length)} = #{constant_value}"
        rescue NameError
          # Handle the case where the constant is not defined
          puts "#{constant_name.to_s.rjust(max_length)} = [Constant not defined]"
        end
      end
    end
  end # module Files
end # module Makit

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
makit-0.0.57 lib/makit/files.rb
makit-0.0.53 lib/makit/files.rb
makit-0.0.52 lib/makit/files.rb
makit-0.0.51 lib/makit/files.rb
makit-0.0.50 lib/makit/files.rb
makit-0.0.49 lib/makit/files.rb
makit-0.0.47 lib/makit/files.rb
makit-0.0.46 lib/makit/files.rb
makit-0.0.45 lib/makit/files.rb
makit-0.0.44 lib/makit/files.rb
makit-0.0.42 lib/makit/files.rb
makit-0.0.41 lib/makit/files.rb
makit-0.0.35 lib/makit/files.rb
makit-0.0.34 lib/makit/files.rb
makit-0.0.33 lib/makit/files.rb
makit-0.0.32 lib/makit/files.rb
makit-0.0.31 lib/makit/files.rb
makit-0.0.30 lib/makit/files.rb
makit-0.0.29 lib/makit/files.rb
makit-0.0.28 lib/makit/files.rb