Skip to content

Commit

Permalink
Upgraded to Ruby 2.5.1 and Rails 5.2.
Browse files Browse the repository at this point in the history
Upgraded Ruby to 2.5.1.
Upgraded Rails to 5.2 and ran update script which updated a bunch of files. It tends to overwrite files so I manually edited each file so that nothing was lost.
A few files outside of those directly in the upgrades were touched to get the one test to pass. Also, the Gemfile is updated and organized, adding in the various gems needed to support testing, as well as the ones mentioned in email.
  • Loading branch information
blimey85 committed Jun 14, 2018
1 parent 198cf61 commit 3468e59
Show file tree
Hide file tree
Showing 27 changed files with 392 additions and 198 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@

/coverage/
/brakeman-report.html

Gemfile\.lock
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.1
2.5.1
81 changes: 46 additions & 35 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,71 @@ git_source(:github) do |repo_name|
"https://github.com/#{repo_name}.git"
end

ruby '2.4.1'
ruby '2.5.1'

gem 'rails', '~> 5.1.4'
### Servers
gem 'rails', '~> 5.2'
gem 'pg'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'redis', '~> 3.0'
gem 'sidekiq'

### Front End
gem 'acts_as_votable'
gem 'bootstrap-sass'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'devise'
gem 'haml'
gem 'jbuilder', '~> 2.5'
gem 'redis', '~> 3.0'
gem 'jquery-rails'
gem 'kaminari'
gem 'paperclip'
gem 'rails_emoji_picker'
gem 'remotipart', '~> 1.2'
gem 'sass-rails', '~> 5.0'
gem 'simple_form'
gem 'uglifier', '>= 1.3.0'

### Utilities
gem 'bootsnap', require: false
gem 'dotenv-rails'
gem 'rails_admin'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :development do
gem 'sqlite3'
gem 'pg'
gem "awesome_print", require:"ap"
gem 'better_errors'
gem 'binding_of_caller'
gem 'guard-rspec'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'irbtools-more', require: 'irbtools/binding'
gem 'meta_request'
gem 'web-console'
gem "awesome_print", require:"ap"
end

group :development, :test do
gem 'rspec-rails', '~> 3.6'
gem 'bullet', '~> 5.6'
gem 'bundler-audit', '~> 0.6', require: false
gem 'capybara', '~> 3.1'
gem 'chromedriver-helper', '~> 1.1.0'
gem 'rspec-rails', '~> 3.7'
gem 'rubocop', '~> 0.49', require: false
gem 'rubocop-rspec', '~> 1.12', require: false
gem 'selenium-webdriver'
gem 'spring'
gem 'spring-commands-rspec'
gem 'spring-watcher-listen'
end

group :test do
gem 'rubocop', '~> 0.49', require: false
gem 'rubocop-rspec', '~> 1.12', require: false
gem 'brakeman', '~> 3.5', require: false
gem 'metric_fu', '~> 4.12.0', require: false

gem 'fuubar', '~> 2.2.0'
gem 'database_cleaner', '~> 1.6'
gem 'factory_bot_rails'
gem 'capybara-email'
gem 'database_cleaner'
gem 'faker', '~> 1.7'
gem 'shoulda', '~> 3.5.0'
gem 'factory_bot_rails'
gem 'fuubar', '~> 2.2.0'
gem 'metric_fu', '~> 4.12.0', require: false
gem 'shoulda-matchers', github: 'thoughtbot/shoulda-matchers', branch: 'master'
gem 'simplecov', '~> 0.14', require: false
gem 'test-prof'
end

gem 'rails_emoji_picker'

gem 'dotenv-rails'

gem 'haml'
gem 'paperclip'
gem 'simple_form'
gem 'bootstrap-sass'
gem 'devise'
gem 'acts_as_votable'
gem 'kaminari'

gem 'rails_admin'

gem 'remotipart', '~> 1.2'
gem 'sidekiq'
2 changes: 1 addition & 1 deletion bin/bundle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')
5 changes: 5 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
5 changes: 5 additions & 0 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
34 changes: 34 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rspec-core", "rspec")
4 changes: 1 addition & 3 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/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 = File.expand_path('..', __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
Expand All @@ -21,7 +20,6 @@ chdir APP_ROOT do
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')


# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
Expand Down
17 changes: 17 additions & 0 deletions bin/spring
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
require 'rubygems'
require 'bundler'

lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
end
end
6 changes: 4 additions & 2 deletions bin/update
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/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 = File.expand_path('..', __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
Expand All @@ -18,6 +17,9 @@ chdir APP_ROOT do
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')

# Install JavaScript dependencies if using Yarn
# system('bin/yarn')

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

Expand Down
6 changes: 3 additions & 3 deletions bin/yarn
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
VENDOR_PATH = File.expand_path('..', __dir__)
Dir.chdir(VENDOR_PATH) do
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
begin
exec "yarnpkg #{ARGV.join(" ")}"
exec "yarnpkg", *ARGV
rescue Errno::ENOENT
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
Expand Down
7 changes: 5 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

module Kubh
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1

# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
ActionMailer::Base.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
Expand Down
1 change: 1 addition & 0 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
7 changes: 4 additions & 3 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ development:
password: <%= ENV['DB_PASSWORD'] %>

test:
adapter: sqlite3
pool: 5
database: db/test.sqlite3
<<: *default
database: beeconnect_test
username: <%= ENV['DB_USERNAME'] %>
password: <%= ENV['DB_PASSWORD'] %>

production:
<<: *default
Expand Down
33 changes: 31 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,35 +1,64 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false

# Do not eager load code on boot.
config.eager_load = false

# Show full error reports.
config.consider_all_requests_local = true

# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true

config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false

config.cache_store = :null_store
end

# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local

# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false

config.action_mailer.perform_caching = false

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true

# Suppress logger output for asset requests.
config.assets.quiet = true

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker

config.active_job.queue_adapter = :sidekiq

config.action_mailer.perform_deliveries = true
Expand Down
Loading

0 comments on commit 3468e59

Please sign in to comment.