<commit_before>require "minimum/omniauth/scaffold/version"
require 'rails/generators'
require 'rails_config'
require 'omniauth-twitter'
require 'omniauth-facebook'
require 'omniauth-github'
require 'tapp'
require 'awesome_print'

module Minimum
  module Omniauth
    class ScaffoldGenerator < Rails::Generators::Base
      @@template_path = source_root File.expand_path( "../scaffold/templates", __FILE__ )

      def generate_scaffold
        app_name = Rails.application.class.name.split('::').first

        # ----- rails_config ----- #
        copy_file( "#{@@template_path}/rails_config/rails_config.rb", "config/initializers/rails_config.rb" )
        copy_file( "#{@@template_path}/rails_config/settings.yml", "config/settings.yml" )
        copy_file( "#{@@template_path}/rails_config/settings.local.yml", "config/settings.local.yml" )
        copy_file( "#{@@template_path}/rails_config/development.yml", "config/settings/development.yml" )
        copy_file( "#{@@template_path}/rails_config/production.yml", "config/settings/production.yml" )
        copy_file( "#{@@template_path}/rails_config/test.yml", "config/settings/test.yml" )

        # ----- omniauth ----- #
        copy_file( "#{@@template_path}/initializers/omniauth.rb", "config/initializers/omniauth.rb" )

        # ----- routes.rb ----- #
        content = "\n  # For OmniAuth\n"
        content += "  get \"/auth/:provider/callback\" => \"sessions#callback\"\n"
        content += "  get \"/auth/failure\"            => \"sessions#failure\"\n"
        content += "  get \"/logout\"                  => \"sessions#destroy\", as: :logout\n"
        content += "\n"
        insert_into_file( "config/routes.rb", content.force_encoding('ASCII-8BIT'), after: "Application.routes.draw do\n" )
        insert_into_file( "config/routes.rb", "  root to: 'top#index'\n", after: "Application.routes.draw do\n" )

        # ----- application.rb ----- #
        content = "    config.time_zone = 'Tokyo'\n"
#        content += "    config.active_record.default_timezone = :local\n"
        insert_into_file( "config/application.rb", content.force_encoding('ASCII-8BIT'), after: "# config.time_zone = 'Central Time (US & Canada)'\n" )
        insert_into_file( "config/application.rb", "    config.i18n.default_locale     = :ja\nI18n.enforce_available_locales = true\n", after: "# config.i18n.default_locale = :de\n" )
#        content = "    # For Heroku\n"
#        content += "    config.assets.initialize_on_precompile = false\n"
        content = "    # For Tapp\n"
        content += "    Tapp.config.default_printer = :awesome_print\n"
        content += "\n"<commit_msg>Update scaffold.rb<commit_after>require "minimum/omniauth/scaffold/version"
require 'rails/generators'
require 'rails_config'
require 'omniauth-twitter'
require 'omniauth-facebook'
require 'omniauth-github'
require 'tapp'
require 'awesome_print'

module Minimum
  module Omniauth
    class ScaffoldGenerator < Rails::Generators::Base
      @@template_path = source_root File.expand_path( "../scaffold/templates", __FILE__ )

      def generate_scaffold
        app_name = Rails.application.class.name.split('::').first

        # ----- rails_config ----- #
        copy_file( "#{@@template_path}/rails_config/rails_config.rb", "config/initializers/rails_config.rb" )
        copy_file( "#{@@template_path}/rails_config/settings.yml", "config/settings.yml" )
        copy_file( "#{@@template_path}/rails_config/settings.local.yml", "config/settings.local.yml" )
        copy_file( "#{@@template_path}/rails_config/development.yml", "config/settings/development.yml" )
        copy_file( "#{@@template_path}/rails_config/production.yml", "config/settings/production.yml" )
        copy_file( "#{@@template_path}/rails_config/test.yml", "config/settings/test.yml" )

        # ----- omniauth ----- #
        copy_file( "#{@@template_path}/initializers/omniauth.rb", "config/initializers/omniauth.rb" )

        # ----- routes.rb ----- #
        content = "\n  # For OmniAuth\n"
        content += "  get \"/auth/:provider/callback\" => \"sessions#callback\"\n"
        content += "  get \"/auth/failure\"            => \"sessions#failure\"\n"
        content += "  get \"/logout\"                  => \"sessions#destroy\", as: :logout\n"
        content += "\n"
        insert_into_file( "config/routes.rb", content.force_encoding('ASCII-8BIT'), after: "Rails.application.routes.draw do\n" )
        insert_into_file( "config/routes.rb", "  root to: 'top#index'\n", after: "Rails.application.routes.draw do\n" )

        # ----- application.rb ----- #
        content = "    config.time_zone = 'Tokyo'\n"
#        content += "    config.active_record.default_timezone = :local\n"
        insert_into_file( "config/application.rb", content.force_encoding('ASCII-8BIT'), after: "# config.time_zone = 'Central Time (US & Canada)'\n" )
        insert_into_file( "config/application.rb", "    config.i18n.default_locale     = :ja\nI18n.enforce_available_locales = true\n", after: "# config.i18n.default_locale = :de\n" )
#        content = "    # For Heroku\n"
#        content += "    config.assets.initialize_on_precompile = false\n"
        content = "    # For Tapp\n"
        content += "    Tapp.config.default_printer = :awesome_print\n"
        content += "\n"
{'fraction_non_alphanumeric': 0.16914953799736, 'fraction_numerical': 0.003017160098057703, 'mean_word_length': 2.9318013343217197, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6416504', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1673, 'n_words': 256}