|
#add guard-minitest and spring to dev |
|
gem_group :development do |
|
gem 'guard-minitest' |
|
gem 'spring' |
|
end |
|
|
|
gem_group :test do |
|
gem 'minitest-rails-capybara' |
|
end |
|
|
|
run "bundle install" |
|
|
|
#install minitest test_helper |
|
generate('mini_test:install') |
|
|
|
#config minitest Spec DSL and Fixtures defaults |
|
environment "config.generators do |g|\n g.test_framework :mini_test, spec: true, fixture: true\n end" |
|
|
|
#uncomment minitest-rails-capybara and pride in test_helper |
|
# sed -i in osx needs to have a file explicitly named as backup |
|
# hence the blank '' |
|
|
|
run "sed -i '' '8 s/^ *# //' test/test_helper.rb" |
|
run "sed -i '' '11 s/^ *# //' test/test_helper.rb" |
|
|
|
#create postgres DB for postgress.app / Adds default user to username for |
|
#development and test |
|
run "psql -c 'CREATE DATABASE #{app_path}_development;'" |
|
run "psql -c 'CREATE DATABASE #{app_path}_test;'" |
|
run "sed -i '' '1,54 s/username: #{app_path}/username: #{ENV['USER']}/' config/database.yml" |
|
|
|
#Add minitest features to Rake task |
|
run %q^echo 'MiniTest::Rails::Testing.default_tasks << "features"' >> Rakefile^ |
|
|
|
#install guard-minitest |
|
run "bundel exec guard init minitest" |
|
|
|
#uncomment and comment Guardfile / Add spring: 'rake test' to file |
|
run "sed -i '' '6,8 s/^/#/' Guardfile" |
|
run "sed -i '' '14,20 s/^ *#//' Guardfile" |
|
run "sed -i '' '11,13 s/^ *#//' Guardfile" |
|
run %Q{sed -i '' "s/^guard :minitest do/guard :minitest, spring: 'rake test' do/" Guardfile} |
|
|
|
#Add spring to bins and start spring |
|
run 'spring binstub --all' |
|
|
|
#Fix README.md |
|
run "rm README.rdoc" |
|
run "touch README.md" |
|
|
|
#Initialize local Git repository and Initial Commit |
|
git :init |
|
git add: "." |
|
git commit: "-a -m 'Initial commit'" |
|
|
|
#Create remote repo on Github and push |
|
run "curl -u '#{ENV['USER']}' https://api.github.com/user/repos -d '{\"name\":\"#{app_path}\"}'" |
|
git remote: "add origin [email protected]:#{ENV['USER']}/#{app_path}.git" |
|
git push: "origin master" |
|
|
|
#TODO |
|
#add custom error pages |
|
#continue to add gems and config the |