<commit_before>require 'active_support/core_ext/date'
require 'active_support/core_ext/integer'

module Suspenders
  class AppBuilder < Rails::AppBuilder
    include Suspenders::Actions

    def readme
      template 'README.md.erb', 'README.md'
    end

    def raise_on_delivery_errors
      replace_in_file 'config/environments/development.rb',
        'raise_delivery_errors = false', 'raise_delivery_errors = true'
    end

    def raise_on_unpermitted_parameters
      config = <<-RUBY
    config.action_controller.action_on_unpermitted_parameters = :raise
      RUBY

      inject_into_class "config/application.rb", "Application", config
    end

    def provide_dev_prime_task
      copy_file 'development_seeds.rb', 'lib/tasks/development_seeds.rake'
    end

    def configure_generators
      config = <<-RUBY

    config.generators do |generate|
      generate.helper false
      generate.javascript_engine false
      generate.request_specs false
      generate.routing_specs false
      generate.stylesheets false
      generate.test_framework :rspec
      generate.view_specs false
    end

      RUBY

      inject_into_class 'config/application.rb', 'Application', config
    end

    def configure_simple_form
      generate 'simple_form:install --bootstrap'
    end

    def set_up_factory_girl_for_rspec
      copy_file 'factory_girl_rspec.rb', 'spec/support/factory_girl.rb'
    end

    def setup_custom_requests_helpers_for_rspec
      copy_file 'rspec_requests_helpers.rb', 'spec/support/requests_helpers.rb'
    end

    def configure_newrelic
      template 'newrelic.yml.erb', 'config/newrelic.yml'
    end

    def configure_smtp
      copy_file 'smtp.rb', 'config/smtp.rb'

      prepend_file 'config/environments/production.rb',
        %{require Rails.root.join("config/smtp")\n}

      config = <<-RUBY

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = SMTP_SETTINGS
      RUBY

      inject_into_file 'config/environments/production.rb', config,
        :after => 'config.action_mailer.raise_delivery_errors = false'
    end

    def setup_default_locale
      locale = default_locale
      remove_file 'config/locales/en.yml'

      case locale
      when 'ru'
        append_file 'Gemfile', "\n  gem 'russian', '~> 0.6.0'"
      end

      replace_in_file 'config/application.rb',
        '# config.i18n.default_locale = :de',
        "config.i18n.default_locale = :#{locale}"

      template "config_locales.yml.erb",
               "config/locales/#{locale}.yml"
    end

    def enable_rack_deflater
      config = <<-RUBY

  # Enable deflate / gzip compression of controller-generated responses
  config.middleware.use Rack::Deflater
      RUBY

      inject_into_file 'config/environments/production.rb', config,
        :after => "config.serve_static_files = false\n"
    end

    def setup_asset_host
      replace_in_file 'config/environments/production.rb',
        "# config.action_controller.asset_host = 'http://assets.example.com'",
        "config.action_controller.asset_host = ENV.fetch('ASSET_HOST')"

      replace_in_file 'config/environments/production.rb',
        'config.serve_static_files = false',
        "config.static_cache_control = 'public, max-age=#{1.years.ago}'"

      replace_in_file 'config/initializers/assets.rb',
        "config.assets.version = '1.0'",
        "config.assets.version = (ENV['ASSETS_VERSION'] || '1.0')"
    end

    def setup_annotate
      copy_file 'auto_annotate_models.rake', 'lib/tasks/auto_annotate_models.rake'
    end
<commit_msg>missed to_i method call<commit_after>require 'active_support/core_ext/date'
require 'active_support/core_ext/integer'

module Suspenders
  class AppBuilder < Rails::AppBuilder
    include Suspenders::Actions

    def readme
      template 'README.md.erb', 'README.md'
    end

    def raise_on_delivery_errors
      replace_in_file 'config/environments/development.rb',
        'raise_delivery_errors = false', 'raise_delivery_errors = true'
    end

    def raise_on_unpermitted_parameters
      config = <<-RUBY
    config.action_controller.action_on_unpermitted_parameters = :raise
      RUBY

      inject_into_class "config/application.rb", "Application", config
    end

    def provide_dev_prime_task
      copy_file 'development_seeds.rb', 'lib/tasks/development_seeds.rake'
    end

    def configure_generators
      config = <<-RUBY

    config.generators do |generate|
      generate.helper false
      generate.javascript_engine false
      generate.request_specs false
      generate.routing_specs false
      generate.stylesheets false
      generate.test_framework :rspec
      generate.view_specs false
    end

      RUBY

      inject_into_class 'config/application.rb', 'Application', config
    end

    def configure_simple_form
      generate 'simple_form:install --bootstrap'
    end

    def set_up_factory_girl_for_rspec
      copy_file 'factory_girl_rspec.rb', 'spec/support/factory_girl.rb'
    end

    def setup_custom_requests_helpers_for_rspec
      copy_file 'rspec_requests_helpers.rb', 'spec/support/requests_helpers.rb'
    end

    def configure_newrelic
      template 'newrelic.yml.erb', 'config/newrelic.yml'
    end

    def configure_smtp
      copy_file 'smtp.rb', 'config/smtp.rb'

      prepend_file 'config/environments/production.rb',
        %{require Rails.root.join("config/smtp")\n}

      config = <<-RUBY

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = SMTP_SETTINGS
      RUBY

      inject_into_file 'config/environments/production.rb', config,
        :after => 'config.action_mailer.raise_delivery_errors = false'
    end

    def setup_default_locale
      locale = default_locale
      remove_file 'config/locales/en.yml'

      case locale
      when 'ru'
        append_file 'Gemfile', "\n  gem 'russian', '~> 0.6.0'"
      end

      replace_in_file 'config/application.rb',
        '# config.i18n.default_locale = :de',
        "config.i18n.default_locale = :#{locale}"

      template "config_locales.yml.erb",
               "config/locales/#{locale}.yml"
    end

    def enable_rack_deflater
      config = <<-RUBY

  # Enable deflate / gzip compression of controller-generated responses
  config.middleware.use Rack::Deflater
      RUBY

      inject_into_file 'config/environments/production.rb', config,
        :after => "config.serve_static_files = false\n"
    end

    def setup_asset_host
      replace_in_file 'config/environments/production.rb',
        "# config.action_controller.asset_host = 'http://assets.example.com'",
        "config.action_controller.asset_host = ENV.fetch('ASSET_HOST')"

      replace_in_file 'config/environments/production.rb',
        'config.serve_static_files = false',
        "config.static_cache_control = 'public, max-age=#{1.years.ago.to_i}'"

      replace_in_file 'config/initializers/assets.rb',
        "config.assets.version = '1.0'",
        "config.assets.version = (ENV['ASSETS_VERSION'] || '1.0')"
    end

    def setup_annotate
      copy_file 'auto_annotate_models.rake', 'lib/tasks/auto_annotate_models.rake'
    end

{'fraction_non_alphanumeric': 0.09718920430708992, 'fraction_numerical': 0.0033561739616836807, 'mean_word_length': 3.093875214653692, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 9, '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': '1980315', 'n_tokens_mistral': 2351, 'n_tokens_neox': 2250, 'n_words': 395}