Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rubymonsters/rgbapp

This is an app that supports the work of the code curious organizers team
https://github.com/rubymonsters/rgbapp

Last synced: about 1 month ago
JSON representation

This is an app that supports the work of the code curious organizers team

Awesome Lists containing this project

README

        

# code curious application [![Build Status](https://travis-ci.org/rubymonsters/rgbapp.svg?branch=master)](https://travis-ci.org/rubymonsters/rgbapp)

## About

This repo is the open source project for the **code curious app** that aims to help the [code curious orga team](http://codecurious.org) to organize their events by making the attendees, coaches and volunteers applications and/or participation more manageable.

## Technical Requirements

- Ruby '~> 2.6.5'
- Bundler
- Ruby on Rails '~> 5.2.x'
- PostgreSQL '~> 9.5.x'

## How to set up

1. Clone the repo (`git clone `)
1. Change into the project directory (`cd cc-app`)
1. Run `bundle install`. This can fail for a number of reasons. See below for some troubleshooting.
1. Run `(bundle exec) rake db:create`. This will create the databases for `development` and `test` by default.
1. Install imagemagick (e.g. `brew install imagemagick`)
1. Run `(bundle exec) rails server`. This will start the application in development mode.
1. Go to [`http://localhost:3000/`](http://localhost:3000/) in your browser. You should see a welcome screen saying *“Yay! You're on Rails”*

## Database

### 1. Installation

For the production database we use `Postgres` - make sure it is installed, configured and always running.

#### Mac

The easiest way is to use [Postgres.app](http://postgresapp.com/). Don't forget to setup the [CLI tools](http://postgresapp.com/documentation/cli-tools.html).

#### Linux

In Debian/Ubuntu you'll need the `postgresql` and `libpq-dev` packages.

#### Windows

TODO

### 2. Migration

List all available rake tasks of this project:

```bash
# 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](https://github.com/rubymonsters/rgbapp/blob/master/db/schema.rb), just load it into your freshly created `development` database and migrate to be synced with the current project status:

```bash
# 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.

#### Important: Initial Data

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.

```bash
# Log into the console
$ (bundle exec) rails c

# List all users
>> users = User.all

# Find your user account
>> user = User.find_by(email: '[email protected]')

# 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:
```bash

# List all events
>> events = Event.all

# Event Load (0.7ms) SELECT "events".* FROM "events"
# => #

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

# => #

# List all events
>> events = Event.all

# Event Load (0.4ms) SELECT "events".* FROM "events"
# => #]>
```

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.**

## Good to know

**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.

## Troubleshooting

**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`.

## Deployment

1. Make sure you have Heroku set up as a remote. If not enter `git remote add heroku https://git.heroku.com/rgbworkshopapplication.git`.
1. Checkout `master` branch.
1. Pull the latest changes.
1. Push to Heroku using `git push heroku master`.
1. If necessary, run migrations using `heroku run rails db:migrate`.

## Contributing

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**

1. Clone the repository.
1. `git checkout -b -` to a new branch in your local repository.
1. Make your changes.
1. `git commit -m` 'Add commit message'
1. `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.