From 782f72c1a37f982cc3382a5f7fd695c6fb98f7ba Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Thu, 26 Mar 2020 02:15:20 +0200 Subject: [PATCH] Rails 5 updates + fix gemfile --- Gemfile | 2 +- config/application.rb | 8 ++++++-- config/boot.rb | 6 ++---- config/cable.yml | 10 ++++++++++ config/environment.rb | 4 ++-- config/spring.rb | 6 ++++++ config/storage.yml | 34 ++++++++++++++++++++++++++++++++++ 7 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 config/cable.yml create mode 100644 config/spring.rb create mode 100644 config/storage.yml diff --git a/Gemfile b/Gemfile index c11a763..20c9a59 100644 --- a/Gemfile +++ b/Gemfile @@ -44,7 +44,7 @@ gem 'time_difference' # External APIs gem 'google-api-client', '~> 0.10.3' -gem 'steam-condenser', g ithub: 'koraktor/steam-condenser-ruby' +gem 'steam-condenser', github: 'koraktor/steam-condenser-ruby' # FIXME: Legacy feature shims gem 'rails_autolink' diff --git a/config/application.rb b/config/application.rb index 36ff9ca..419c97d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,8 +1,9 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' -Bundler.require(*Rails.groups(assets: %w(development test))) +# Bundler.require(*Rails.groups(assets: %w(development test))) +Bundler.require(*Rails.groups) # FIXME ActionController::Parameters.permit_all_parameters = true @@ -12,6 +13,9 @@ module Ensl # Custom error pages config.exceptions_app = self.routes + # Load Rails 5 + config.load_defaults 5.0 + # Additional assets config.assets.precompile += ["themes/*/theme.css", "themes/*/errors.css"] config.assets.initialize_on_precompile = false diff --git a/config/boot.rb b/config/boot.rb index 63a2b1d..30f5120 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,5 +1,3 @@ -require 'rubygems' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..62a0455 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: test + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: ensl_production diff --git a/config/environment.rb b/config/environment.rb index 0c9b38c..e882e65 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,6 +1,6 @@ -require File.expand_path('../application', __FILE__) +require_relative 'application' require 'verification' require 'exceptions' ActiveSupport::Deprecation.silenced = true -Ensl::Application.initialize! +Rails.Application.initialize! diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 0000000..db5bf13 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +Spring.watch( + ".ruby-version", + ".rbenv-vars", + "tmp/restart.txt", + "tmp/caching-dev.txt" +) diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 0000000..d32f76e --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ]