<commit_before>require 'generator'

module Rail
  class Generator < ::Generator
    Error = Class.new(StandardError)

    FILES = [
      'app/assets/javascripts/application.js.coffee',
      'app/assets/stylesheets/application.css.scss',
      'app/helpers/application_helper.rb',
      'app/views/layouts/application.html.haml.erb',
      'config/application.rb.erb',
      'config.ru.erb',
      'Gemfile',
      'public/favicon.png',
      'Rakefile.erb'
    ]

    def initialize(options)
      root_dir = options.fetch(:root_dir)
      template_dir = File.expand_path('../templates', __FILE__)

      project_name = root_dir.split('/').last
        .gsub(/^[^a-zA-Z]*/, '')
        .gsub(/[^\w]/, '')
        .gsub(/^\w|_\w/, &:upcase)
        .gsub(/_+/, ' ')

      class_name = project_name.gsub(' ', '')

      @locals = { class_name: class_name, project_name: project_name }

      raise Error('The project name is invalid.') if class_name.empty?

      super(root_dir: root_dir, template_dir: template_dir)
    end

    def run
      raise Error('The directory already exists.') if File.directory?(root_dir)
      super(FILES, @locals)
    end

    def report(message)
      puts "Creating '#{ message }'..."
    end
  end
end<commit_msg>Fixed a couple of bugs in Generator<commit_after>require 'generator'

module Rail
  class Generator < ::Generator
    Error = Class.new(StandardError)

    FILES = [
      'app/assets/javascripts/application.js.coffee',
      'app/assets/stylesheets/application.css.scss',
      'app/helpers/application_helper.rb',
      'app/views/layouts/application.html.haml.erb',
      'config/application.rb.erb',
      'config.ru.erb',
      'Gemfile',
      'public/favicon.png',
      'Rakefile.erb'
    ]

    def initialize(options)
      root_dir = options.fetch(:root_dir)
      template_dir = File.expand_path('../templates', __FILE__)

      project_name = (root_dir.split('/').last || '')
        .gsub(/^[^a-zA-Z]*/, '')
        .gsub(/[^\w]/, '')
        .gsub(/^\w|_\w/, &:upcase)
        .gsub(/_+/, ' ')

      class_name = project_name.gsub(' ', '')

      @locals = { class_name: class_name, project_name: project_name }

      raise Error, 'The project name is invalid.' if class_name.empty?

      super(root_dir: root_dir, template_dir: template_dir)
    end

    def run
      raise Error, 'The directory already exists.' if File.directory?(root_dir)
      super(FILES, @locals)
    end

    def report(message)
      puts "Creating '#{ message }'..."
    end
  end
end
{'fraction_non_alphanumeric': 0.1549407114624506, 'fraction_numerical': 0.0, 'mean_word_length': 2.5698166431593794, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3703389', 'n_tokens_mistral': 867, 'n_tokens_neox': 838, 'n_words': 153}