<commit_before>require 'fileutils'
require 'pathname'

outer = File.dirname(__FILE__)

# Delete test_rails_app and various doc directories, unless you're actually
# developing admin_assistant itself
containing = Pathname.new(outer).realpath.to_s
two_layers_in = Pathname.new(
  "#{outer}/test_rails_app/vendor/plugins/admin_assistant"
).realpath.to_s
unless containing == two_layers_in
  %w(doc test_rails_app website).each do |dir|
    FileUtils.rm_rf "#{outer}/#{dir}"
  end
end

# Copy over static assets
css_dir = "#{RAILS_ROOT}/public/stylesheets/admin_assistant"
FileUtils.mkdir(css_dir) unless File.exist?(css_dir)
FileUtils.cp_r(Dir.glob("#{outer}/lib/stylesheets/*"), css_dir)
FileUtils.copy(
  "#{outer}/lib/javascripts/admin_assistant.js",
  "#{RAILS_ROOT}/public/javascripts/admin_assistant.js"
)
images_dir = "#{RAILS_ROOT}/public/images/admin_assistant"
FileUtils.mkdir(images_dir) unless File.exist?(images_dir)
FileUtils.cp_r(Dir.glob("#{outer}/lib/images/*"), images_dir)
<commit_msg>install.rb fix<commit_after>require 'fileutils'
require 'pathname'

outer = File.dirname(__FILE__)

# Delete test_rails_app and various doc directories, unless you're actually
# developing admin_assistant itself
test_rails_app = Pathname.new("#{outer}/test_rails_app").realpath.to_s
unless RAILS_ROOT == test_rails_app
  %w(doc test_rails_app website).each do |dir|
    FileUtils.rm_rf "#{outer}/#{dir}"
  end
end

# Copy over static assets
css_dir = "#{RAILS_ROOT}/public/stylesheets/admin_assistant"
FileUtils.mkdir(css_dir) unless File.exist?(css_dir)
FileUtils.cp_r(Dir.glob("#{outer}/lib/stylesheets/*"), css_dir)
FileUtils.copy(
  "#{outer}/lib/javascripts/admin_assistant.js",
  "#{RAILS_ROOT}/public/javascripts/admin_assistant.js"
)
images_dir = "#{RAILS_ROOT}/public/images/admin_assistant"
FileUtils.mkdir(images_dir) unless File.exist?(images_dir)
FileUtils.cp_r(Dir.glob("#{outer}/lib/images/*"), images_dir)

{'fraction_non_alphanumeric': 0.14248569942797712, 'fraction_numerical': 0.0, 'mean_word_length': 6.885245901639344, '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': '1909247', 'n_tokens_mistral': 695, 'n_tokens_neox': 682, 'n_words': 111}