Skip to content

Commit

Permalink
Upgraded config to Rails 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
seaneshbaugh committed Aug 16, 2016
1 parent 9cbd007 commit 3758064
Show file tree
Hide file tree
Showing 28 changed files with 228 additions and 162 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Expand Up @@ -9,11 +9,9 @@

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

# Ignore Spring fikes
/spring/*.pid

# Ignore simplecov output.
/public/coverage
Expand Down
15 changes: 0 additions & 15 deletions CHANGELOG.md

This file was deleted.

49 changes: 6 additions & 43 deletions README.md
Expand Up @@ -4,56 +4,19 @@ This is the repository for Conney the Corgi's blog.

## Ruby Version

This application is intended to be run on Ruby 1.8.7-p173. Due to limitations of my current host Ruby 1.9 is not directly supported.
This application is intended to be run on Ruby 2.3.1.

## Rails Version

This application uses Rails 3.2.14

## Required Gems

The following gems are required to run this application:

* rails (3.2.14)
* mysql2
* cancan
* devise
* exception_notification (~> 3.0.1)
* highline
* honeypot-captcha
* httparty (~> 0.11.0)
* kaminari
* nokogiri (~> 1.5.10)
* paper_trail
* paperclip (~> 2.7)
* ransack
* sanitize (2.0.3)
* simple_form
* yaml_db
* jquery-fileupload-rails
* jquery-rails
* less-rails
* less-rails-bootstrap
* therubyracer
* uglifier
* capistrano (~> 2.15.5)
* capistrano-ext
* mailcatcher
* quiet_assets
* capybara (~> 2.0.3)
* database_cleaner
* factory_girl_rails (~> 2.0)
* rspec-rails
* shoulda-matchers (~> 1.5.6)
* simplecov
This application uses Rails 5.0.0.1.

## Local Development Installation

Clone the repository.

$ git clone git@github.com:seaneshbaugh/corgiblog.git corgiblog

cd into the project directory. If you don't have ruby-1.8.7-p173 already you will want to install it before doing this.
cd into the project directory. If you don't have ruby-2.3.1 already you will want to install it before doing this.

$ cd corgiblog

Expand All @@ -67,12 +30,12 @@ Create the databases.

Add the database tables.

$ rake db:migrate
$ RAILS_ENV=test rake db:migrate
$ rails db:migrate
$ RAILS_ENV=test rails db:migrate

Seed the database.

$ rake db:seed
$ rails db:seed_fu

## Contacts

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
@@ -1,6 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require_relative 'config/application'

Rails.application.load_tasks
Empty file modified bin/bundle 100644 → 100755
Empty file.
Empty file modified bin/rabbitmq_job_processor 100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions bin/rails 100644 → 100755
@@ -1,8 +1,9 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
5 changes: 3 additions & 2 deletions bin/rake 100644 → 100755
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Expand Down
29 changes: 17 additions & 12 deletions bin/setup 100644 → 100755
@@ -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"
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
12 changes: 6 additions & 6 deletions bin/spring 100644 → 100755
Expand Up @@ -4,12 +4,12 @@
# It gets overwritten when you run the `spring binstub` command.

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

if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
gem "spring", match[1]
require "spring/binstub"
if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
gem 'spring', match[1]
require 'spring/binstub'
end
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
3 changes: 2 additions & 1 deletion config.ru
@@ -1,4 +1,5 @@
# 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
13 changes: 1 addition & 12 deletions config/application.rb
@@ -1,4 +1,4 @@
require File.expand_path('../boot', __FILE__)
require_relative 'boot'

require 'rails/all'

Expand All @@ -12,17 +12,6 @@ class Application < Rails::Application
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'Central Time (US & Canada)'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true

config.autoload_paths += Dir[Rails.root.join('app', 'builders')]

config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]
Expand Down
2 changes: 1 addition & 1 deletion config/boot.rb
@@ -1,3 +1,3 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
9 changes: 9 additions & 0 deletions config/cable.yml
@@ -0,0 +1,9 @@
development:
adapter: async

test:
adapter: async

production:
adapter: redis
url: redis://localhost:6379/1
4 changes: 2 additions & 2 deletions config/database.yml
@@ -1,4 +1,4 @@
# PostgreSQL. Versions 8.2 and up are supported.
# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
# gem install pg
Expand All @@ -19,7 +19,7 @@ default: &default
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
<<: *default
Expand Down
8 changes: 4 additions & 4 deletions config/environment.rb
@@ -1,5 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
# Load the Rails application.
require_relative 'application'

# Initialize the rails application
Corgiblog::Application.initialize!
# Initialize the Rails application.
Rails.application.initialize!
35 changes: 24 additions & 11 deletions config/environments/development.rb
Expand Up @@ -9,13 +9,28 @@
# Do not eager load code on boot.
config.eager_load = false

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = 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?
config.action_controller.perform_caching = true

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

config.cache_store = :null_store
end

# 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

Expand All @@ -27,18 +42,16 @@
# number of complex assets.
config.assets.debug = true

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true

# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = 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

# Use Mailcatcher for sending email.
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
Expand Down

0 comments on commit 3758064

Please sign in to comment.