Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
(chore) Update Ruby to 2.6.1
Browse files Browse the repository at this point in the history
* During the high memory investigation a similar issue was flagged around memory leaks in Ruby protobuffs: puma/puma#1600 - while we aren’t on the same versions as mentioned, I updated, tested and checked the application can run. It's hard to tell if this change has had the desired improvements to memory usage as I can only do so much on Edge to replicate the production usage.
* Rubocop also required a change and autocorrect
  • Loading branch information
tahb committed Mar 5, 2019
1 parent 5f9eb9f commit dedf2cc
Show file tree
Hide file tree
Showing 32 changed files with 65 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
@@ -1,6 +1,6 @@
inherit_from: .rubocop_todo.yml
AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.6
Exclude:
- 'db/migrate/**/*'
- 'db/schema.rb'
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
@@ -1 +1 @@
2.4.1
2.6.1
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -9,7 +9,7 @@ COPY package-lock.json ./package-lock.json
RUN npm set progress=false && npm config set depth 0
RUN npm install --only=production

FROM ruby:2.4.1 as release
FROM ruby:2.6.1 as release
MAINTAINER dxw <rails@dxw.com>
RUN apt-get update && apt-get install -qq -y \
build-essential \
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

ruby '2.4.1'
ruby '2.6.1'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
Expand Down Expand Up @@ -49,7 +49,7 @@ gem 'xml-sitemap'

gem 'rollbar', '~> 2.18'

gem 'rubocop' # Not in Test group due to: https://github.com/chapmanu/imposter/issues/4
gem 'rubocop', '~> 0.65.0', require: false # Not in Test group due to: https://github.com/chapmanu/imposter/issues/4

gem 'activerecord-session_store'
gem 'public_activity'
Expand Down Expand Up @@ -89,7 +89,7 @@ group :test do
gem 'database_cleaner'
gem 'poltergeist'
gem 'rspec-collection_matchers'
gem 'webmock', '~> 3.4'
gem 'webmock', '~> 3.5'
gem 'shoulda-matchers'
gem 'rack_session_access'
end
Expand Down
28 changes: 15 additions & 13 deletions Gemfile.lock
Expand Up @@ -170,7 +170,7 @@ GEM
haml (>= 4.0.6, < 6.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
hashdiff (0.3.7)
hashdiff (0.3.8)
hashie (3.5.7)
high_voltage (3.1.0)
html2haml (2.2.0)
Expand All @@ -185,7 +185,7 @@ GEM
i18n (1.5.3)
concurrent-ruby (~> 1.0)
ipaddr (1.2.2)
jaro_winkler (1.5.1)
jaro_winkler (1.5.2)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -266,8 +266,8 @@ GEM
validate_url
webfinger (>= 1.0.1)
os (1.0.0)
parallel (1.12.1)
parser (2.5.1.2)
parallel (1.14.0)
parser (2.6.0.0)
ast (~> 2.4.0)
pg (1.1.4)
poltergeist (1.18.1)
Expand All @@ -278,6 +278,7 @@ GEM
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
psych (3.1.0)
public_activity (1.6.3)
actionpack (>= 3.0.0)
activerecord (>= 3.0)
Expand Down Expand Up @@ -370,19 +371,20 @@ GEM
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.58.2)
rubocop (0.65.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
psych (>= 3.1.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
unicode-display_width (~> 1.4.0)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
ruby_parser (3.11.0)
sexp_processor (~> 4.9)
safe_yaml (1.0.4)
safe_yaml (1.0.5)
sanitize (5.0.0)
crass (~> 1.0.2)
nokogiri (>= 1.8.0)
Expand Down Expand Up @@ -451,7 +453,7 @@ GEM
uber (0.1.0)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.0)
unicode-display_width (1.4.1)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
Expand All @@ -466,7 +468,7 @@ GEM
webfinger (1.1.0)
activesupport
httpclient (>= 2.4)
webmock (3.4.2)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
Expand Down Expand Up @@ -529,7 +531,7 @@ DEPENDENCIES
rollbar (~> 2.18)
rspec-collection_matchers
rspec-rails
rubocop
rubocop (~> 0.65.0)
sanitize (~> 5.0)
sass-rails (~> 5.0)
shoulda-matchers
Expand All @@ -544,11 +546,11 @@ DEPENDENCIES
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
webmock (~> 3.4)
webmock (~> 3.5)
xml-sitemap

RUBY VERSION
ruby 2.4.1p111
ruby 2.6.1p33

BUNDLED WITH
1.17.1
1.17.2
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Expand Up @@ -24,6 +24,7 @@ def not_found

def check_staging_auth
return unless authenticate?

authenticate_or_request_with_http_basic('Global') do |name, password|
name == http_user && password == http_pass
end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/hiring_staff/base_controller.rb
Expand Up @@ -24,6 +24,7 @@ def current_school

def current_user
return if current_session_id.blank?

@current_user ||= User.find_or_create_by(oid: current_session_id)
end
end
Expand Up @@ -16,6 +16,7 @@ def create
comment: feedback_params[:comment])

return render 'new' unless @feedback.save

audit_feedback(vacancy, @feedback)

redirect_to school_path, notice: I18n.t('messages.feedback.submitted')
Expand Down
1 change: 1 addition & 0 deletions app/controllers/interests_controller.rb
Expand Up @@ -13,6 +13,7 @@ def new

def vacancy_id
return params.require(:vacancy_id) if params.key?('vacancy_id')

params.require(:job_id)
end
end
1 change: 1 addition & 0 deletions app/controllers/pages_controller.rb
Expand Up @@ -7,6 +7,7 @@ def invalid_page

def set_headers
return super if page_path.include?('user-not-authorised')

response.set_header('X-Robots-Tag', 'index, nofollow')
end
end
1 change: 1 addition & 0 deletions app/controllers/vacancies_controller.rb
Expand Up @@ -26,6 +26,7 @@ def index
def show
vacancy = Vacancy.listed.friendly.find(id)
return redirect_to(job_path(vacancy), status: :moved_permanently) if old_vacancy_path?(vacancy)

@vacancy = VacancyPresenter.new(vacancy)
TrackVacancyPageViewJob.perform_later(vacancy.id) unless authenticated?

Expand Down
2 changes: 2 additions & 0 deletions app/helpers/date_helper.rb
Expand Up @@ -3,8 +3,10 @@ class FormatDateError < RuntimeError; end

def format_date(date, format = :default)
return 'No date given' if date.nil?

date_formats = Date::DATE_FORMATS.keys.join(' ')
raise FormatDateError, date_format_error_message(format, date_formats) unless Date::DATE_FORMATS.include?(format)

date.to_s(format).lstrip
end

Expand Down
1 change: 1 addition & 0 deletions app/jobs/audit_express_interest_event_job.rb
Expand Up @@ -4,6 +4,7 @@ class AuditExpressInterestEventJob < SpreadsheetWriterJob

def perform(data)
return unless AUDIT_SPREADSHEET_ID

write_row(data, WORKSHEET_POSITION)
end
end
1 change: 1 addition & 0 deletions app/jobs/audit_feedback_job.rb
Expand Up @@ -4,6 +4,7 @@ class AuditFeedbackJob < SpreadsheetWriterJob

def perform(data)
return unless AUDIT_SPREADSHEET_ID

write_row(data, WORKSHEET_POSITION)
end
end
1 change: 1 addition & 0 deletions app/jobs/audit_search_event_job.rb
Expand Up @@ -4,6 +4,7 @@ class AuditSearchEventJob < SpreadsheetWriterJob

def perform(data)
return unless AUDIT_SPREADSHEET_ID

write_row(data, WORKSHEET_POSITION)
end
end
1 change: 1 addition & 0 deletions app/jobs/audit_sign_in_event_job.rb
Expand Up @@ -6,6 +6,7 @@ class AuditSignInEventJob < SpreadsheetWriterJob

def perform(audit_details)
return unless AUDIT_SPREADSHEET_ID

write_row(decrypt_data(audit_details), WORKSHEET_POSITION)
end

Expand Down
1 change: 1 addition & 0 deletions app/jobs/audit_toc_acceptance_event_job.rb
Expand Up @@ -4,6 +4,7 @@ class AuditTocAcceptanceEventJob < SpreadsheetWriterJob

def perform(data)
return unless AUDIT_SPREADSHEET_ID

write_row(data, WORKSHEET_POSITION)
end
end
1 change: 1 addition & 0 deletions app/jobs/performance_platform_feedback_queue_job.rb
Expand Up @@ -5,6 +5,7 @@ class PerformancePlatformFeedbackQueueJob < ApplicationJob
def perform(time_to_s)
date = Time.zone.parse(time_to_s)
return if TransactionAuditor::Logger.new('performance_platform:submit_user_satisfaction', date).performed?

data = { 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0 }.merge!(Feedback.published_on(date).group(:rating).count)
PerformancePlatform::UserSatisfaction.new(PP_USER_SATISFACTION_TOKEN)
.submit(data, date.utc.iso8601)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/performance_platform_transactions_queue_job.rb
Expand Up @@ -6,6 +6,7 @@ def perform(time_to_s)
date = Time.zone.parse(time_to_s)

return if TransactionAuditor::Logger.new('performance_platform:submit_transactions', date).performed?

no_of_transactions = Vacancy.published_on_count(date)
PerformancePlatform::TransactionsByChannel.new(PP_TRANSACTIONS_BY_CHANNEL_TOKEN)
.submit_transactions(no_of_transactions, date.utc.iso8601)
Expand Down
1 change: 1 addition & 0 deletions app/jobs/spreadsheet_writer_job.rb
Expand Up @@ -5,6 +5,7 @@ class SpreadsheetWriterJob < ApplicationJob

def perform(data)
return unless AUDIT_SPREADSHEET_ID

write_row(data)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/school.rb
Expand Up @@ -2,7 +2,7 @@
class School < ApplicationRecord
include Auditor::Model

belongs_to :school_type, required: true
belongs_to :school_type, optional: false
belongs_to :detailed_school_type, optional: true
belongs_to :region

Expand Down
15 changes: 8 additions & 7 deletions app/models/vacancy.rb
Expand Up @@ -79,13 +79,13 @@ class Vacancy < ApplicationRecord
enum status: %i[published draft trashed]
enum working_pattern: %i[full_time part_time]

belongs_to :school, required: true
belongs_to :subject, required: false
belongs_to :first_supporting_subject, class_name: 'Subject', required: false
belongs_to :second_supporting_subject, class_name: 'Subject', required: false
belongs_to :min_pay_scale, class_name: 'PayScale', required: false
belongs_to :max_pay_scale, class_name: 'PayScale', required: false
belongs_to :leadership, required: false
belongs_to :school, optional: false
belongs_to :subject, optional: true
belongs_to :first_supporting_subject, class_name: 'Subject', optional: true
belongs_to :second_supporting_subject, class_name: 'Subject', optional: true
belongs_to :min_pay_scale, class_name: 'PayScale', optional: true
belongs_to :max_pay_scale, class_name: 'PayScale', optional: true
belongs_to :leadership, optional: true

has_one :feedback

Expand Down Expand Up @@ -118,6 +118,7 @@ def location

def coordinates
return if school_geolocation.nil?

{
lat: school_geolocation.x.to_f,
lon: school_geolocation.y.to_f
Expand Down
2 changes: 2 additions & 0 deletions app/presenters/vacancies_presenter.rb
Expand Up @@ -23,9 +23,11 @@ def each(&block)
def total_count_message
if total_count == 1
return I18n.t('jobs.job_count_without_search', count: total_count) unless @searched

I18n.t('jobs.job_count', count: total_count)
else
return I18n.t('jobs.job_count_plural_without_search', count: total_count) unless @searched

I18n.t('jobs.job_count_plural', count: total_count)
end
end
Expand Down
3 changes: 3 additions & 0 deletions app/presenters/vacancy_presenter.rb
Expand Up @@ -10,6 +10,7 @@ def share_url

def salary_range(del = 'to')
return number_to_currency(model.minimum_salary) if model.maximum_salary.blank?

"#{number_to_currency(model.minimum_salary)} #{del} "\
"#{number_to_currency(model.maximum_salary)}"\
"#{model.part_time? ? ' per year pro rata' : ' per year'}"
Expand Down Expand Up @@ -64,6 +65,7 @@ def other_subjects
return '' if first_supporting_subject.blank? && second_supporting_subject.blank?
return first_supporting_subject if only_first_supporting_subject_present?
return second_supporting_subject if only_second_supporting_subject_present?

supporting_subjects
end
end
Expand All @@ -85,6 +87,7 @@ def pay_scale_range
return '' if model.min_pay_scale.blank? && model.max_pay_scale.blank?
return "from #{model.min_pay_scale.label}" if only_min_pay_scale_present?
return "up to #{model.max_pay_scale.label}" if only_max_pay_scale_present?

pay_scale_range_label
end
end
Expand Down
1 change: 1 addition & 0 deletions app/services/teacher_vacancy_authorisation.rb
Expand Up @@ -26,6 +26,7 @@ def all_permissions
def school_urn
return nil unless user_permissions.any?
return user_permissions_for_school.first['school_urn'] if @school_urn.present?

user_permissions.first['school_urn']
end

Expand Down

0 comments on commit dedf2cc

Please sign in to comment.