Skip to content

Commit

Permalink
Update rails to 6.1.4:
Browse files Browse the repository at this point in the history
* Run the rails app:update command
* Run the rails webpacker:install command
* Use bootstrap from a CDN
* Make some configurations optional
* Move some configurations to ENV vars (this way we don't need to know how to set configurations using rails)
* Remove turbolinks and jbuilder gems
* Update load_defaults configuration to load 6.0
* Update gitignore
  • Loading branch information
dmitryrck committed Jul 15, 2021
1 parent f548fae commit 0511b08
Show file tree
Hide file tree
Showing 56 changed files with 7,514 additions and 260 deletions.
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaults
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AUTH_NAME=secretary
AUTH_PASSWORD=password
SOCIETY_NAME=SampleSociety
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ jobs:
uses: actions/checkout@master
- run: cp config/database.yml.docker config/database.yml
- run: cp docker-compose.yml.sample docker-compose.yml
- run: cp .env.sample .env
- run: docker-compose build && docker-compose pull
- run: docker-compose run --rm app gem install bundler
- run: docker-compose run --rm app bundle install --jobs=4 --retry=3
- run: docker-compose run --rm app bundle exec rake db:create
- run: docker-compose run -e RAILS_ENV=test --rm app bundle exec rake db:migrate
- run: docker-compose run -e RAILS_ENV=test --rm app yarn install
- run: docker-compose run -e RAILS_ENV=test --rm app bundle exec rake assets:precompile
- name: build
run: docker-compose run --rm app bundle exec rspec -f d
run: docker-compose run --env-file=.env.sample --rm app bundle exec rspec -f d
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ config/database.yml
db/schema.rb
.rspec
docker-compose.yml

/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity
.env
public/assets
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ run \
sed -i "/deb-src/d" /etc/apt/sources.list && \
apt-get update && \
apt-get install -y build-essential libpq-dev postgresql-client unzip cmake && \
curl -sSL "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" | tar xfJ - -C /usr/local --strip-components=1
curl -sSL "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" | tar xfJ - -C /usr/local --strip-components=1 && \
npm install -g yarn
12 changes: 4 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ source 'https://rubygems.org'

ruby File.read('.ruby-version').strip

gem 'rails', '~> 5.2.0'
gem "rails"
gem "pg"
gem "puma"
gem 'responders'
gem 'simple_form'
gem 'rack-canonical-host'
gem 'bootsnap'
gem "bootsnap", ">= 1.4.4", require: false

# Asset related
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'bootstrap-sass', '~> 3.4.1'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 5.0'

group :development, :test do
gem "rspec-rails"
Expand All @@ -26,5 +24,3 @@ end
group :test do
gem "capybara"
end

gem "mimemagic", git: "https://github.com/minad/mimemagic.git", ref: "01f92d86d15d85cfd0f20dabd025dcbd36a8a60f"
175 changes: 89 additions & 86 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,64 +1,69 @@
GIT
remote: https://github.com/minad/mimemagic.git
revision: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f
ref: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f
specs:
mimemagic (0.3.5)

GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.6)
actionpack (= 5.2.6)
actioncable (6.1.4)
actionpack (= 6.1.4)
activesupport (= 6.1.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
actionmailbox (6.1.4)
actionpack (= 6.1.4)
activejob (= 6.1.4)
activerecord (= 6.1.4)
activestorage (= 6.1.4)
activesupport (= 6.1.4)
mail (>= 2.7.1)
actionmailer (6.1.4)
actionpack (= 6.1.4)
actionview (= 6.1.4)
activejob (= 6.1.4)
activesupport (= 6.1.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.6)
actionview (= 5.2.6)
activesupport (= 5.2.6)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.4)
actionview (= 6.1.4)
activesupport (= 6.1.4)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.6)
activesupport (= 5.2.6)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.4)
actionpack (= 6.1.4)
activerecord (= 6.1.4)
activestorage (= 6.1.4)
activesupport (= 6.1.4)
nokogiri (>= 1.8.5)
actionview (6.1.4)
activesupport (= 6.1.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.6)
activesupport (= 5.2.6)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.4)
activesupport (= 6.1.4)
globalid (>= 0.3.6)
activemodel (5.2.6)
activesupport (= 5.2.6)
activerecord (5.2.6)
activemodel (= 5.2.6)
activesupport (= 5.2.6)
arel (>= 9.0)
activestorage (5.2.6)
actionpack (= 5.2.6)
activerecord (= 5.2.6)
activemodel (6.1.4)
activesupport (= 6.1.4)
activerecord (6.1.4)
activemodel (= 6.1.4)
activesupport (= 6.1.4)
activestorage (6.1.4)
actionpack (= 6.1.4)
activejob (= 6.1.4)
activerecord (= 6.1.4)
activesupport (= 6.1.4)
marcel (~> 1.0.0)
activesupport (5.2.6)
mini_mime (>= 1.1.0)
activesupport (6.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
arel (9.0.0)
autoprefixer-rails (10.2.5.1)
execjs (> 0)
bootsnap (1.7.5)
msgpack (~> 1.0)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
builder (3.2.4)
capybara (3.35.3)
addressable
Expand All @@ -72,7 +77,6 @@ GEM
crass (1.0.6)
diff-lcs (1.4.4)
erubi (1.10.0)
execjs (2.8.1)
ffi (1.15.3)
globalid (0.4.2)
activesupport (>= 4.2.0)
Expand Down Expand Up @@ -102,35 +106,36 @@ GEM
nio4r (~> 2.0)
racc (1.5.2)
rack (2.2.3)
rack-canonical-host (1.0.0)
addressable (> 0, < 3)
rack (>= 1.0.0, < 3)
rack-proxy (0.7.0)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.6)
actioncable (= 5.2.6)
actionmailer (= 5.2.6)
actionpack (= 5.2.6)
actionview (= 5.2.6)
activejob (= 5.2.6)
activemodel (= 5.2.6)
activerecord (= 5.2.6)
activestorage (= 5.2.6)
activesupport (= 5.2.6)
bundler (>= 1.3.0)
railties (= 5.2.6)
rails (6.1.4)
actioncable (= 6.1.4)
actionmailbox (= 6.1.4)
actionmailer (= 6.1.4)
actionpack (= 6.1.4)
actiontext (= 6.1.4)
actionview (= 6.1.4)
activejob (= 6.1.4)
activemodel (= 6.1.4)
activerecord (= 6.1.4)
activestorage (= 6.1.4)
activesupport (= 6.1.4)
bundler (>= 1.15.0)
railties (= 6.1.4)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.2.6)
actionpack (= 5.2.6)
activesupport (= 5.2.6)
railties (6.1.4)
actionpack (= 6.1.4)
activesupport (= 6.1.4)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rake (>= 0.13)
thor (~> 1.0)
rake (13.0.6)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
Expand All @@ -156,19 +161,17 @@ GEM
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.2)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
semantic_range (3.0.0)
simple_form (5.1.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
Expand All @@ -180,36 +183,36 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.10)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
webpacker (5.4.0)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)

PLATFORMS
ruby

DEPENDENCIES
bootsnap
bootstrap-sass (~> 3.4.1)
bootsnap (>= 1.4.4)
capybara
listen
mimemagic!
pg
puma
rack-canonical-host
rails (~> 5.2.0)
rails
responders
rspec-rails
sass-rails (~> 5.0)
sass-rails (>= 6)
simple_form
uglifier (>= 1.3.0)
webpacker (~> 5.0)

RUBY VERSION
ruby 2.7.4p191
Expand Down
9 changes: 3 additions & 6 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ $brand-primary: #ca1d00;
$header-muted: #e6bab3;
$font-size-base: 14pt;

@import 'bootstrap-sprockets';
@import 'bootstrap';
@import 'header';
@import 'sticky-footer';

h2 {
@extend .page-header;
margin-top: .5em;
}
h1 { font-size: 36pt; }
h2 { font-size: 30pt; }
body { font-size: 14pt; }
2 changes: 1 addition & 1 deletion app/assets/stylesheets/sticky-footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body {
}

.page-footer {
background-color: $gray-lighter;
background-color: #eeeeee;
bottom: 0;
font-style: italic;
height: $footer-height;
Expand Down
27 changes: 10 additions & 17 deletions app/controllers/admin/members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

module Admin
class MembersController < ::MembersController
http_basic_authenticate_with MembershipRegister.basic_auth_options
http_basic_authenticate_with(
name: ENV.fetch("AUTH_NAME") { "secretary" },
password: ENV.fetch("AUTH_PASSWORD") {
Rails.logger.info("You have not set a password for the admin area")
SecureRandom.hex
}
)

def index
@members = Member.all.order(updated_at: :desc)
Expand All @@ -11,22 +17,9 @@ def index
format.html
format.csv do
csv_content = CSV.generate(headers: true) do |csv|
csv << %w[id full_name joined_at email address data created_at updated_at token token_updated_at]

@members.each do |member|
csv << [
member.id,
member.full_name,
member.joined_at,
member.email,
member.address,
member.data,
member.created_at,
member.updated_at,
member.token,
member.token_updated_at
]
end
csv << Member::EXPORTABLE_FIELDS

@members.pluck(*Member::EXPORTABLE_FIELDS).each { |member| csv << member }
end

send_data csv_content, type: "text/csv"
Expand Down
File renamed without changes.
Loading

0 comments on commit 0511b08

Please sign in to comment.