<commit_before>###############################
# Setup a tidier gemfile
###############################

gem 'sass-rails'
gem 'haml-rails'
gem 'therubyracer',  platforms: :ruby
gem 'uglifier'
gem 'rake-n-bake'

gem_group :development, :test do
  gem 'spring'
  gem 'pry-byebug'
  gem 'factory_girl_rails'
  gem 'faker'
  gem 'meta_request'
  gem 'web-console'
end

gem_group :test do
  gem 'rspec-rails'
  gem 'shoulda-matchers'
  gem 'database_cleaner'
  gem 'capybara'
  gem 'simplecov'
end

gem_group :development do
  gem 'coffee-rails-source-maps'
  gem "better_errors"
  gem "binding_of_caller"
  gem 'bullet'
  gem 'brakeman'
  gem 'bundler-audit'
  gem 'spring-commands-rspec'
  gem 'guard-bundler', require: false
  gem 'guard-rspec', require: false
  gem 'guard-rails', require: false
  gem 'guard-livereload', require: false
  gem 'erb2haml', require: false
  gem 'metric_fu', require: false
  gem 'rubocop', require: false
  gem 'sandi_meter', require: false
end

###############################
# Setup a better Rakefile
###############################

rakefile 'default.rake' do
  %Q{
require 'rake-n-bake'

task default: %i[
  bake:code_quality:all
  bake:rspec
  bake:coverage:check_specs
  bake:rails_best_practices
  bake:bundler_audit
  notes
  bake:ok_rainbow
]
}
end

###############################
# Setup a better Seeds file
###############################
remove_file 'db/seeds.rb'
create_file('db/seeds.rb') do
%q{
puts 'Loading seeds...'
Dir[File.join Rails.root, 'db', 'seeds', 'all', '*.rb'].each do |file|
  puts "  -> #{File.basename file}"
  require file
end

if Rails.env == 'development'
  puts 'Loading development seeds...'
  Dir[File.join Rails.root, 'db', 'seeds', 'development', '*.rb'].each do |file|
    puts "  -> #{File.basename file}"
    require file
  end
end
}
end

empty_directory 'db/seeds'
empty_directory 'db/seeds/all'
empty_directory 'db/seeds/development'

create_file 'db/seeds/all/example.rb' do
  %q{
# Create files in this directory to create your seed data .
# For example:
#   User.where(name: "Admin").first_or_create(name: "Admin", homepage: "http://devmountain.co.uk", role: :admin)
}
end

create_file 'db/seeds/development/example.rb', '# Create files in this directory to add seed data just for development. See db/seeds/all/example.rb for more.'

###############################
# Remove some default cruft
###############################

run "rm README.rdoc"
gsub_file 'Gemfile', /#.*\n/, ''

# So long, turbolinks
gsub_file 'Gemfile', /gem 'turbolinks.*\n/, ""
gsub_file 'app/assets/javascripts/application.js', /\/\/= require turbolinks.*\n/, ""
gsub_file 'app/views/layouts/application.html.erb', ", 'data-turbolinks-track' => true", ''

###############################
# Setup a more helpful Sass
###############################

create_file 'app/assets/stylesheets/reset.scss' do
%Q{*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: 16px;
}
}
end

create_file 'app/assets/stylesheets/variables.scss' do
%Q{$border-radius: 3px;
}
end

create_file 'app/assets/stylesheets/mixins.scss' do
%Q{@mixin border-radius($radius: $border-radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;
}
}
end

remove_file 'app/assets/stylesheets/application.css'
create_file 'app/assets/stylesheets/application.css.scss' do
%Q{@import "variables";
@import "reset";
@import "mixins";
@import "**/*";
}
end

###############################
# Setup some nice things
###############################

after_bundle do
  ###############################
  # Rspec
  ###############################<commit_msg>Remove SASS tree load to avoid double importing files<commit_after>###############################
# Setup a tidier gemfile
###############################

gem 'sass-rails'
gem 'haml-rails'
gem 'therubyracer',  platforms: :ruby
gem 'uglifier'
gem 'rake-n-bake'

gem_group :development, :test do
  gem 'spring'
  gem 'pry-byebug'
  gem 'factory_girl_rails'
  gem 'faker'
  gem 'meta_request'
  gem 'web-console'
end

gem_group :test do
  gem 'rspec-rails'
  gem 'shoulda-matchers'
  gem 'database_cleaner'
  gem 'capybara'
  gem 'simplecov'
end

gem_group :development do
  gem 'coffee-rails-source-maps'
  gem "better_errors"
  gem "binding_of_caller"
  gem 'bullet'
  gem 'brakeman'
  gem 'bundler-audit'
  gem 'spring-commands-rspec'
  gem 'guard-bundler', require: false
  gem 'guard-rspec', require: false
  gem 'guard-rails', require: false
  gem 'guard-livereload', require: false
  gem 'erb2haml', require: false
  gem 'metric_fu', require: false
  gem 'rubocop', require: false
  gem 'sandi_meter', require: false
end

###############################
# Setup a better Rakefile
###############################

rakefile 'default.rake' do
  %Q{
require 'rake-n-bake'

task default: %i[
  bake:code_quality:all
  bake:rspec
  bake:coverage:check_specs
  bake:rails_best_practices
  bake:bundler_audit
  notes
  bake:ok_rainbow
]
}
end

###############################
# Setup a better Seeds file
###############################
remove_file 'db/seeds.rb'
create_file('db/seeds.rb') do
%q{
puts 'Loading seeds...'
Dir[File.join Rails.root, 'db', 'seeds', 'all', '*.rb'].each do |file|
  puts "  -> #{File.basename file}"
  require file
end

if Rails.env == 'development'
  puts 'Loading development seeds...'
  Dir[File.join Rails.root, 'db', 'seeds', 'development', '*.rb'].each do |file|
    puts "  -> #{File.basename file}"
    require file
  end
end
}
end

empty_directory 'db/seeds'
empty_directory 'db/seeds/all'
empty_directory 'db/seeds/development'

create_file 'db/seeds/all/example.rb' do
  %q{
# Create files in this directory to create your seed data .
# For example:
#   User.where(name: "Admin").first_or_create(name: "Admin", homepage: "http://devmountain.co.uk", role: :admin)
}
end

create_file 'db/seeds/development/example.rb', '# Create files in this directory to add seed data just for development. See db/seeds/all/example.rb for more.'

###############################
# Remove some default cruft
###############################

run "rm README.rdoc"
gsub_file 'Gemfile', /#.*\n/, ''

# So long, turbolinks
gsub_file 'Gemfile', /gem 'turbolinks.*\n/, ""
gsub_file 'app/assets/javascripts/application.js', /\/\/= require turbolinks.*\n/, ""
gsub_file 'app/views/layouts/application.html.erb', ", 'data-turbolinks-track' => true", ''

###############################
# Setup a more helpful Sass
###############################

create_file 'app/assets/stylesheets/reset.scss' do
%Q{*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: 16px;
}
}
end

create_file 'app/assets/stylesheets/variables.scss' do
%Q{$border-radius: 3px;
}
end

create_file 'app/assets/stylesheets/mixins.scss' do
%Q{@mixin border-radius($radius: $border-radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;
}
}
end

remove_file 'app/assets/stylesheets/application.css'
create_file 'app/assets/stylesheets/application.css.scss' do
%Q{@import "variables";
@import "reset";
@import "mixins";
}
end

###############################
# Setup some nice things
###############################

after_bundle do
  ###############################
  # Rspec
  ###############################
{'fraction_non_alphanumeric': 0.244426318651441, 'fraction_numerical': 0.0016313213703099511, 'mean_word_length': 4.738689547581903, 'pattern_counts': {'":': 0, '<': 3, '<?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': '561109', 'n_tokens_mistral': 2634, 'n_tokens_neox': 2570, 'n_words': 609}