<commit_before># -*- coding: utf-8 -*-
# frozen_string_literal: true

DEFAULT_PORT = 4000
RAILS_I18N_VERSION = '5.0.0'

require_relative 'util'

git :init
git_commit 'Initial commit'
bundle_install
git_commit '`bundle install`'

gsub_file 'Gemfile', /\n{3,}/, "\n\n"
create_file '.ruby-version', "#{RUBY_VERSION}\n"
insert_into_file 'Gemfile', "ruby File.read('.ruby-version')\n", after: "source 'https://rubygems.org'\n"
git_commit 'Add .ruby-version'

comment_lines 'Gemfile', /jbuilder/
git_commit 'Comment out jbuilder gem'

gsub_file 'Gemfile', /gem 'sqlite3'/, "gem 'sqlite3', group: [:development, :test]\ngem 'pg', group: :postgresql"
git_commit 'Use pg gem'

gem_bundle 'rails-i18n', "~> #{RAILS_I18N_VERSION}"
initializer 'default_locale.rb', <<-RUBY
I18n.enforce_available_locales = true
Rails.application.config.i18n.available_locales = %i[en ja]
Rails.application.config.i18n.default_locale = 'ja'
RUBY
git_commit 'Set default locale'

if false
  # does not work?
  initializer 'time_zone.rb', <<-RUBY<commit_msg>Use RUBY_VERSION directly instead of read .ruby-version<commit_after># -*- coding: utf-8 -*-
# frozen_string_literal: true

DEFAULT_PORT = 4000
RAILS_I18N_VERSION = '5.0.0'

require_relative 'util'

git :init
git_commit 'Initial commit'
bundle_install
git_commit '`bundle install`'

gsub_file 'Gemfile', /\n{3,}/, "\n\n"
create_file '.ruby-version', "#{RUBY_VERSION}\n"
insert_into_file 'Gemfile', "ruby '#{RUBY_VERSION}'\n", after: "source 'https://rubygems.org'\n"
git_commit 'Add .ruby-version'

comment_lines 'Gemfile', /jbuilder/
git_commit 'Comment out jbuilder gem'

gsub_file 'Gemfile', /gem 'sqlite3'/, "gem 'sqlite3', group: [:development, :test]\ngem 'pg', group: :postgresql"
git_commit 'Use pg gem'

gem_bundle 'rails-i18n', "~> #{RAILS_I18N_VERSION}"
initializer 'default_locale.rb', <<-RUBY
I18n.enforce_available_locales = true
Rails.application.config.i18n.available_locales = %i[en ja]
Rails.application.config.i18n.default_locale = 'ja'
RUBY
git_commit 'Set default locale'

if false
  # does not work?
  initializer 'time_zone.rb', <<-RUBY
{'fraction_non_alphanumeric': 0.1553956834532374, 'fraction_numerical': 0.022062350119904078, 'mean_word_length': 5.7290322580645165, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '306462', 'n_tokens_mistral': 838, 'n_tokens_neox': 790, 'n_words': 179}