diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..423e8bb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# Contribution Guidelines + +## Development Setup + +Run `bin/setup` to install development and testing dependencies with +Bundler and create the necessary local databases. + +You will need mysql and PostgreSQL installed on your local machine for +Bundler to properly install and for the database to be created. + +If you're using macOS you can easily install both mysql and Postgres +with [Homebrew][1]: + +`brew install mysql postgresql` + +Please pay close attention to the post-installation instructions given +to you by Homebrew since `bundle install` will not succeed until you +properly configure bundler to look for the appropriate build flags for +MySQL. + +[1]: https://brew.sh/ diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..ce63261 --- /dev/null +++ b/bin/setup @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +puts "Installing development dependencies..." +system!("bundle install") + +puts "Creating local databases for tests..." + +if ARGV.include?("--mysql-user") + mysql_user = "-u #{ARGV[ARGV.index("--mysql-user").next]}" +end + +system!("mysql #{mysql_user} -e 'CREATE DATABASE IF NOT EXISTS sequel_rails_test;'") +system!("mysql #{mysql_user} -e 'CREATE DATABASE IF NOT EXISTS sequel_rails_test_mysql2;'") +system!("mysql #{mysql_user} -e 'CREATE DATABASE IF NOT EXISTS sequel_rails_test_storage_dev;'") +system!("createdb sequel_rails_test_storage_dev") +system!("createdb sequel_rails_test") +