<commit_before># user.rb
inject_into_file "app/models/user.rb", before: 'end' do
<<-EOF

  # crosstie skeleton

  # ldap

  # username

  # authentication_token

  # authorization

EOF
end

# add username to users
inject_into_file "app/models/user.rb", after: "# username\n" do
<<-EOF
  alias_attribute :name, :username
EOF
end

generate "migration", "add_username_to_users", "username:string:index"
rake "db:migrate"

gsub_file "app/views/devise/sessions/new.html.erb", ":email", ":username"

[
  "app/views/devise/registrations/new.html.erb",
  "app/views/devise/registrations/edit.html.erb",
].each do |file|
  inject_into_file file, after: "<%= devise_error_messages! %>\n" do
<<-EOF
    <div class="form-group">
      <%= f.label :username %><commit_msg>fix user sign in form<commit_after># user.rb
inject_into_file "app/models/user.rb", before: 'end' do
<<-EOF

  # crosstie skeleton

  # ldap

  # username

  # authentication_token

  # authorization

EOF
end

# add username to users
inject_into_file "app/models/user.rb", after: "# username\n" do
<<-EOF
  alias_attribute :name, :username
EOF
end

generate "migration", "add_username_to_users", "username:string:index"
rake "db:migrate"

gsub_file "app/views/devise/sessions/new.html.erb", ":email", ":username"
gsub_file "app/views/devise/sessions/new.html.erb", "email_field", ":text_field"

[
  "app/views/devise/registrations/new.html.erb",
  "app/views/devise/registrations/edit.html.erb",
].each do |file|
  inject_into_file file, after: "<%= devise_error_messages! %>\n" do
<<-EOF
    <div class="form-group">
      <%= f.label :username %>
{'fraction_non_alphanumeric': 0.15743621655258244, 'fraction_numerical': 0.0, 'mean_word_length': 4.525773195876289, 'pattern_counts': {'":': 5, '<': 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': '6515082', 'n_tokens_mistral': 615, 'n_tokens_neox': 593, 'n_words': 122}