<commit_before>def source_paths
  Array(super) + [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]
end

RUBY_VERSION = "2.1.0"

git :init

remove_dir "test"

run "touch .ruby-version"
append_file ".ruby-version", RUBY_VERSION

remove_file "Gemfile"
template "root/Gemfile", "Gemfile"

inside 'config' do
  config = <<-RUBY
    config.generators do |generate|
      generate.helper false
      generate.request_specs false
      generate.routing_specs false
      generate.test_framework :rspec
      generate.view_specs false
    end

  RUBY
  inject_into_class 'application.rb', 'Application', config

  template 'database.yml', force: true
  template 'unicorn.rb'

  inside 'initializers' do
    file 'secret_token.rb', <<-RUBY
      #{@app_const}.config.secret_key_base = ENV['SECRET_TOKEN'] || "A" * 20
    RUBY
  end
end

inside 'app' do
  inside 'views' do
    inside 'layouts' do
      template 'application.html.erb', force: true
    end

    inside 'shared' do
      template '_flashes.html.erb'
    end
  end
end

# Generate .env files
db_user = ask("What is your DB_USER?")
db_pass = ask("What is your DB_PASS?")

file '.env.development', <<-TEXT
SECRET_TOKEN=#{ %x{ rake secret } }
DB_NAME=#{@app_name}_development
DB_USER=#{db_user}
DB_PASSWORD=#{db_<PASSWORD>}
TEXT

file '.env.test', <<-TEXT
SECRET_TOKEN=#{ %x{ rake secret } }
DB_NAME=#{@app_name}_test
DB_USER=#{db_user}
DB_PASSWORD=#{db_pass}
TEXT

generate "rspec:install"

inside 'spec' do
  remove_file 'spec_helper.rb'
  template 'spec_helper.rb'
  inside 'support' do
    template 'database_cleaner.rb'
    template 'factory_girl_rspec.rb'
  end
end

rake "db:create"
rake "db:migrate"

git add: "."
git commit: %Q{ -m 'Initial commit' }

run "cd #{@app_name}"<commit_msg>Create empty spec/features directory<commit_after>def source_paths
  Array(super) + [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]
end

RUBY_VERSION = "2.1.0"

git :init

remove_dir "test"

run "touch .ruby-version"
append_file ".ruby-version", RUBY_VERSION

remove_file "Gemfile"
template "root/Gemfile", "Gemfile"

inside 'config' do
  config = <<-RUBY
    config.generators do |generate|
      generate.helper false
      generate.request_specs false
      generate.routing_specs false
      generate.test_framework :rspec
      generate.view_specs false
    end

  RUBY
  inject_into_class 'application.rb', 'Application', config

  template 'database.yml', force: true
  template 'unicorn.rb'

  inside 'initializers' do
    file 'secret_token.rb', <<-RUBY
      #{@app_const}.config.secret_key_base = ENV['SECRET_TOKEN'] || "A" * 20
    RUBY
  end
end

inside 'app' do
  inside 'views' do
    inside 'layouts' do
      template 'application.html.erb', force: true
    end

    inside 'shared' do
      template '_flashes.html.erb'
    end
  end
end

# Generate .env files
db_user = ask("What is your DB_USER?")
db_pass = ask("What is your DB_PASS?")

file '.env.development', <<-TEXT
SECRET_TOKEN=#{ %x{ rake secret } }
DB_NAME=#{@app_name}_development
DB_USER=#{db_user}
DB_PASSWORD=#{<PASSWORD>}
TEXT

file '.env.test', <<-TEXT
SECRET_TOKEN=#{ %x{ rake secret } }
DB_NAME=#{@app_name}_test
DB_USER=#{db_user}
DB_PASSWORD=#{<PASSWORD>}
TEXT

generate "rspec:install"

inside 'spec' do
  remove_file 'spec_helper.rb'
  template 'spec_helper.rb'
  inside 'support' do
    template 'database_cleaner.rb'
    template 'factory_girl_rspec.rb'
  end
  empty_directory_with_keep_file 'features'
end

rake "db:create"
rake "db:migrate"

git add: "."
git commit: %Q{ -m 'Initial commit' }

run "cd #{@app_name}"
{'fraction_non_alphanumeric': 0.13060428849902533, 'fraction_numerical': 0.00278473962684489, 'mean_word_length': 4.138769670958512, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 6, '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': '2098884', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1316, 'n_words': 314}