This repo is the open source project for the code curious app that aims to help the code curious orga team to organize their events by making the attendees, coaches and volunteers applications and/or participation more manageable.
- Ruby '~> 2.6.5'
- Bundler
- Ruby on Rails '~> 5.2.x'
- PostgreSQL '~> 9.5.x'
- Clone the repo (
git clone <repo-url>
) - Change into the project directory (
cd cc-app
) - Run
bundle install
. This can fail for a number of reasons. See below for some troubleshooting. - Run
(bundle exec) rake db:create
. This will create the databases fordevelopment
andtest
by default. - Install imagemagick (e.g.
brew install imagemagick
) - Run
(bundle exec) rails server
. This will start the application in development mode. - Go to
http://localhost:3000/
in your browser. You should see a welcome screen saying “Yay! You're on Rails”
For the production database we use Postgres
- make sure it is installed, configured and always running.
The easiest way is to use Postgres.app. Don't forget to setup the CLI tools.
In Debian/Ubuntu you'll need the postgresql
and libpq-dev
packages.
TODO
List all available rake tasks of this project:
# List all rake tasks
$ (bundle exec) rake -T
# Filter rake tasks related to the database
$ (bundle exec) rake -T | grep "db"
We already have a database structure file here, just load it into your freshly created development
database and migrate to be synced with the current project status:
# Loads a schema.rb file into the database
$ (bundle exec) rake db:schema:load
# Migrate the database
$ (bundle exec) rake db:migrate
# Display status of migrations
$ (bundle exec) rake db:migrate:status
Tip: You may take a look at the short cut $ (bundle exec) rake db:setup
in the rake tasks list.
Start up the server, go to http://localhost:3000/sign_up
and sign up as a new user. Then log into the rails console and assign yourself as an admin in order to create a new event.
# Log into the console
$ (bundle exec) rails c
# List all users
>> users = User.all
# Find your user account
>> user = User.find_by(email: 'your_email@email.de')
# Assign yourself as an admin
>> user.admin = true
# Check if your last commmand worked
>> user.admin?
# => true
Since the database is initially empty, you may encounter an error similar to the one below.
ERROR:
ActiveRecord::RecordNotFound in ApplicationsController#new \
Couldn't find Event with 'id'=1
Execute following in the rails console:
# List all events
>> events = Event.all
# Event Load (0.7ms) SELECT "events".* FROM "events"
# => #<ActiveRecord::Relation []>
# Create your first example event with a bang ("!") that validates your input immediately
>> event = Event.create!(name: "Beginners WS 2017", place: "Travis", scheduled_at: "2017-10-31", application_start: "2017-10-02", application_end: "2017-10-20", confirmation_date: "2017-10-25")
# => #<Event id: 1, name: "Beginners WS 2017", place: "Travis", scheduled_at: "2017-10-31 00:00:00", created_at: "2017-10-02 00:00:00", updated_at: "2017-10-02 00:00:00", application_start: "2017-10-02 00:00:00", application_end: "2017-10-20 00:00:00", confirmation_date: "2017-10-25 00:00:00">
# List all events
>> events = Event.all
# Event Load (0.4ms) SELECT "events".* FROM "events"
# => #<ActiveRecord::Relation [#<Event id: 1, name: "Beginners WS 2017", place: "Travis", scheduled_at: "2017-10-31 00:00:00", created_at: "2017-10-03 12:55:54", updated_at: "2017-10-03 12:55:54", application_start: "2017-10-02 00:00:00", application_end: "2017-10-20 00:00:00", confirmation_date: "2017-10-25 00:00:00">]>
Now start up the server with $ (bundle exec) rails s
again and go to:
http://localhost:3000/events/1/applications/new
The current production URL start page can be found here (this may change in the future): http://workshops.codecurious.org
Attention: You would need access to the production database and heroku app for production deployment. Ask the maintainers of this repository for the credentials.
Shell prompt
Dependent on your shell the prompt symbol may be different than $
, e.g. % (bundle exec) rake -T
.
Specifying environment
When not specifying any environment (e.g. RAILS_ENV=development
), then you will execute all your commands in development mode by default.
Server restart
If you don't see any changes, e.g. after a migration, consider to restart the server and check again.
Cloning the repo fails with some message about SSH keys
Use the https
url instead. There is a link to get it under the GitHub “clone or download” menu.
Installing gem pg
fails
TODO
Running rake fails
You may see following error sometimes:
Gem::LoadError: You have already activated rb-readline 0.5.5, but your Gemfile requires rb-readline 0.5.4. Prepending `bundle exec` to your command may solve this.`.
If this is the case try $ bundle update
and then run $ bundle exec rake -T
instead of rake -T
.
- Make sure you have Heroku set up as a remote. If not enter
git remote add heroku https://git.heroku.com/rgbworkshopapplication.git
. - Checkout
master
branch. - Pull the latest changes.
- Push to Heroku using
git push heroku master
. - If necessary, run migrations using
heroku run rails db:migrate
.
Welcome! We're happy that you will help us improve our app. Please let us know, if you have any questions.
Choose or open an issue
If you want to contribute, feel free to assign yourself to an existing issue or open a new one.
Create your own branch
- Clone the repository.
git checkout -b <your-name>-<feature-name>
to a new branch in your local repository.- Make your changes.
git commit -m
'Add commit message'git push
to push your new branch to your GitHub repository.
When you have made your changes and tested them, please send us a pull request for review.