lib/makit/files.rb in makit-0.0.56 vs lib/makit/files.rb in makit-0.0.57

- old
+ new

@@ -1,47 +1,47 @@ -# 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 +# 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