Skip to content
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

Switch to using dotenv instead of yaml configuration files #5

Open
wants to merge 8 commits 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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
# Ignore bundler config.
/.bundle

# Ignore installed gems.
/vendor/gems/

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

# Ignore local configuration.
.env
48 changes: 7 additions & 41 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,12 @@
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'

gem 'activerecord-session_store'
gem 'coffee-rails', '~> 4.0.0'
gem 'dotenv-rails'
gem 'jbuilder', '~> 1.2'
gem 'jquery-rails'
gem 'pg'

# Use SCSS for stylesheets
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'sdoc', require: false, group: :doc
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

gem 'activerecord-session_store'


group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.6.3)
dotenv (0.9.0)
dotenv-rails (0.9.0)
dotenv (= 0.9.0)
erubis (2.7.0)
execjs (2.0.2)
hike (1.2.3)
Expand Down Expand Up @@ -112,6 +115,7 @@ PLATFORMS
DEPENDENCIES
activerecord-session_store
coffee-rails (~> 4.0.0)
dotenv-rails
jbuilder (~> 1.2)
jquery-rails
pg
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CoderDojoSV 2.0 Beta
====================

The re-make of coderdojosv.com written in [Ruby on Rails][] instead of
[Flask][].

There's also a new design, and we're working on a users system.

The primary maintainer of CoderDojoSV.com is [@iTweak0r][].

[Ruby on Rails]: http://rubyonrails.org
[Flask]: http://flask.pocoo.org/
[@iTweak0r]: https://github.com/iTweak0r
5 changes: 0 additions & 5 deletions README.rdoc

This file was deleted.

72 changes: 72 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Development

CoderDojoSV.com is written in the [Ruby][] programming language using the
[Ruby on Rails][Rails] web application framework. In order to add features or
fix bugs you will need to install Ruby version 2.0 or greater. Right now the
happy development path requires a Mac OS X, Linux, or BSD system but in the
future we hope to welcome our friends running Microsoft Windows as well.

The primary maintainer of CoderDojoSV.com is [@iTweak0r][].

## Prerequisite Dependencies

There are two pieces of software you need to install in advance. On Linux or
BSD these can be installed via your package manager. On Mac OS X they can be
installed via [Homebrew][]

- Ruby version 2.0 or greater
- PostgreSQL version 9.0 or greater
- A text editor such as [Brackets (recommended)][Brackets], [Sublime Text][], or
any [other plain text editor][editor list].

## Getting Started

To start working, use Git to clone the repository:

$ git clone https://github.com/CoderDojoSV/CoderDojoSV-2.0.git coderdojosv.com
$ cd coderdojosv.com

Then run the provided bootstrap script to get everything set up. If the script
fails in any way. [Open an issue][issue] to get help.

Once the bootstrap script has run the first time, you'll need to configure
your local development environment using the `.env` file.

## Configuration

Open the `.env` file in your :pencil: text editor. It should contain the
following variables in the format

export VARIABLE_NAME="variable value"

### `DATABASE_URL`: The url-formatted location of your database.

Format: postgres://*[user name]*:*[passphrase]*@*[host name]*/*[database name]*:*[port]*

- *user name*: the username of the database user Rails should connect as.
Can be blank and usually is.
- *passphrase*: The database passphrase used to authenticate the user. Can be
blank and usually is.
- *host name*: The host name of the computer running the database. Usually
`localhost`.
- *database name*: The name of the database on the server. Usually
`coderdojosv_development` for our purposes.
- *port*: The TCP port to use to connect to the database. Leave blank to use
the PostgreSQL default.

Example: `postgres://psqlTony:secretMonkeyFace77@localhost/coderdojosv_development:11988`.

Suggested value: `postgres://localhost/coderdojosv_development`

## Problems

If you have any issues setting up, [open an issue][issue]! We'll help you out.

[Ruby]: http://ruby-lang.org
[Rails]: http://rubyonrails.org
[Homebrew]: http://brew.sh/
[@iTweak0r]: https://github.com/iTweak0r
[issue]: https://github.com/CoderDojoSV/CoderDojoSV-2.0/issues/new
[Brackets]: http://brackets.io
[Sublime Text]: http://www.sublimetext.com/
[editor list]: https://en.wikipedia.org/wiki/List_of_text_editors#Free_software_2
60 changes: 60 additions & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh
APP_ROOT="`dirname $0`/.."

echo "Checking out your Ruby.."
which ruby > /dev/null
if [[ $? -ne 0 ]]; then
echo "Hey without Ruby we can't help you much. Install Ruby!"
exit 1
fi

echo "Checking out Bundler.."
which bundle > /dev/null
if [[ $? -ne 0 ]]; then
echo "You don't have bundler. It's cool though, I'm installing it for you."
gem install bundler || exit 1
fi

echo "Bundlin'.."
bundle install --local --path vendor/gems --without production || exit 1

if [[ -f "$APP_ROOT/.env" ]; then
cat <<-MESSAGE
You already have a .env file.

Make sure it contains all environment variables documented
in docs/development.md
See https://github.com/coderdojosv/CoderDojoSV-2.0/tree/master/docs/development.md
MESSAGE
else
cat <<-MESSAGE
You don't have a .env file yet. This script has just created
one for you. Make sure you check it and fill in all required
fields as documented in docs/development.md

See https://github.com/coderdojosv/CoderDojoSV-2.0/tree/master/docs/development.md
MESSAGE

cat <<-DOTENV > "$APP_ROOT/.env"
export DATABASE_URL=
DOTENV
fi

echo "Running unrun migrations"

rake db:migrate

if [[ $? -ne 0 ]]; then
echo "Looks like there's some trouble with the database"
echo "I'm trying to create a new one."
rake db:create || exit 2
rake db:migrate || exit 2
rake db:seed || exit 2
fi

echo "You're ready to start! Happy hacking!"