Skip to content

Add contribution guidelines and bin/setup #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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/
21 changes: 21 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -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;'")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you're using Postgres?

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")