Skip to content

Commit

Permalink
Upgrade Rails to version 5.2, keeping same version of ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreben committed Oct 4, 2019
1 parent 56e6875 commit 3a843c3
Show file tree
Hide file tree
Showing 30 changed files with 508 additions and 146 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
ruby '2.6.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0'
gem 'rails', '~> 5.2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3.13'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
Expand Down Expand Up @@ -53,7 +53,7 @@ gem 'tsv'
gem 'therubyracer'

group :production do
gem 'activerecord-oracle_enhanced-adapter', '~> 1.7.0'
gem 'activerecord-oracle_enhanced-adapter', '~> 5.2.0'
gem 'ruby-oci8'
gem 'ruby-plsql'
end
Expand Down
114 changes: 60 additions & 54 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.7.2)
actionpack (= 5.0.7.2)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
actioncable (5.2.3)
actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.7.2)
actionview (= 5.0.7.2)
activesupport (= 5.0.7.2)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
rack (~> 2.0)
rack-test (~> 0.6.3)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7.2)
activesupport (= 5.0.7.2)
actionview (5.2.3)
activesupport (= 5.2.3)
builder (~> 3.1)
erubis (~> 2.7.0)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.7.2)
activesupport (= 5.0.7.2)
activejob (5.2.3)
activesupport (= 5.2.3)
globalid (>= 0.3.6)
activemodel (5.0.7.2)
activesupport (= 5.0.7.2)
activerecord (5.0.7.2)
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activerecord-oracle_enhanced-adapter (1.7.11)
activerecord (~> 5.0.0)
arel (~> 7.1.4)
ruby-plsql (>= 0.5.0)
activesupport (5.0.7.2)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activerecord-oracle_enhanced-adapter (5.2.6)
activerecord (~> 5.2.0)
ruby-plsql (>= 0.6.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
marcel (~> 0.3.1)
activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
Expand All @@ -46,7 +49,7 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
airbrussh (1.3.4)
sshkit (>= 1.6.1, != 1.7.0)
arel (7.1.4)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.6.1.1)
execjs
Expand Down Expand Up @@ -99,8 +102,8 @@ GEM
image_processing (~> 1.1)
mimemagic (>= 0.3.0)
mini_mime (>= 0.1.3)
composite_primary_keys (9.0.10)
activerecord (~> 5.0.0, >= 5.0.7)
composite_primary_keys (11.2.0)
activerecord (~> 5.2.1)
concurrent-ruby (1.1.5)
config (2.0.0)
activesupport (>= 4.2)
Expand Down Expand Up @@ -151,11 +154,11 @@ GEM
dry-equalizer (~> 0.2, >= 0.2.2)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
erubis (2.7.0)
erubi (1.9.0)
execjs (2.7.0)
factory_bot (5.1.0)
factory_bot (5.1.1)
activesupport (>= 4.2.0)
factory_bot_rails (5.1.0)
factory_bot_rails (5.1.1)
factory_bot (~> 5.1.0)
railties (>= 4.2.0)
faraday (0.16.2)
Expand All @@ -169,7 +172,7 @@ GEM
actionpack (>= 4.1)
activesupport (>= 4.1)
honeybadger (4.5.1)
i18n (1.6.0)
i18n (1.7.0)
concurrent-ruby (~> 1.0)
image_processing (1.9.3)
mini_magick (>= 4.9.5, < 5)
Expand All @@ -188,6 +191,8 @@ GEM
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.2)
mimemagic (0.3.3)
mini_magick (4.9.5)
Expand All @@ -207,19 +212,20 @@ GEM
ast (~> 2.4.0)
public_suffix (4.0.1)
rack (2.0.7)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.7.2)
actioncable (= 5.0.7.2)
actionmailer (= 5.0.7.2)
actionpack (= 5.0.7.2)
actionview (= 5.0.7.2)
activejob (= 5.0.7.2)
activemodel (= 5.0.7.2)
activerecord (= 5.0.7.2)
activesupport (= 5.0.7.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
bundler (>= 1.3.0)
railties (= 5.0.7.2)
railties (= 5.2.3)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
Expand All @@ -230,12 +236,12 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
railties (5.0.7.2)
actionpack (= 5.0.7.2)
activesupport (= 5.0.7.2)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (12.3.3)
rb-fsevent (0.10.3)
Expand Down Expand Up @@ -337,7 +343,7 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.6.5)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
xpath (3.2.0)
Expand All @@ -347,7 +353,7 @@ PLATFORMS
ruby

DEPENDENCIES
activerecord-oracle_enhanced-adapter (~> 1.7.0)
activerecord-oracle_enhanced-adapter (~> 5.2.0)
bootstrap-datepicker-rails
bootstrap-sass
bootstrap_form
Expand All @@ -372,7 +378,7 @@ DEPENDENCIES
jquery-rails
nokogiri
okcomputer
rails (~> 5.0)
rails (~> 5.2)
rails-controller-testing
rspec-rails
rubocop
Expand Down
16 changes: 11 additions & 5 deletions app/models/concerns/fund_year_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
module FundYearUtils
extend ActiveSupport::Concern

def check_dates
case date_type
when 'fiscal'
check_fy
when 'calendar'
check_cal
when 'paydate'
check_pd
end
end

def set_fund
if fund
# the multi select collects an array
Expand Down Expand Up @@ -86,9 +97,4 @@ def write_range_start(date)
def write_range_end(date)
self[:date_range_end] = date
end

def write_dates
self[:date_request] = Time.zone.now
self[:date_ran] = nil
end
end
27 changes: 19 additions & 8 deletions app/models/encumbrance_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Class to model the Encumberances Report table
###
class EncumbranceReport < ApplicationRecord
attr_accessor :fund_select, :show_dates, :fund, :fund_begin, :email,
:date_ran, :date_request, :output_file
attr_accessor :fund_select, :show_dates, :fund, :fund_begin, :email, :status,
:date_ran, :date_request, :output_file, :fund_acct

validates :email, presence: true
validates :fund, presence: true, if: 'fund_begin.nil?'
validates :fund_begin, presence: true, if: 'fund.nil?'
validates :email, :status, :date_request, :output_file, presence: true
validates :email, format: { with: Rails.configuration.email_pattern }, allow_blank: true
validates :fund, presence: true, if: :blank_fund_begin?
validates :fund_begin, presence: true, if: :blank_fund?

before_save :set_fund, :write_dates, :set_email, :set_output_file
before_save :set_fund, :write_dates, :set_email, :set_status, :set_output_file

self.table_name = 'encumbrance_rpts'

Expand All @@ -21,6 +21,14 @@ def kickoff

private

def blank_fund_begin?
fund_begin.blank?
end

def blank_fund?
fund.blank?
end

def set_fund
if fund.present?
self[:fund_acct] = fund.join(',')
Expand All @@ -30,14 +38,17 @@ def set_fund
end

def write_dates
self[:date_request] = Time.zone.now
self[:date_ran] = nil
self[:date_request] = date_request
end

def set_email
self[:email] = email
end

def set_status
self[:status] = status
end

def set_output_file
self[:output_file] = output_file
end
Expand Down
32 changes: 27 additions & 5 deletions app/models/endowed_funds_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class EndowedFundsReport
:date_ran, :date_type, :fy_start, :fy_end, :cal_start, :cal_end,
:pd_start, :pd_end, :email, :ckeys_file

validates :fund, presence: true, if: 'fund_begin.blank?'
validates :fund_begin, presence: true, if: 'fund.blank?'
validates :fy_start, presence: true, if: 'cal_start.blank? && pd_start.blank?'
validates :cal_start, presence: true, if: 'fy_start.blank? && pd_start.blank?'
validates :pd_start, presence: true, if: 'cal_start.blank? && fy_start.blank?'
validates :fund, presence: true, if: :blank_fund_begin?
validates :fund_begin, presence: true, if: :blank_fund?
validates :fy_start, presence: true, if: :only_fy?
validates :cal_start, presence: true, if: :only_cal?
validates :pd_start, presence: true, if: :only_pd?
validates :email, presence: true
validates :email, format: { with: Rails.configuration.email_pattern }, allow_blank: true

Expand Down Expand Up @@ -83,4 +83,26 @@ def paid_years
years.push(pd_start) if years.length == 1
years
end

private

def blank_fund_begin?
fund_begin.blank?
end

def blank_fund?
fund.blank?
end

def only_fy?
cal_start.blank? && pd_start.blank?
end

def only_cal?
fy_start.blank? && pd_start.blank?
end

def only_pd?
fy_start.blank? && cal_start.blank?
end
end
22 changes: 14 additions & 8 deletions app/models/expenditure_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
###
class ExpenditureReport < ApplicationRecord
include FundYearUtils
attr_accessor :fund, :fund_begin, :fund_select, :date_request, :date_ran, :date_type,
:fy_start, :fy_end, :cal_start, :cal_end, :pd_start, :pd_end, :output_file
attr_accessor :fund, :fund_begin, :fund_select, :date_type, :fy_start, :fy_end,
:cal_start, :cal_end, :pd_start, :pd_end, :output_file

validates :email, presence: true
validates :fund, presence: true, if: 'fund_begin.nil?'
validates :fund_begin, presence: true, if: 'fund.nil?'
validates :fund, presence: true, if: :blank_fund_begin?
validates :fund_begin, presence: true, if: :blank_fund?
validates :date_type, inclusion: %w[fiscal calendar paydate]
validates :email, format: { with: Rails.configuration.email_pattern }, allow_blank: true

before_save :set_fund, :write_dates, :set_output_file
before_save :check_fy, if: 'date_type == "fiscal"'
before_save :check_cal, if: 'date_type == "calendar"'
before_save :check_pd, if: 'date_type == "paydate"'
before_save :set_fund, :set_output_file, :check_dates

self.table_name = 'expenditures_log'

def kickoff
Expand All @@ -25,6 +23,14 @@ def kickoff

private

def blank_fund_begin?
fund_begin.blank?
end

def blank_fund?
fund.blank?
end

def set_output_file
self[:output_file] = output_file
end
Expand Down

0 comments on commit 3a843c3

Please sign in to comment.