<commit_before>class SitemplateWysihat::InstallGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates/', __FILE__)

  def copy_engine
    copy_file 'jq-wysihat.js', 'public/jq-wysihat.js'
  end
end
<commit_msg>Возможность автоматического включения ассетов в приложение<commit_after>class SitemplateWysihat::InstallGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates/', __FILE__)

  def copy_engine
    copy_file 'jq-wysihat.js', 'public/jq-wysihat.js'
  end

  def add_assets
    filename = 'app/assets/javascripts/application.js'
    File.open(filename) do |io|
      str = '//= require sitemplate_wysihat'
      append_file(filename, str) if io.grep(str).blank?
    end

    filename = 'app/assets/stylesheets/application.css'
    File.open(filename) do |io|
      str = " *= require sitemplate_wysihat\n"
      inject_into_file(filename, str, before: '*/') if io.grep(str).blank?
    end
  end
end

{'fraction_non_alphanumeric': 0.12343096234309624, 'fraction_numerical': 0.0, 'mean_word_length': 4.145161290322581, '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': '5043137', 'n_tokens_mistral': 351, 'n_tokens_neox': 345, 'n_words': 61}