<commit_before>paths = lambda { |path| File.expand_path("../#{path}", __FILE__) }

def cleanup(path)
  gsub_file path, /#.*\n/, "\n"
  gsub_file path, /\n^\s*\n/, "\n"
end

# Commit all changes with given message.
#
# The commit operation will attempt to sign the commit using your GPG key. This
# needs to be configured as `user.signingkey=<KEY_ID>` in your git config.
def commit_all(message)
  git add: '.'
  git commit: %(-S -aqm "#{message}")
end

git :init

%w(
  README
  README.rdoc
  app/assets/images/rails.png
  app/views/layouts/application.html.erb
  doc/README_FOR_APP
  public/index.html
  test
).each { |path| remove_file path }

commit_all 'Initial commit'

application <<-RUBY

    config.generators do |g|
      g.test_framework :rspec, routing_specs: false, views: false
    end
RUBY

commit_all 'Configure RSpec generators'

append_to_file 'Rakefile', <<RUBY
task(:default).clear
task :default => [:spec, :cucumber]
RUBY

commit_all 'Setup default rake task'

directory paths['templates'], destination_root
apply paths['recipes/gems.rb']
apply paths['recipes/pg_config.rb']

commit_all 'Install & configure gems'

%w(
  Gemfile
  config/application.rb
  config/environments/development.rb
  config/environments/test.rb
  config/environments/production.rb
).each { |path| cleanup path }

commit_all 'Cleanup generated files'<commit_msg>Run `bundle install` manually<commit_after># Prevent automatic bundle install by Rails app generator
def run_bundle; end

paths = lambda { |path| File.expand_path("../#{path}", __FILE__) }

def cleanup(path)
  gsub_file path, /#.*\n/, "\n"
  gsub_file path, /\n^\s*\n/, "\n"
end

# Commit all changes with given message.
#
# The commit operation will attempt to sign the commit using your GPG key. This
# needs to be configured as `user.signingkey=<KEY_ID>` in your git config.
def commit_all(message)
  git add: '.'
  git commit: %(-S -aqm "#{message}")
end

git :init

%w(
  README
  README.rdoc
  app/assets/images/rails.png
  app/views/layouts/application.html.erb
  doc/README_FOR_APP
  public/index.html
  test
).each { |path| remove_file path }

commit_all 'Initial commit'

application <<-RUBY

    config.generators do |g|
      g.test_framework :rspec, routing_specs: false, views: false
    end
RUBY

commit_all 'Configure RSpec generators'

append_to_file 'Rakefile', <<RUBY
task(:default).clear
task :default => [:spec, :cucumber]
RUBY

commit_all 'Setup default rake task'

directory paths['templates'], destination_root
apply paths['recipes/gems.rb']
apply paths['recipes/pg_config.rb']

run 'bundle install --quiet'

commit_all 'Install & configure gems'

%w(
  Gemfile
  config/application.rb
  config/environments/development.rb
  config/environments/test.rb
  config/environments/production.rb
).each { |path| cleanup path }

commit_all 'Cleanup generated files'
{'fraction_non_alphanumeric': 0.12477969686288333, 'fraction_numerical': 0.0, 'mean_word_length': 4.2555555555555555, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, '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': '2685607', 'n_tokens_mistral': 994, 'n_tokens_neox': 968, 'n_words': 276}