Skip to content

Commit

Permalink
Merge 505231e into 9603d71
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed May 11, 2021
2 parents 9603d71 + 505231e commit 3e1ac97
Show file tree
Hide file tree
Showing 19 changed files with 314 additions and 97 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"

# Require rails
gem "rails", "6.0.3.7"
gem "rails", "6.1.3.2"

# Require json for multi_json
gem "json"
Expand Down Expand Up @@ -40,7 +40,7 @@ gem "active_record_union"
gem "bootstrap", "~> 4.5.0"
gem "bootstrap_form", "~> 4.0"
gem "cancancan"
gem "composite_primary_keys", "~> 12.0.0"
gem "composite_primary_keys", "~> 13.0.0"
gem "config"
gem "delayed_job_active_record"
gem "http_accept_language", "~> 2.1.1"
Expand Down Expand Up @@ -117,7 +117,7 @@ gem "browser"
gem "aws-sdk-s3"

# Used to resize user images
gem "mini_magick"
gem "image_processing"

# Gems useful for development
group :development do
Expand Down
140 changes: 74 additions & 66 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,71 @@ GEM
specs:
aasm (5.2.0)
concurrent-ruby (~> 1.0)
actioncable (6.0.3.7)
actionpack (= 6.0.3.7)
actioncable (6.1.3.2)
actionpack (= 6.1.3.2)
activesupport (= 6.1.3.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.7)
actionpack (= 6.0.3.7)
activejob (= 6.0.3.7)
activerecord (= 6.0.3.7)
activestorage (= 6.0.3.7)
activesupport (= 6.0.3.7)
actionmailbox (6.1.3.2)
actionpack (= 6.1.3.2)
activejob (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
mail (>= 2.7.1)
actionmailer (6.0.3.7)
actionpack (= 6.0.3.7)
actionview (= 6.0.3.7)
activejob (= 6.0.3.7)
actionmailer (6.1.3.2)
actionpack (= 6.1.3.2)
actionview (= 6.1.3.2)
activejob (= 6.1.3.2)
activesupport (= 6.1.3.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.7)
actionview (= 6.0.3.7)
activesupport (= 6.0.3.7)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.3.2)
actionview (= 6.1.3.2)
activesupport (= 6.1.3.2)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionpack-page_caching (1.2.3)
actionpack (>= 5.0.0)
actiontext (6.0.3.7)
actionpack (= 6.0.3.7)
activerecord (= 6.0.3.7)
activestorage (= 6.0.3.7)
activesupport (= 6.0.3.7)
actiontext (6.1.3.2)
actionpack (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
nokogiri (>= 1.8.5)
actionview (6.0.3.7)
activesupport (= 6.0.3.7)
actionview (6.1.3.2)
activesupport (= 6.1.3.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_record_union (1.3.0)
activerecord (>= 4.0)
activejob (6.0.3.7)
activesupport (= 6.0.3.7)
activejob (6.1.3.2)
activesupport (= 6.1.3.2)
globalid (>= 0.3.6)
activemodel (6.0.3.7)
activesupport (= 6.0.3.7)
activerecord (6.0.3.7)
activemodel (= 6.0.3.7)
activesupport (= 6.0.3.7)
activemodel (6.1.3.2)
activesupport (= 6.1.3.2)
activerecord (6.1.3.2)
activemodel (= 6.1.3.2)
activesupport (= 6.1.3.2)
activerecord-import (1.0.8)
activerecord (>= 3.2)
activestorage (6.0.3.7)
actionpack (= 6.0.3.7)
activejob (= 6.0.3.7)
activerecord (= 6.0.3.7)
activestorage (6.1.3.2)
actionpack (= 6.1.3.2)
activejob (= 6.1.3.2)
activerecord (= 6.1.3.2)
activesupport (= 6.1.3.2)
marcel (~> 1.0.0)
activesupport (6.0.3.7)
mini_mime (~> 1.0.2)
activesupport (6.1.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
annotate (3.1.1)
Expand Down Expand Up @@ -129,8 +133,8 @@ GEM
xpath (~> 3.2)
childprocess (3.0.0)
coderay (1.1.3)
composite_primary_keys (12.0.10)
activerecord (~> 6.0.0)
composite_primary_keys (13.0.0)
activerecord (~> 6.1.0)
concurrent-ruby (1.1.8)
config (3.1.0)
deep_merge (~> 1.2, >= 1.2.1)
Expand Down Expand Up @@ -233,6 +237,9 @@ GEM
image_optim (~> 0.24)
rails
sprockets
image_processing (1.12.1)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
image_size (2.1.0)
in_threads (1.5.4)
jbuilder (2.11.2)
Expand Down Expand Up @@ -263,7 +270,7 @@ GEM
maxminddb (0.1.22)
method_source (1.0.0)
mini_magick (4.11.0)
mini_mime (1.1.0)
mini_mime (1.0.3)
mini_portile2 (2.5.1)
minitest (5.14.4)
msgpack (1.4.2)
Expand Down Expand Up @@ -344,20 +351,20 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-uri_sanitizer (0.0.2)
rails (6.0.3.7)
actioncable (= 6.0.3.7)
actionmailbox (= 6.0.3.7)
actionmailer (= 6.0.3.7)
actionpack (= 6.0.3.7)
actiontext (= 6.0.3.7)
actionview (= 6.0.3.7)
activejob (= 6.0.3.7)
activemodel (= 6.0.3.7)
activerecord (= 6.0.3.7)
activestorage (= 6.0.3.7)
activesupport (= 6.0.3.7)
bundler (>= 1.3.0)
railties (= 6.0.3.7)
rails (6.1.3.2)
actioncable (= 6.1.3.2)
actionmailbox (= 6.1.3.2)
actionmailer (= 6.1.3.2)
actionpack (= 6.1.3.2)
actiontext (= 6.1.3.2)
actionview (= 6.1.3.2)
activejob (= 6.1.3.2)
activemodel (= 6.1.3.2)
activerecord (= 6.1.3.2)
activestorage (= 6.1.3.2)
activesupport (= 6.1.3.2)
bundler (>= 1.15.0)
railties (= 6.1.3.2)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
Expand All @@ -371,12 +378,12 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.0.3.7)
actionpack (= 6.0.3.7)
activesupport (= 6.0.3.7)
railties (6.1.3.2)
actionpack (= 6.1.3.2)
activesupport (= 6.1.3.2)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
thor (~> 1.0)
rainbow (3.0.0)
rake (13.0.3)
rb-fsevent (0.11.0)
Expand Down Expand Up @@ -410,6 +417,8 @@ GEM
rubocop (>= 1.7.0, < 2.0)
ruby-openid (2.9.2)
ruby-progressbar (1.11.0)
ruby-vips (2.1.2)
ffi (~> 1.12)
ruby2_keywords (0.0.4)
rubyzip (2.3.0)
sanitize (5.2.3)
Expand Down Expand Up @@ -446,10 +455,9 @@ GEM
strong_migrations (0.7.6)
activerecord (>= 5)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.10)
tzinfo (1.2.9)
thread_safe (~> 0.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.0.0)
Expand Down Expand Up @@ -489,7 +497,7 @@ DEPENDENCIES
cancancan
canonical-rails
capybara (>= 2.15)
composite_primary_keys (~> 12.0.0)
composite_primary_keys (~> 13.0.0)
config
dalli
debug_inspector
Expand All @@ -503,6 +511,7 @@ DEPENDENCIES
http_accept_language (~> 2.1.1)
i18n-js (>= 3.0.0)
image_optim_rails
image_processing
jbuilder (~> 2.7)
jquery-rails
json
Expand All @@ -513,7 +522,6 @@ DEPENDENCIES
logstasher
marcel
maxminddb
mini_magick
minitest (~> 5.1)
oauth-plugin (>= 0.5.1)
omniauth (~> 2.0.2)
Expand All @@ -531,7 +539,7 @@ DEPENDENCIES
r2 (~> 0.2.7)
rack-cors
rack-uri_sanitizer
rails (= 6.0.3.7)
rails (= 6.1.3.2)
rails-controller-testing
rails-i18n (~> 6.0.0)
rinku (>= 2.0.6)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def api_call_handle_error
report_error e.message, :bad_request
rescue ActiveRecord::RecordInvalid => e
message = "#{e.record.class} #{e.record.id}: "
e.record.errors.each { |attr, msg| message << "#{attr}: #{msg} (#{e.record[attr].inspect})" }
e.record.errors.each { |error| message << "#{error.attribute}: #{error.message} (#{e.record[error.attribute].inspect})" }
report_error message, :bad_request
rescue OSM::APIError => e
report_error e.message, e.status
Expand Down
8 changes: 4 additions & 4 deletions app/helpers/user_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def user_image(user, options = {})
if user.image_use_gravatar
user_gravatar_tag(user, options)
elsif user.avatar.attached?
image_tag user_avatar_variant(user, :resize => "100x100>"), options
image_tag user_avatar_variant(user, :resize_to_limit => [100, 100]), options
else
image_tag "avatar_large.png", options
end
Expand All @@ -21,7 +21,7 @@ def user_thumbnail(user, options = {})
if user.image_use_gravatar
user_gravatar_tag(user, options)
elsif user.avatar.attached?
image_tag user_avatar_variant(user, :resize => "50x50>"), options
image_tag user_avatar_variant(user, :resize_to_limit => [50, 50]), options
else
image_tag "avatar_small.png", options
end
Expand All @@ -34,7 +34,7 @@ def user_thumbnail_tiny(user, options = {})
if user.image_use_gravatar
user_gravatar_tag(user, options)
elsif user.avatar.attached?
image_tag user_avatar_variant(user, :resize => "50x50>"), options
image_tag user_avatar_variant(user, :resize_to_limit => [50, 50]), options
else
image_tag "avatar_small.png", options
end
Expand All @@ -44,7 +44,7 @@ def user_image_url(user, options = {})
if user.image_use_gravatar
user_gravatar_url(user, options)
elsif user.avatar.attached?
polymorphic_url(user_avatar_variant(user, :resize => "100x100>"), :host => Settings.server_url)
polymorphic_url(user_avatar_variant(user, :resize_to_limit => [100, 100]), :host => Settings.server_url)
else
image_url("avatar_large.png")
end
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def user_avatar_file(user)
avatar = user&.avatar
if avatar&.attached?
if avatar.variable?
image = avatar.variant(:resize => "50x50>").processed
image = avatar.variant(:resize_to_limit => [50, 50]).processed
image.service.download(image.key)
else
avatar.blob.download
Expand Down
6 changes: 3 additions & 3 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ def system!(*args)
end

FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.

puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")

# Install JavaScript dependencies
# system('bin/yarn')
system! "bin/yarn"

# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
Expand Down
18 changes: 13 additions & 5 deletions bin/yarn
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path("..", __dir__)
Dir.chdir(APP_ROOT) do
exec "yarnpkg", *ARGV
rescue Errno::ENOENT
warn "Yarn executable was not detected in the system."
warn "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
yarn = ENV["PATH"].split(File::PATH_SEPARATOR)
.reject { |dir| File.expand_path(dir) == __dir__ }
.product(["yarnpkg", "yarn", "yarn.cmd", "yarn.ps1"])
.map { |dir, file| File.expand_path(file, dir) }
.find { |file| File.executable?(file) }

if yarn
exec yarn, *ARGV
else
warn "Yarn executable was not detected in the system."
warn "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end
1 change: 1 addition & 0 deletions config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
require_relative "config/environment"

run Rails.application
Rails.application.load_server
2 changes: 1 addition & 1 deletion config/cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ development:
adapter: async

test:
adapter: async
adapter: test

production:
adapter: redis
Expand Down

0 comments on commit 3e1ac97

Please sign in to comment.