Skip to content
This repository has been archived by the owner on Feb 13, 2018. It is now read-only.

Commit

Permalink
Upgrade to rails 5.0 and mongoid 6.1
Browse files Browse the repository at this point in the history
We need to upgrade these in lockstep because mongoid 5 doesn't support
rails 5 and mongoid 6 doesn't support rails 4.  We've run
`rake rails:update` to get new config file details and also compared
with railsdiff to get details not handled by the update script.
  • Loading branch information
h-lame committed May 23, 2017
1 parent bbe0b21 commit 0fed57b
Show file tree
Hide file tree
Showing 19 changed files with 255 additions and 130 deletions.
10 changes: 8 additions & 2 deletions .gitignore
Expand Up @@ -9,10 +9,16 @@

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore Byebug command history file.
.byebug_history

# Ignore generated rcov files
/coverage
18 changes: 16 additions & 2 deletions Gemfile
@@ -1,8 +1,13 @@
source 'https://rubygems.org'

gem 'rails', '4.2.8'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end

gem 'rails', '~> 5.0.2'

gem 'mongoid', '~> 5.0'
gem 'mongoid', '~> 6.0'

gem 'plek', '~> 1.11'

Expand Down Expand Up @@ -31,6 +36,15 @@ end

gem 'airbrake', '~> 4.3.4'

group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end

group :development, :test do
gem 'govuk-lint', '~> 0.4'
end
Expand Down
134 changes: 80 additions & 54 deletions Gemfile.lock
Expand Up @@ -2,48 +2,52 @@ GEM
remote: https://rubygems.org/
specs:
PriorityQueue (0.1.2)
actionmailer (4.2.8)
actionpack (= 4.2.8)
actionview (= 4.2.8)
activejob (= 4.2.8)
actioncable (5.0.3)
actionpack (= 5.0.3)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.3)
actionpack (= 5.0.3)
actionview (= 5.0.3)
activejob (= 5.0.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.8)
actionview (= 4.2.8)
activesupport (= 4.2.8)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-dom-testing (~> 2.0)
actionpack (5.0.3)
actionview (= 5.0.3)
activesupport (= 5.0.3)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.8)
activesupport (= 4.2.8)
actionview (5.0.3)
activesupport (= 5.0.3)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (4.2.8)
activesupport (= 4.2.8)
globalid (>= 0.3.0)
activemodel (4.2.8)
activesupport (= 4.2.8)
builder (~> 3.1)
activerecord (4.2.8)
activemodel (= 4.2.8)
activesupport (= 4.2.8)
arel (~> 6.0)
activesupport (4.2.8)
activejob (5.0.3)
activesupport (= 5.0.3)
globalid (>= 0.3.6)
activemodel (5.0.3)
activesupport (= 5.0.3)
activerecord (5.0.3)
activemodel (= 5.0.3)
activesupport (= 5.0.3)
arel (~> 7.0)
activesupport (5.0.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
airbrake (4.3.4)
builder
multi_json
arel (6.0.4)
arel (7.1.4)
ast (2.1.0)
astrolabe (1.3.1)
parser (~> 2.2)
bindex (0.5.0)
bson (4.2.1)
builder (3.2.3)
chronic (0.10.2)
Expand All @@ -69,6 +73,7 @@ GEM
railties (>= 3.0.0)
faraday (0.11.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.18)
gds-api-adapters (39.2.0)
link_header
lrucache (~> 0.1.1)
Expand Down Expand Up @@ -99,6 +104,9 @@ GEM
activesupport (>= 3.0.0)
kgio (2.10.0)
link_header (0.0.8)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
logstash-event (1.1.5)
logstasher (0.4.8)
logstash-event (~> 1.1.0)
Expand All @@ -109,6 +117,7 @@ GEM
mail (2.6.5)
mime-types (>= 1.16, < 4)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
Expand All @@ -120,11 +129,9 @@ GEM
metaclass (~> 0.0.1)
mongo (2.4.1)
bson (>= 4.2.1, < 5.0.0)
mongoid (5.2.1)
activemodel (~> 4.0)
mongoid (6.1.0)
activemodel (~> 5.0)
mongo (>= 2.4.1, < 3.0.0)
origin (~> 2.3)
tzinfo (>= 0.3.37)
mongoid_rails_migrations (1.1.0)
activesupport (>= 4.2.0)
bundler (>= 1.0.0)
Expand All @@ -135,6 +142,7 @@ GEM
multi_xml (0.6.0)
multipart-post (2.0.0)
netrc (0.11.0)
nio4r (2.0.0)
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
null_logger (0.0.1)
Expand All @@ -153,44 +161,45 @@ GEM
omniauth-oauth2 (1.3.1)
oauth2 (~> 1.0)
omniauth (~> 1.2)
origin (2.3.0)
parser (2.2.3.0)
ast (>= 1.1, < 3.0)
plek (1.11.0)
power_assert (0.2.4)
powerpack (0.1.1)
rack (1.6.8)
rack (2.0.3)
rack-cache (1.7.0)
rack (>= 0.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.8)
actionmailer (= 4.2.8)
actionpack (= 4.2.8)
actionview (= 4.2.8)
activejob (= 4.2.8)
activemodel (= 4.2.8)
activerecord (= 4.2.8)
activesupport (= 4.2.8)
rails (5.0.3)
actioncable (= 5.0.3)
actionmailer (= 5.0.3)
actionpack (= 5.0.3)
actionview (= 5.0.3)
activejob (= 5.0.3)
activemodel (= 5.0.3)
activerecord (= 5.0.3)
activesupport (= 5.0.3)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.8)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.8)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
railties (= 5.0.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.8)
actionpack (= 4.2.8)
activesupport (= 4.2.8)
railties (5.0.3)
actionpack (= 5.0.3)
activesupport (= 5.0.3)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.0.0)
raindrops (0.15.0)
rake (12.0.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
redis (3.2.2)
rest-client (2.0.0)
http-cookie (>= 1.0.2, < 2.0)
Expand All @@ -211,6 +220,11 @@ GEM
shoulda-context (1.2.1)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
spring (2.0.1)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -236,10 +250,18 @@ GEM
rack (>= 1.0)
warden-oauth2 (0.0.1)
warden
web-console (3.5.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (1.22.3)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
whenever (0.9.4)
chronic (>= 0.6.3)

Expand All @@ -256,17 +278,21 @@ DEPENDENCIES
govuk-lint (~> 0.4)
kaminari (= 0.17.0)
link_header (= 0.0.8)
listen (~> 3.0.5)
logstasher (= 0.4.8)
mlanett-redis-lock (= 0.2.7)
mocha (= 1.1.0)
mongoid (~> 5.0)
mongoid (~> 6.0)
mongoid_rails_migrations (= 1.1.0)
plek (~> 1.11)
rails (= 4.2.8)
rails (~> 5.0.2)
shoulda (= 3.5.0)
shoulda-matchers (= 2.8.0)
spring
spring-watcher-listen (~> 2.0.0)
test-unit (~> 3.0)
unicorn
web-console (>= 3.3.0)
webmock (= 1.22.3)
whenever (= 0.9.4)

Expand Down
2 changes: 1 addition & 1 deletion bin/rails
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
31 changes: 18 additions & 13 deletions bin/setup
@@ -1,29 +1,34 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

Dir.chdir APP_ROOT do
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:
# Add necessary setup steps to this file.

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

# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml"
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# end

puts "\n== Preparing database =="
system "bin/rake db:setup"
# puts "\n== Preparing database =="
# system! 'bin/rails db:setup'

puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*"
system "rm -rf tmp/cache"
system! 'bin/rails log:clear tmp:clear'

puts "\n== Restarting application server =="
system "touch tmp/restart.txt"
system! 'bin/rails restart'
end
29 changes: 29 additions & 0 deletions bin/update
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.

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

# puts "\n== Updating database =="
# system! 'bin/rails db:migrate'

puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'

puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
2 changes: 1 addition & 1 deletion config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
require_relative 'config/environment'
run Rails.application

0 comments on commit 0fed57b

Please sign in to comment.