Sha256: 8136b82ff06980362fa352038992e430d9613e7429f04064258e598e149bdedb

Contents?: true

Size: 1.61 KB

Versions: 28

Compression:

Stored size: 1.61 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

28 entries across 28 versions & 1 rubygems

Version Path
makit-0.0.11 lib/makit/files.rb
makit-0.0.10 lib/makit/files.rb
makit-0.0.9 lib/makit/files.rb
makit-0.0.8 lib/makit/files.rb
makit-0.0.7 lib/makit/files.rb
makit-0.0.6 lib/makit/files.rb
makit-0.0.1 lib/makit/files.rb
makit-0.0.0 lib/makit/files.rb