Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2613a7d
Update factory-girl to factory-bot.
bagedevimo Feb 7, 2023
8c6fa93
Drop references the NZIC module, remove the NZIC models from the bundle
bagedevimo Feb 8, 2023
2ef2212
Drop most forem, replace with placeholder page to avoid dead lines
bagedevimo Feb 10, 2023
f0c0aae
Upgrade rmagick
bagedevimo Feb 7, 2023
9ec0816
Create rubyonrails.yml
bagedevimo Feb 7, 2023
f6f1e2a
Add a .tool-versions to configure the recommended Ruby version
bagedevimo Feb 7, 2023
a94ef74
Install the libmaxmind libraries
bagedevimo Feb 7, 2023
7d1d488
Fix invocations for schema:load & rspec runs
bagedevimo Feb 7, 2023
24cf854
Configure the databases for running in GitHub Actions
bagedevimo Feb 7, 2023
a63c882
Use 127.0.0.1 instead of localhost for specifiying DATABASE_URL
bagedevimo Feb 7, 2023
69198d0
Disable PostgreSQL gssencmode
bagedevimo Feb 7, 2023
482c96c
Use non-alpine postgresql images to avoid incompat issues between muslc
bagedevimo Feb 7, 2023
221eda6
fixup! Configure the databases for running in GitHub Actions
bagedevimo Feb 7, 2023
71041c3
Split the db:create and db:schema:load steps to help spot issues
bagedevimo Feb 7, 2023
f4d10d8
Add a redis server and config
bagedevimo Feb 7, 2023
037e902
Use ubuntu-18.04 instead of ubuntu-22.04
bagedevimo Feb 7, 2023
768dbe9
Try using more database config defaults specified earlier
bagedevimo Feb 7, 2023
a25bd23
Use a direct redis config variable - the redis.conf isn't read with e…
bagedevimo Feb 7, 2023
d6be9be
See if we can get further without doing db:create
bagedevimo Feb 7, 2023
271d3f6
Bump the ruby version in case it fixes the pg issues
bagedevimo Feb 10, 2023
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
72 changes: 72 additions & 0 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "Ruby on Rails CI"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
test:
runs-on: ubuntu-18.04
services:
redis:
image: redis:3
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:11
ports:
- "5432:5432"
env:
POSTGRES_DB: nztrain_test
POSTGRES_USER: rails
POSTGRES_PASSWORD: password
env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@127.0.0.1:5432/nztrain_test"
NZIC_DATABASE_URL: "postgres://rails:password@127.0.0.1:5432/nzic_test"
REDIS_HOST: redis
PGGSSENCMODE: "disable" # Workaround for https://www.postgresql.org/message-id/93f7379b-2e2f-db0c-980e-07ebd5de92ff%40crunchydata.com, remove after upgrading pg > 1.0
steps:
- name: Install libmaxmind
run: |
sudo add-apt-repository ppa:maxmind/ppa
sudo apt-get update
sudo apt-get install -y libmaxminddb0 libmaxminddb-dev mmdb-bin
- name: Checkout code
uses: actions/checkout@v3
# Add or replace dependency steps here
- name: Install Ruby and gems
uses: ruby/setup-ruby@ee2113536afb7f793eed4ce60e8d3b26db912da4 # v1.127.0
with:
bundler-cache: true
- name: Setup database schema
run: bundle exec rake db:schema:load
# Add or replace test runners here
- name: Run tests
run: bundle exec rspec

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@ee2113536afb7f793eed4ce60e8d3b26db912da4 # v1.127.0
with:
bundler-cache: true
# Add or replace any other lints here
# - name: Security audit dependencies
# run: bin/bundler-audit --update
# - name: Security audit application code
# run: bin/brakeman -q -w2
# - name: Lint Ruby files
# run: bin/rubocop --parallel
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 2.4.10
12 changes: 2 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'rails', '~> 4.0.0'

gem 'nzic_models', github: 'NZOI/nzic_models'
#gem 'nzic_models', path: '../../nzic/nzic_models'

gem 'devise', '~> 3.2.2'
gem 'psych', '~> 2.0.2' # part of stdlib, need newer version for safe_load

Expand All @@ -19,9 +16,6 @@ gem 'jquery-ui-rails', '4.0.5'
gem 'jquery-historyjs', '0.2.3'
gem 'superfish-rails', '~> 1.6.0'

gem 'forem', github: 'radar/forem', branch: 'rails4'
gem 'forem-redcarpet', github: 'NZOI/forem-redcarpet'

gem "nokogiri", '~> 1.10.8'
gem 'redcarpet'
#gem 'rmagick', '2.13.2'
Expand All @@ -40,7 +34,6 @@ gem 'simple_form', '3.0.1'
gem 'facebox-rails'
gem 'strong_presenter', '~> 0.2.2'
gem 'render_anywhere'
gem 'pygments.rb', '0.5.4'
gem 'ranked-model', :github => 'mixonic/ranked-model'
gem 'pdf-reader'
gem 'mechanize'
Expand All @@ -56,7 +49,7 @@ gem 'world-flags'
gem 'jquery-final_countdown-rails'
gem 'ruby-duration'

gem 'pg'
gem 'pg', '<1.0'
gem 'backup'

# Redis and Background Processing
Expand Down Expand Up @@ -89,10 +82,9 @@ group :development, :test do
gem 'capybara'
gem 'capybara-email'

gem 'factory_girl_rails'
gem 'factory_bot_rails'

gem 'byebug'
gem 'factory_girl'#, '~> 4.0'

gem 'ruby_parser' # for declarative_authorization
end
Expand Down
69 changes: 8 additions & 61 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,44 +1,10 @@
GIT
remote: https://github.com/NZOI/forem-redcarpet.git
revision: b9908439463723071d9f2f50290af84ca37042a4
specs:
forem-redcarpet (1.0.2)
nokogiri
pygments.rb (= 0.5.4)
redcarpet (~> 3.2.2)

GIT
remote: https://github.com/NZOI/nzic_models.git
revision: 0afa31e8bb8b045d12951a36032b15a768a3c868
specs:
nzic_models (0.0.2)
loofah
rails (~> 4.0)
redcarpet

GIT
remote: https://github.com/mixonic/ranked-model.git
revision: 5fd725bb07a331e0fb10ba3f1b0bee15dad8a47f
specs:
ranked-model (0.4.0)
activerecord (>= 3.1.12)

GIT
remote: https://github.com/radar/forem.git
revision: fb37858a51cfc8fe2ccd113e61af42546091fd27
branch: rails4
specs:
forem (1.0.0.beta1)
cancancan (~> 1.7)
decorators (~> 1.0.2)
friendly_id (~> 5.0.0)
gemoji (= 2.1.0)
rails (~> 4.0, != 4.2.3, != 4.2.2, != 4.2.1, != 4.2.0)
sanitize (= 2.0.6)
select2-rails (~> 3.5.4)
simple_form (~> 3.0)
workflow (= 1.0.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -92,7 +58,6 @@ GEM
debug_inspector (>= 0.0.1)
builder (3.1.4)
byebug (9.1.0)
cancancan (1.17.0)
capybara (2.17.0)
addressable
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -136,8 +101,6 @@ GEM
crass (1.0.5)
daemons (1.3.1)
debug_inspector (0.0.3)
decorators (1.0.5)
railties (>= 3.0.19)
devise (3.2.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand All @@ -155,19 +118,16 @@ GEM
facebox-rails (0.2.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
factory_girl (4.9.0)
factory_bot (4.11.1)
activesupport (>= 3.0.0)
factory_girl_rails (4.9.0)
factory_girl (~> 4.9.0)
factory_bot_rails (4.11.1)
factory_bot (~> 4.11.1)
railties (>= 3.0.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.12.2)
foreman (0.84.0)
thor (~> 0.19.1)
friendly_id (5.0.5)
activerecord (>= 4.0.0)
gemoji (2.1.0)
geocoder (1.4.5)
has_scope (0.6.0)
actionpack (>= 3.2, < 5)
Expand Down Expand Up @@ -240,19 +200,16 @@ GEM
ttfunk
pdfkit (0.8.2)
pg (0.21.0)
pkg-config (1.5.1)
polyamorous (1.1.0)
activerecord (>= 3.0)
posix-spawn (0.3.13)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
psych (2.0.17)
public_suffix (3.0.1)
pundit (0.2.1)
activesupport (>= 3.0.0)
pygments.rb (0.5.4)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
qless (0.12.0)
metriks (~> 0.9)
redis (>= 2.2, < 4.0.0.rc1)
Expand Down Expand Up @@ -293,7 +250,8 @@ GEM
render_anywhere (0.0.12)
rails (>= 3.0.7)
request_store (1.0.8)
rmagick (2.16.0)
rmagick (5.1.0)
pkg-config (~> 1.4)
rqrcode (0.10.1)
chunky_png (~> 1.0)
rspec-collection_matchers (1.1.3)
Expand All @@ -320,8 +278,6 @@ GEM
sexp_processor (~> 4.9)
rubyzip (1.3.0)
rusage (0.2.0)
sanitize (2.0.6)
nokogiri (>= 1.4.4)
sass (3.5.5)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
Expand All @@ -333,8 +289,6 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
select2-rails (3.5.10)
thor (~> 0.14)
sentry-raven (0.15.6)
faraday (>= 0.7.6)
sexp_processor (4.10.0)
Expand Down Expand Up @@ -406,13 +360,11 @@ GEM
whenever (0.10.0)
chronic (>= 0.6.3)
will_paginate (3.1.6)
workflow (1.0.0)
world-flags (0.6.5)
hashie (>= 1.2)
i18n (>= 0.6)
xpath (2.1.0)
nokogiri (~> 1.3)
yajl-ruby (1.1.0)
yui-compressor (0.12.0)

PLATFORMS
Expand All @@ -434,10 +386,7 @@ DEPENDENCIES
coveralls
devise (~> 3.2.2)
facebox-rails
factory_girl
factory_girl_rails
forem!
forem-redcarpet!
factory_bot_rails
foreman
geocoder
has_scope
Expand All @@ -451,14 +400,12 @@ DEPENDENCIES
mechanize
newrelic_rpm
nokogiri (~> 1.10.8)
nzic_models!
pdf-reader
pdfkit
pg
pg (< 1.0)
prawn
psych (~> 2.0.2)
pundit (= 0.2.1)
pygments.rb (= 0.5.4)
qless
rails (~> 4.0.0)
rake (< 11.0)
Expand Down
1 change: 0 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//= require history
//= require jquery.facebox
//= require jquery.facebox.adapter
//= require forem
//= require_self


Expand Down
2 changes: 0 additions & 2 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
*= require jquery.ui.datepicker
*= require jquery.ui.slider
*= require scaffold
*= require pygments
*= require code
*= require sample
*= require jquery.facebox
Expand All @@ -15,7 +14,6 @@
*= require messagebox
*= require message
*= require fontello
*= require forem/base
*= require forum
*= require flags/basic
*= require flags/flags24
Expand Down
8 changes: 2 additions & 6 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
class ApplicationController < ActionController::Base

def forem_user
current_user
end
helper_method :forem_user

include ApplicationHelper
include Pundit

layout "scaffold"

before_filter :update_last_seen_at
Expand All @@ -15,6 +10,7 @@ def forem_user
before_filter :check_su_loss
before_filter :wrong_site
before_filter :configure_permitted_parameters, if: :devise_controller?

protect_from_forgery

#helper ApplicationHelper
Expand Down
Loading