Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
Release 0.3.0 (#10)
Browse files Browse the repository at this point in the history
Update to ruby 2.6.0 and latest gems
Fix JSON endpoints
Add RSS feed
Add quote count ticker
Add support for database migrations from all major PHP Rash versions
Add coveralls code test coverage check
Add discord chat bots
Add Dockerfile and docker-compose support
Deploy from docker on heroku
  • Loading branch information
bplunkert committed Jan 13, 2019
1 parent 72bd722 commit ffa4b09
Show file tree
Hide file tree
Showing 46 changed files with 721 additions and 103 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@

# Ignore master key for decrypting credentials and more.
/config/master.key

# Ignore code test coverage data
coverage
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.1
2.6.0
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
language: ruby
cache:
bundler: true
bundler: true
directories:
- /home/travis/.rvm/

install:
- bundle install --path vendor/bundle
- "/home/travis/.rvm/"
script:
- bundle exec rake
- bundle exec rake test
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ruby:2.6
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /rqdb
WORKDIR /rqdb
COPY Gemfile /rqdb/Gemfile
COPY Gemfile.lock /rqdb/Gemfile.lock
RUN bundle install
COPY . /rqdb

# Add a script to be executed every time the container starts.
COPY docker_entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/docker_entrypoint.sh
ENTRYPOINT ["docker_entrypoint.sh"]
EXPOSE 3000

# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]
8 changes: 7 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'
ruby '2.6.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
Expand Down Expand Up @@ -62,6 +62,9 @@ group :test do
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
gem 'w3c_validators'
gem 'json-schema'
gem 'coveralls', require: false
end

group :legacy_migration, optional: true do
Expand All @@ -81,3 +84,6 @@ gem 'kaminari'

# Use devise gem for authentication
gem 'devise'

# Gems for chat bots
gem 'discordrb'
70 changes: 65 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,40 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.4)
coveralls (0.7.1)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
crass (1.0.4)
devise (4.5.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
discordrb (3.3.0)
discordrb-webhooks (~> 3.3.0)
ffi (>= 1.9.24)
opus-ruby
rbnacl (~> 3.4.0)
rest-client (>= 2.1.0.rc1)
websocket-client-simple (>= 0.3.0)
discordrb-webhooks (3.3.0)
rest-client (>= 2.1.0.rc1)
docile (1.3.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
erubi (1.8.0)
event_emitter (0.2.6)
execjs (2.7.0)
ffi (1.9.25)
globalid (0.4.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.5.1)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
Expand All @@ -103,6 +125,9 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.1.0)
json-schema (2.8.1)
addressable (>= 2.4)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
Expand All @@ -127,18 +152,24 @@ GEM
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mimemagic (0.3.3)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.11.3)
msgpack (1.2.4)
msgpack (1.2.6)
multi_json (1.13.1)
mysql2 (0.5.2)
netrc (0.11.0)
nio4r (2.3.1)
nokogiri (1.10.0)
mini_portile2 (~> 2.4.0)
opus-ruby (1.0.1)
ffi
orm_adapter (0.5.0)
pg (1.1.3)
pg (1.1.4)
popper_js (1.14.5)
public_suffix (3.0.3)
puma (3.12.0)
Expand Down Expand Up @@ -173,10 +204,17 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rbnacl (3.4.0)
ffi
regexp_parser (1.3.0)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
rest-client (2.1.0.rc1)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
ruby_dep (1.5.0)
rubyzip (1.2.2)
sass (3.7.3)
Expand All @@ -202,6 +240,11 @@ GEM
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
Expand All @@ -215,23 +258,36 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
term-ansicolor (1.7.0)
tins (~> 1.0)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tins (1.20.2)
turbolinks (5.2.0)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
w3c_validators (1.3.4)
json (>= 1.8)
nokogiri (~> 1.6)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket (1.2.8)
websocket-client-simple (0.3.0)
event_emitter
websocket
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand All @@ -249,9 +305,12 @@ DEPENDENCIES
capybara (>= 2.15, < 4.0)
chromedriver-helper
coffee-rails (~> 4.2)
coveralls
devise
discordrb
jbuilder (~> 2.5)
jquery-rails
json-schema
kaminari
listen (>= 3.0.5, < 3.2)
mysql2
Expand All @@ -266,10 +325,11 @@ DEPENDENCIES
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
w3c_validators
web-console (>= 3.3.0)

RUBY VERSION
ruby 2.5.1p57
ruby 2.6.0p0

BUNDLED WITH
1.16.6
1.17.2
72 changes: 59 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,82 @@
# RQDB: Rash Quote Database
[![Build Status](https://travis-ci.org/bplunkert/rqdb.svg?branch=development)](https://travis-ci.org/bplunkert/rqdb)
[![Heroku Status](https://heroku-badge.herokuapp.com/?app=rqdb)](https://rqdb.herokuapp.com)
[![Coverage Status](https://coveralls.io/repos/github/bplunkert/rqdb/badge.svg?branch=development)](https://coveralls.io/github/bplunkert/rqdb?branch=development)

## Introduction:
Rash/Rails Quote Database is a simple web application for publishing, sharing, and ranking quotes. It's a ground-up rebuild of the [Rash Quote Management System (RQMS)](http://rqms.sourceforge.net), originally written in PHP by Tom Cuchta. RQDB is written in Ruby on Rails instead of PHP and does not share any common code with the original version.

## Installation
### Depedendencies:
Install [RVM](https://rvm.io) and Ruby 2.5.1:
* ```curl -sSL https://rvm.io/mpapis.asc | gpg --import -```
* ```curl -sSL https://get.rvm.io | bash -s stable --ruby=2.5.1```
Install [RVM](https://rvm.io) and Ruby 2.6.0:
```
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby=2.6.0
```

Install bundled ruby gems:
* ```bundle install```
* Note: if bundle install fails due to postgres errors, you can safely skip this for development and testing by running: ```bundle install --without production```
```
bundle install
```

### Main Installation:
* ```bundle exec rake db:migrate```
* ```bundle exec rake db:seed```
```
bundle exec rake db:migrate && bundle exec rake db:seed
```

### Migration from older PHP versions of Rash:
This step will connect to a legacy Rash MySQL database and copy all existing data into the Currently only Rash 2.0 Beta version is supported. A MySQL client will be required. The example installs into the production database but set RAILS_ENV and other options as needed.
* ```bundle install --with legacy_migration```
* ```RAILS_ENV=production bundle exec rake legacy:migrate_database --host SERVER --username USERNAME --database DATABASE --password PASSWORD```
This task will copy data from legacy PHP versions of Rash into the new Rash/Rails database. Only legacy MySQL databases are supported, and a MySQL client is required. All database settings are automatically detected by reading a configuration file --configfile from the legacy Rash installation.

This example installs into the production database, but set RAILS_ENV and other options as needed:
```
bundle install --with legacy_migration
RAILS_ENV=production bundle exec rake legacy:migrate_database --configfile CONFIGFILE
```

For more options, you can pass the --help flag:
```bundle exec rake legacy:migrate_database --help```
```
RAILS_ENV=production bundle exec rake legacy:migrate_database --help
```

When you're sure you are ready to run the migration, pass the --write flag:
```
RAILS_ENV=production bundle exec rake legacy:migrate_database --configfile CONFIGFILE```
```
### Start the service:
* ```bundle exec rails server```
```
bundle exec rails server
```
### Start the chatbots (if applicable):
```
bundle exec rake chatbot:all
```
### Login:
* Browse to http://localhost:3000
* Default username: admin@admin.admin
* Default password: password
* Default password: password
## Docker
### Build
Build the web and database images:
```
docker-compose build web
```
Build the chatbot image:
```
docker-compose build chatbot
```
### Run
Run the web and database containers:
```
docker-compose run web
```
Run the chatbot container:
```
docker-compose run chatbot
```
6 changes: 5 additions & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ a#admin_link:hover, a:hover, a:visited:hover{
color: #c08000;
}

#title, #versionbar {
#title, #versionbar, #tickerbar {
color: #FFFFFF;
background-color: #336699;
}

#tickerbar {
text-align: left;
}

#versionbar {
text-align: right;
}
Expand Down
1 change: 1 addition & 0 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ def flagged
def submitted
@quotes = Quote.where(approved: false).order(created_at: :asc).page(params[:page])
end

end
6 changes: 6 additions & 0 deletions app/controllers/announcements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ def index
@announcements = Announcement.order(created_at: :desc).page(params[:page])
end

# GET /announcements/1
# GET /announcements/1.json
def show
@announcements = [@announcement]
end

# GET /announcements/new
def new
@announcement = Announcement.new
Expand Down
Loading

0 comments on commit ffa4b09

Please sign in to comment.