<commit_before>module TokyoMetro::Rake::Assets::Sass::Make

  def self.partial
    Partial.process
  end

  class Partial

    def self.process
      set_instance_variables

      puts erb_files

      erb_files.each do | filepath |
        process_each_file( filepath )
      end
    end

    class << self

      private

      def set_instance_variables
        @erb_dir = "#{ ::TokyoMetro::RAILS_DIR }/app/assets/sass-partial-erbs"
        @style_sheet_dir = "#{ ::TokyoMetro::RAILS_DIR }/app/assets/stylesheets"
      end

      def erb_files
        ::Dir.glob( "#{ @erb_dir }/**/**.scss.erb" )
      end

      def process_each_file( filepath )
        scss_filepath = filepath.gsub( @erb_dir , @style_sheet_dir ).gsub( /\.erb\Z/ , "" )
        erb = ::ERB.new( ::File.open( filepath , "r:utf-8" ).read )
        erb.filename = filepath

        scss_content = erb.result.gsub( /^ +$/ , "" ).gsub( /\n+/ , "\n" ).gsub( /\A\n+/ , "" )

        ::FileUtils.mkdir_p( ::File.dirname( scss_filepath ) )
        ::File.open( scss_filepath , "w:utf-8" ) do |f|
          f.print( scss_content )
        end
      end

    end

  end

end<commit_msg>20150710_235404 Update - change directory of sass-partial-erbs<commit_after>module TokyoMetro::Rake::Assets::Sass::Make

  def self.partial
    Partial.process
  end

  class Partial

    def self.process
      set_instance_variables

      puts erb_files

      erb_files.each do | filepath |
        process_each_file( filepath )
      end
    end

    class << self

      private

      def set_instance_variables
        @erb_dir = "#{ ::TokyoMetro::RAILS_DIR }/lib/assets/sass-partial-erbs"
        @style_sheet_dir = "#{ ::TokyoMetro::RAILS_DIR }/app/assets/stylesheets"
      end

      def erb_files
        ::Dir.glob( "#{ @erb_dir }/**/**.scss.erb" )
      end

      def process_each_file( filepath )
        scss_filepath = filepath.gsub( @erb_dir , @style_sheet_dir ).gsub( /\.erb\Z/ , "" )
        erb = ::ERB.new( ::File.open( filepath , "r:utf-8" ).read )
        erb.filename = filepath

        scss_content = erb.result.gsub( /^ +$/ , "" ).gsub( /\n+/ , "\n" ).gsub( /\A\n+/ , "" )

        ::FileUtils.mkdir_p( ::File.dirname( scss_filepath ) )
        ::File.open( scss_filepath , "w:utf-8" ) do |f|
          f.print( scss_content )
        end
      end

    end

  end

end
{'fraction_non_alphanumeric': 0.14529186195142735, 'fraction_numerical': 0.007669365146996165, 'mean_word_length': 2.172972972972973, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2387740', 'n_tokens_mistral': 907, 'n_tokens_neox': 855, 'n_words': 158}