diff --git a/.gitignore b/.gitignore index 6a502e9..caf2d1d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ # Ignore bundler config. /.bundle +# Ignore installed gems. +/vendor/gems/ + # Ignore the default SQLite database. /db/*.sqlite3 /db/*.sqlite3-journal @@ -14,3 +17,6 @@ # Ignore all logfiles and tempfiles. /log/*.log /tmp + +# Ignore local configuration. +.env diff --git a/Gemfile b/Gemfile index d625f1d..d2728a1 100644 --- a/Gemfile +++ b/Gemfile @@ -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] diff --git a/Gemfile.lock b/Gemfile.lock index 4c9c0df..10bc728 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -112,6 +115,7 @@ PLATFORMS DEPENDENCIES activerecord-session_store coffee-rails (~> 4.0.0) + dotenv-rails jbuilder (~> 1.2) jquery-rails pg diff --git a/README.md b/README.md new file mode 100644 index 0000000..dcab0a4 --- /dev/null +++ b/README.md @@ -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 diff --git a/README.rdoc b/README.rdoc deleted file mode 100644 index 578f7fa..0000000 --- a/README.rdoc +++ /dev/null @@ -1,5 +0,0 @@ -== CoderDojoSV 2.0 Beta - -The re-make of coderdojosv.com written in Rails instead of Flask. - -There's also a new design, and we're working on a users system. diff --git a/docs/development.md b/docs/development.md new file mode 100644 index 0000000..51c1500 --- /dev/null +++ b/docs/development.md @@ -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 diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 0000000..0f3a938 --- /dev/null +++ b/script/bootstrap @@ -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!" + + + + +