<commit_before>Dir["#{File.dirname(__FILE__)}/heroku_deployment/**/*.rb"].each {|f| require f}

module HerokuDeployment
  class Rails

    def initialize
      HerokuDeployment::Config.commit_files = []
    end

    def generate_css_and_js
      js_files = HerokuDeployment::Config.js_files
      css_files = HerokuDeployment::Config.css_files
      puts "Generating all the Javascripts and CSS as production"
      system %(rm #{(js_files.collect{|j| "public/javascripts/#{j}"} + css_files.collect{|c| "public/stylesheets/#{c}"}).join(" ")} 2> /dev/null)
      HerokuDeployment::Config.commit_files << 'public/javascripts/'
      HerokuDeployment::Config.commit_files << 'public/stylesheets/'
      res = !!system(%(RAILS_ENV=production ./script/rails runner "Rails.application.config.action_controller.perform_caching = false; require 'rails/console/app' ; app.get '#{HerokuDeployment::Config.generate_url}'"))
      (js_files.collect{|j| "public/javascripts/#{j}"} + css_files.collect{|c| "public/stylesheets/#{c}"}).each do |f|
        unless File.exist?(f)
          puts "File '#{f}' did not get created! Deploy failed"
          return false
        end
      end
      res
    end

    def db_migrate
      system %(heroku rake db:migrate --app #{HerokuDeployment::Config.app})
    end

    def deploy<commit_msg>add option to skip deploy, for testing<commit_after>Dir["#{File.dirname(__FILE__)}/heroku_deployment/**/*.rb"].each {|f| require f}

module HerokuDeployment
  class Rails

    def initialize
      HerokuDeployment::Config.commit_files = []
    end

    def generate_css_and_js
      js_files = HerokuDeployment::Config.js_files
      css_files = HerokuDeployment::Config.css_files
      puts "Generating all the Javascripts and CSS as production"
      system %(rm #{(js_files.collect{|j| "public/javascripts/#{j}"} + css_files.collect{|c| "public/stylesheets/#{c}"}).join(" ")} 2> /dev/null)
      HerokuDeployment::Config.commit_files << 'public/javascripts/'
      HerokuDeployment::Config.commit_files << 'public/stylesheets/'
      puts %(Running: \nRAILS_ENV=production ./script/rails runner "Rails.application.config.action_controller.perform_caching = false; require 'rails/console/app' ; app.get '#{HerokuDeployment::Config.generate_url}'")
      res = !!system(%(RAILS_ENV=production ./script/rails runner "Rails.application.config.action_controller.perform_caching = false; require 'rails/console/app' ; app.get '#{HerokuDeployment::Config.generate_url}'"))
      (js_files.collect{|j| "public/javascripts/#{j}"} + css_files.collect{|c| "public/stylesheets/#{c}"}).each do |f|
        unless File.exist?(f)
          puts "File '#{f}' did not get created! Deploy failed"
          return false
        end
      end
      res
    end

    def db_migrate
      system %(heroku rake db:migrate --app #{HerokuDeployment::Config.app})
    end

    def deploy
{'fraction_non_alphanumeric': 0.14137214137214138, 'fraction_numerical': 0.000693000693000693, 'mean_word_length': 3.7798013245033113, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, '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': '4789520', 'n_tokens_mistral': 934, 'n_tokens_neox': 910, 'n_words': 182}