diff --git a/Gemfile b/Gemfile index 17d1dbb..314e5c7 100644 --- a/Gemfile +++ b/Gemfile @@ -10,11 +10,11 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end -gem 'rails', '~> 5.2.0.beta2' +gem 'rails', '~> 6.0.0.beta2' gem 'bootsnap' gem 'bootstrap', '~> 4.2' -gem 'friendly_id' +gem 'friendly_id', github: 'norman/friendly_id' gem 'pg' gem 'puma' gem 'react-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 25f4865..58b303d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,60 +1,79 @@ +GIT + remote: https://github.com/norman/friendly_id.git + revision: a605404b083f015079f6e5dbd1f3df994a8a8fb1 + specs: + friendly_id (5.2.5) + activerecord (>= 4.0.0) + GEM remote: https://rubygems.org/ specs: CFPropertyList (2.3.6) - actioncable (5.2.2) - actionpack (= 5.2.2) + actioncable (6.0.0.beta2) + actionpack (= 6.0.0.beta2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) + actionmailbox (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activejob (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) + activestorage (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) + mail (>= 2.7.1) + actionmailer (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + actionview (= 6.0.0.beta2) + activejob (= 6.0.0.beta2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.2) - actionview (= 5.2.2) - activesupport (= 5.2.2) + actionpack (6.0.0.beta2) + actionview (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.2) - activesupport (= 5.2.2) + actiontext (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) + activestorage (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) + nokogiri (>= 1.8.5) + actionview (6.0.0.beta2) + activesupport (= 6.0.0.beta2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.2) - activesupport (= 5.2.2) + activejob (6.0.0.beta2) + activesupport (= 6.0.0.beta2) globalid (>= 0.3.6) - activemodel (5.2.2) - activesupport (= 5.2.2) - activerecord (5.2.2) - activemodel (= 5.2.2) - activesupport (= 5.2.2) - arel (>= 9.0) - activestorage (5.2.2) - actionpack (= 5.2.2) - activerecord (= 5.2.2) + activemodel (6.0.0.beta2) + activesupport (= 6.0.0.beta2) + activerecord (6.0.0.beta2) + activemodel (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) + activestorage (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) marcel (~> 0.3.1) - activesupport (5.2.2) + activesupport (6.0.0.beta2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - arel (9.0.0) + zeitwerk (~> 1.3, >= 1.3.1) ast (2.4.0) - autoprefixer-rails (9.4.7) + autoprefixer-rails (9.4.9) execjs babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) bindex (0.5.0) - bootsnap (1.3.2) + bootsnap (1.4.1) msgpack (~> 1.0) - bootstrap (4.2.1) + bootstrap (4.3.1) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) @@ -64,10 +83,10 @@ GEM concurrent-ruby (1.1.4) connection_pool (2.2.2) crass (1.0.4) - dotenv (2.6.0) - dotenv-rails (2.6.0) - dotenv (= 2.6.0) - railties (>= 3.2, < 6.0) + dotenv (2.7.1) + dotenv-rails (2.7.1) + dotenv (= 2.7.1) + railties (>= 3.2, < 6.1) em-proxy (0.1.9) eventmachine erubi (1.8.0) @@ -76,10 +95,8 @@ GEM facter (2.5.1) facter (2.5.1-universal-darwin) CFPropertyList (~> 2.2) - ffi (1.9.25) + ffi (1.10.0) formatador (0.2.5) - friendly_id (5.2.5) - activerecord (>= 4.0.0) globalid (0.4.2) activesupport (>= 4.2.0) guard (2.15.0) @@ -141,14 +158,14 @@ GEM minitest (5.11.3) msgpack (1.2.6) nenv (0.3.0) - newrelic_rpm (6.0.0.351) + newrelic_rpm (6.1.0.352) nio4r (2.3.1) nokogiri (1.10.1) mini_portile2 (~> 2.4.0) notiffany (0.1.1) nenv (~> 0.1) shellany (~> 0.0) - parallel (1.13.0) + parallel (1.14.0) parser (2.6.0.0) ast (~> 2.4.0) pg (1.1.4) @@ -158,6 +175,7 @@ GEM pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) + psych (3.1.0) puma (3.12.0) rack (2.0.6) rack-proxy (0.6.5) @@ -165,18 +183,20 @@ GEM rack-test (1.1.0) rack (>= 1.0, < 3) rack-toolbar (0.1.4) - rails (5.2.2) - actioncable (= 5.2.2) - actionmailer (= 5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) - activemodel (= 5.2.2) - activerecord (= 5.2.2) - activestorage (= 5.2.2) - activesupport (= 5.2.2) + rails (6.0.0.beta2) + actioncable (= 6.0.0.beta2) + actionmailbox (= 6.0.0.beta2) + actionmailer (= 6.0.0.beta2) + actionpack (= 6.0.0.beta2) + actiontext (= 6.0.0.beta2) + actionview (= 6.0.0.beta2) + activejob (= 6.0.0.beta2) + activemodel (= 6.0.0.beta2) + activerecord (= 6.0.0.beta2) + activestorage (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) bundler (>= 1.3.0) - railties (= 5.2.2) + railties (= 6.0.0.beta2) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -188,12 +208,12 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (5.2.2) - actionpack (= 5.2.2) - activesupport (= 5.2.2) + railties (6.0.0.beta2) + actionpack (= 6.0.0.beta2) + activesupport (= 6.0.0.beta2) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.0.0) rake (12.3.2) rb-fsevent (0.10.3) @@ -206,11 +226,12 @@ GEM railties (>= 3.2) tilt redis (4.1.0) - rubocop (0.63.1) + rubocop (0.65.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) + psych (>= 3.1.0) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.4.0) @@ -218,8 +239,8 @@ GEM ruby_dep (1.5.0) rubydns (0.8.5) eventmachine (~> 1.0.0) - sassc (2.0.0) - ffi (~> 1.9.6) + sassc (2.0.1) + ffi (~> 1.9) rake sassc-rails (2.1.0) railties (>= 4.0.0) @@ -227,7 +248,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - scenic (1.4.1) + scenic (1.5.1) activerecord (>= 4.0.0) railties (>= 4.0.0) shellany (0.0.1) @@ -268,6 +289,7 @@ GEM websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) + zeitwerk (1.3.1) PLATFORMS ruby @@ -277,7 +299,7 @@ DEPENDENCIES bootsnap bootstrap (~> 4.2) dotenv-rails - friendly_id + friendly_id! guard guard-bundler guard-rubocop @@ -289,7 +311,7 @@ DEPENDENCIES pgreset puma rack-toolbar - rails (~> 5.2.0.beta2) + rails (~> 6.0.0.beta2) rails_12factor react-rails redis @@ -304,4 +326,4 @@ RUBY VERSION ruby 2.6.1p33 BUNDLED WITH - 1.17.3 + 2.0.1 diff --git a/bin/bundle b/bin/bundle index f19acf5..524dfd3 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,105 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -load Gem.bin_path('bundler', 'bundle') +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "rubygems" + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV["BUNDLER_VERSION"] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + bundler_version = $1 || ">= 0.a" + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV["BUNDLE_GEMFILE"] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path("../../Gemfile", __FILE__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + Regexp.last_match(1) + end + + def bundler_version + @bundler_version ||= begin + env_var_version || cli_arg_version || + lockfile_version || "#{Gem::Requirement.default}.a" + end + end + + def load_bundler! + ENV["BUNDLE_GEMFILE"] ||= gemfile + + # must dup string for RG < 1.8 compatibility + activate_bundler(bundler_version.dup) + end + + def activate_bundler(bundler_version) + if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0") + bundler_version = "< 2" + end + gem_error = activation_error_handling do + gem "bundler", bundler_version + end + return if gem_error.nil? + require_error = activation_error_handling do + require "bundler/version" + end + return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path("bundler", "bundle") +end diff --git a/bin/guard b/bin/guard index 0c1a532..bcb966f 100755 --- a/bin/guard +++ b/bin/guard @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + # # This file was generated by Bundler. # @@ -6,11 +8,22 @@ # this file is here to facilitate running it. # -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath) -require 'rubygems' -require 'bundler/setup' +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('guard', 'guard') +load Gem.bin_path("guard", "guard") diff --git a/bin/invoker b/bin/invoker index e2b0415..afe0587 100755 --- a/bin/invoker +++ b/bin/invoker @@ -1,5 +1,6 @@ #!/usr/bin/env ruby # frozen_string_literal: true + # # This file was generated by Bundler. # @@ -11,6 +12,17 @@ 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" diff --git a/bin/rubocop b/bin/rubocop index eae5e84..d0c4882 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -1,8 +1,29 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rubocop' 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 'bundler/setup' -load Gem.bin_path('rubocop', 'rubocop') + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rubocop", "rubocop") diff --git a/bin/setup b/bin/setup index 94fd4d7..81b81ba 100755 --- a/bin/setup +++ b/bin/setup @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,7 +8,7 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do +FileUtils.chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. @@ -17,12 +16,12 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn + # Install JavaScript dependencies # system('bin/yarn') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" diff --git a/bin/update b/bin/update index 58bfaed..fe92711 100755 --- a/bin/update +++ b/bin/update @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,7 +8,7 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do +FileUtils.chdir APP_ROOT do # This script is a way to update your development environment automatically. # Add necessary update steps to this file. @@ -17,15 +16,15 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn + # Install JavaScript dependencies # system('bin/yarn') puts "\n== Updating database ==" - system! 'bin/rails db:migrate' + system! 'rails db:migrate' puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! 'rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! 'rails restart' end diff --git a/config/application.rb b/config/application.rb index c0f6c4e..8d5f038 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require File.expand_path('boot', __dir__) +require_relative 'boot' require 'rails/all' @@ -10,9 +10,12 @@ module MetaSurfForecast class Application < Rails::Application + config.load_defaults '6.0' + # 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. config.time_zone = 'UTC' diff --git a/config/boot.rb b/config/boot.rb index 30e594e..c04863f 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -3,3 +3,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. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..70324f5 --- /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: meta_surf_forecast_production diff --git a/config/environment.rb b/config/environment.rb index 32d57aa..d5abe55 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Load the Rails application. -require File.expand_path('application', __dir__) +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 968e174..460a41e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true Rails.application.configure do - config.webpacker.check_yarn_integrity = true + # 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 @@ -15,52 +15,57 @@ config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = 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 - # 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 + # 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.file_watcher = ActiveSupport::EventedFileUpdateChecker # Disable view rendering logs config.action_view.logger = nil - # Suppress static asset requests from server logs - config.assets.quiet = true + config.hosts << 'surf.test' config.middleware.insert_before ActionDispatch::ShowExceptions, Rack::Toolbar, snippet: '