<commit_before>require 'rails/generators'
require 'rails/generators/rails/app/app_generator'

module Wired
  class AppGenerator < Rails::Generators::AppGenerator
    @@type = ""

    def finish_template
      invoke :wired_customization
      super
    end

    def wired_customization
      invoke :remove_files_we_dont_need
      invoke :customize_gemfile
      invoke :create_wired_views
      invoke :setup_database
      invoke :configure_app
      invoke :customize_error_pages
      invoke :remove_routes_comment_lines
      invoke :application_setup
      invoke :setup_git
      invoke :create_heroku_apps
      invoke :outro
      invoke :todo
    end

    def application_setup
      puts "app setup?"
      choices = ["facebook", "teaser"]
      type = ask "Applicationtype? (#{choices.join ', '})"
      if choices.include? type
        @@type = type
        case type
        when "facebook"
          say "Setting up a Facebook application"
          invoke :facebook_setup
        when "teaser"
          say "Setting up a teaser with email registration"
          #invoke :teaser_setup
        end
      else
        say "Applicationtype should be one of: #{choices.join ', '}"
        invoke :application_setup
      end
    end

    def facebook_setup
      if @@type == "facebook"
        build :create_facebook_apps
      end
    end

    def teaser_setup
      if @@type == "teaser"
        say "There's no teaser setup yet"
      end
    end

    def remove_files_we_dont_need
      build :remove_public_index
      build :remove_rails_logo_image
    end

    def customize_gemfile
      build :replace_gemfile
      build :set_ruby_to_version_being_used
      bundle_command 'install --binstubs=bin/stubs'
    end

    def create_wired_views
      say 'Creating views'
      build :create_partials_directory
      build :create_shared_flashes
      build :create_application_layout
    end

    def setup_database
      say 'Setting up database'
      build :setup_database_config
      build :create_database
    end

    def configure_app
      say 'Configuring app'
      build :configure_time_zone
      build :add_email_validator
    end

    def copy_miscellaneous_files
      build :copy_miscellaneous_files
    end

    def customize_error_pages
      say 'Customizing the 500/404/422 pages'
      build :customize_error_pages
    end

    def remove_routes_comment_lines
      build :remove_routes_comment_lines
    end

    def setup_git
      say 'Setting up git'
      build :gitignore_files
      #build :setup_git
    end

    def create_heroku_apps
      if options[:heroku]
        say 'Creating Heroku apps'
        #build :create_heroku_apps
      end
    end

    def outro
      say "     _  _  _  ___   ___  _    ___  ___ \n    | || || || - > | __>| |  / - \\| - >\n    |    || ||   \\ | __>| |_ | | || _ \\\n    |_/\\_||_||_|\\_\\|___>|___||_|_||___/\n"
    end

    def todo
      say "\n ------TODO------"
      case @@type
      when "facebook"
        say "* Create Facebook apps on https://developers.facebook.com"
        say "* Update FB_APP_ID env variables locally, on Heroku and in the readme"
      when "teaser"
        say "* Build entire app"
      end
    end

    def run_bundle
      # Let's not: We'll bundle manually at the right spot
    end

    protected

    def get_builder_class
      Wired::AppBuilder
    end
  end
end<commit_msg>removes accidental dev commit<commit_after>require 'rails/generators'
require 'rails/generators/rails/app/app_generator'

module Wired
  class AppGenerator < Rails::Generators::AppGenerator
    @@type = ""

    def finish_template
      invoke :wired_customization
      super
    end

    def wired_customization
      invoke :remove_files_we_dont_need
      invoke :customize_gemfile
      invoke :create_wired_views
      invoke :setup_database
      invoke :configure_app
      invoke :customize_error_pages
      invoke :remove_routes_comment_lines
      invoke :application_setup
      invoke :setup_git
      invoke :create_heroku_apps
      invoke :outro
      invoke :todo
    end

    def application_setup
      puts "app setup?"
      choices = ["facebook", "teaser"]
      type = ask "Applicationtype? (#{choices.join ', '})"
      if choices.include? type
        @@type = type
        case type
        when "facebook"
          say "Setting up a Facebook application"
          invoke :facebook_setup
        when "teaser"
          say "Setting up a teaser with email registration"
          #invoke :teaser_setup
        end
      else
        say "Applicationtype should be one of: #{choices.join ', '}"
        invoke :application_setup
      end
    end

    def facebook_setup
      if @@type == "facebook"
        build :create_facebook_apps
      end
    end

    def teaser_setup
      if @@type == "teaser"
        say "There's no teaser setup yet"
      end
    end

    def remove_files_we_dont_need
      build :remove_public_index
      build :remove_rails_logo_image
    end

    def customize_gemfile
      build :replace_gemfile
      build :set_ruby_to_version_being_used
      bundle_command 'install --binstubs=bin/stubs'
    end

    def create_wired_views
      say 'Creating views'
      build :create_partials_directory
      build :create_shared_flashes
      build :create_application_layout
    end

    def setup_database
      say 'Setting up database'
      build :setup_database_config
      build :create_database
    end

    def configure_app
      say 'Configuring app'
      build :configure_time_zone
      build :add_email_validator
    end

    def copy_miscellaneous_files
      build :copy_miscellaneous_files
    end

    def customize_error_pages
      say 'Customizing the 500/404/422 pages'
      build :customize_error_pages
    end

    def remove_routes_comment_lines
      build :remove_routes_comment_lines
    end

    def setup_git
      say 'Setting up git'
      build :gitignore_files
      build :setup_git
    end

    def create_heroku_apps
      if options[:heroku]
        say 'Creating Heroku apps'
        build :create_heroku_apps
      end
    end

    def outro
      say "     _  _  _  ___   ___  _    ___  ___ \n    | || || || - > | __>| |  / - \\| - >\n    |    || ||   \\ | __>| |_ | | || _ \\\n    |_/\\_||_||_|\\_\\|___>|___||_|_||___/\n"
    end

    def todo
      say "\n ------TODO------"
      case @@type
      when "facebook"
        say "* Create Facebook apps on https://developers.facebook.com"
        say "* Update FB_APP_ID env variables locally, on Heroku and in the readme"
      when "teaser"
        say "* Build entire app"
      end
    end

    def run_bundle
      # Let's not: We'll bundle manually at the right spot
    end

    protected

    def get_builder_class
      Wired::AppBuilder
    end
  end
end
{'fraction_non_alphanumeric': 0.07331378299120235, 'fraction_numerical': 0.0026392961876832845, 'mean_word_length': 2.1637291280148423, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3208090', 'n_tokens_mistral': 2112, 'n_tokens_neox': 2006, 'n_words': 550}