<commit_before>module Creact
  module FileOperations
    extend self
    def get_absolute_path(file)
      location = File.dirname(__FILE__)
      "#{location}/files/#{file}"
    end

    def create_dirs
      dirs = ['views', 'js']
      puts 'Creating the following dirs: ' + dirs.join(' ')
      FileUtils.makedirs dirs
    end

    def create_views(template=:mote)
      puts 'Creating view files...'
      # TODO: Refactor into a case statement:
      if template == :mote
        @view_files = ['layout.mote', 'home.mote']
      end
      files = @view_files.map { |file| get_absolute_path(file) }
      FileUtils.cp(files, 'views')
    end

    def create_js(template=:mote)
      puts 'Creating js files...'
      @js_files = ['jquery.js', 'react.rb'].map { |file| get_absolute_path(file) }
      FileUtils.cp(@js_files, 'js')
    end

    def creact_react_entry_point
      FileUtils.cp(get_absolute_path('react.rb'), 'js')
    end

  #   def check_dir_empty(dir)
  #     (Dir.entries(dir) - %w{ . .. }).empty?
  #   end
  #
  #   def delete_files
  #     @js_files = ['js/jquery.js', 'js/react.rb']
  #     @view_files = ['views/layout.mote', 'views/home.mote']
  #     puts "Destructive operation: 'yes' to continue"<commit_msg>Added method to delete created directories.<commit_after>module Creact
  module FileOperations
    extend self
    def get_absolute_path(file)
      location = File.dirname(__FILE__)
      "#{location}/files/#{file}"
    end

    def create_dirs
      dirs = ['views', 'js']
      puts 'Creating the following dirs: ' + dirs.join(' ')
      FileUtils.makedirs dirs
    end

    def create_views(template=:mote)
      puts 'Creating view files...'
      # TODO: Refactor into a case statement:
      if template == :mote
        @view_files = ['layout.mote', 'home.mote']
      end
      files = @view_files.map { |file| get_absolute_path(file) }
      FileUtils.cp(files, 'views')
    end

    def create_js(template=:mote)
      puts 'Creating js files...'
      @js_files = ['jquery.js', 'react.rb'].map { |file| get_absolute_path(file) }
      FileUtils.cp(@js_files, 'js')
    end

    def creact_react_entry_point
      FileUtils.cp(get_absolute_path('react.rb'), 'js')
    end

    def delete_dirs
      FileUtils.rm_rf 'views'
      FileUtils.rm_rf 'js'
    end

  #   def check_dir_empty(dir)
  #     (Dir.entries(dir) - %w{ . .. }).empty?
  #   end
  #
  #   def delete_files
  #     @js_files = ['js/jquery.js', 'js/react.rb']
  #     @view_files = ['views/layout.mote', 'views/home.mote']
  #     puts "Destructive operation: 'yes' to continue"
{'fraction_non_alphanumeric': 0.13993831919814959, 'fraction_numerical': 0.0, 'mean_word_length': 2.629370629370629, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6858277', 'n_tokens_mistral': 900, 'n_tokens_neox': 893, 'n_words': 193}