<commit_before>require 'rubygems'
require 'extensions/kernel'
require_relative '../Path'
require_relative 'Utilities'

module WebBlocks
  
  module Build
    
    module Module
      
      include ::WebBlocks::Path::Source
      include ::WebBlocks::Path::Temporary_Build
      include ::WebBlocks::Build::Utilities
      
      def modules
        
        if config[:src][:modules] == :all
          all_modules
        elsif config[:src][:modules]
          config[:src][:modules].respond_to?(:each) ? config[:src][:modules] : [config[:src][:modules]]
        else
          []
        end
        
      end
      
      def all_modules
        
        modules = []
        dir = src_core_definitions_dir
        Dir.entries(dir).sort.each do |name|
          next if name[0,1] == '.'
          if File.directory? "#{dir}/#{name}"
            modules.push name
          end
        end
        modules
        
      end
      
      def sass_libs_for base_dir
        
        files = []
        
        get_files(base_dir, 'scss').each do |file|
          files << file if file.match /\/_+require.scss$/ or file.match /\/_+variables.scss$/
        end

        get_files(base_dir, 'scss', false).each do |file|
          files << file unless file.match /\/_+require.scss$/ or file.match /\/_+variables.scss$/
        end
        
        modules.each do |dir|
          
          dir = ::WebBlocks::Path.to base_dir, dir
          
          if File.exists? "#{dir}.scss"
            files << "#{dir}.scss"
          end

          if File.exists? "#{File.dirname(dir)}/_#{File.basename(dir)}.scss"
            files << "#{File.dirname(dir)}/_#{File.basename(dir)}.scss"
          end

          if File.exists? "#{dir}-ie.scss"
            files << "#{dir}-ie.scss"
          end

          if File.exists? "#{File.dirname(dir)}/_#{File.basename(dir)}-ie.scss"
            files << "#{File.dirname(dir)}/_#{File.basename(dir)}-ie.scss"
          end
          
          get_files(dir, 'scss').sort.each do |file|
            files << file unless file.match /\/_+variables.scss$/
          end
          
        end
        
        if block_given?
          files.each do |file|
            yield file
          end
        end
        <commit_msg>Add inclusion of namespace files if they exist [#140]<commit_after>require 'rubygems'
require 'extensions/kernel'
require_relative '../Path'
require_relative 'Utilities'

module WebBlocks
  
  module Build
    
    module Module
      
      include ::WebBlocks::Path::Source
      include ::WebBlocks::Path::Temporary_Build
      include ::WebBlocks::Build::Utilities
      
      def modules
        
        if config[:src][:modules] == :all
          all_modules
        elsif config[:src][:modules]
          config[:src][:modules].respond_to?(:each) ? config[:src][:modules] : [config[:src][:modules]]
        else
          []
        end
        
      end
      
      def all_modules
        
        modules = []
        dir = src_core_definitions_dir
        Dir.entries(dir).sort.each do |name|
          next if name[0,1] == '.'
          if File.directory? "#{dir}/#{name}"
            modules.push name
          end
        end
        modules
        
      end
      
      def sass_libs_for base_dir
        
        files = []
        
        get_files(base_dir, 'scss').each do |file|
          files << file if file.match /\/_+require.scss$/ or file.match /\/_+variables.scss$/
        end

        get_files(base_dir, 'scss', false).each do |file|
          files << file unless file.match /\/_+require.scss$/ or file.match /\/_+variables.scss$/
        end
        
        modules.each do |dir|
          
          subpath = ''
          
          dir.split('/').each do |segment|
            
            subpath << '/' unless subpath.length == 0
            subpath << segment
            path = ::WebBlocks::Path.to base_dir, subpath
            
            if File.exists? "#{path}.scss"
              files << "#{path}.scss"
            end

            if File.exists? "#{File.dirname(path)}/_#{File.basename(path)}.scss"
              files << "#{File.dirname(path)}/_#{File.basename(path)}.scss"
            end

            if File.exists? "#{dir}-ie.scss"
              files << "#{dir}-ie.scss"
            end

            if File.exists? "#{File.dirname(path)}/_#{File.basename(path)}-ie.scss"
              files << "#{File.dirname(path)}/_#{File.basename(path)}-ie.scss"
            end
            
          end
          
          dir = ::WebBlocks::Path.to base_dir, dir
          
          get_files(dir, 'scss').sort.each do |file|
            files << file unless file.match /\/_+variables.scss$/
          end
          
        end
        
        traversed = []
        if block_given?
          files.each do |file|
            next if traversed.include? file
            yield file 
            traversed << file
          end
        end
        
{'fraction_non_alphanumeric': 0.1306097806399678, 'fraction_numerical': 0.0016099818877037633, 'mean_word_length': 1.4862431215607803, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4469434', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1451, 'n_words': 302}