diff --git a/Gemfile b/Gemfile index b3882e792..57e78ed84 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # core gem 'iso8601', '0.8.6' # for dates and times -gem 'rails', '~> 5.0.7' +gem 'rails', '~> 5.1.7' gem 'rest-client' gem 'uglifier' diff --git a/Gemfile.lock b/Gemfile.lock index 6c374892f..381645baa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,39 +58,39 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.0.7.2) - actionpack (= 5.0.7.2) - nio4r (>= 1.2, < 3.0) + actioncable (5.1.7) + actionpack (= 5.1.7) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) + actionmailer (5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.7.2) - actionview (= 5.0.7.2) - activesupport (= 5.0.7.2) + actionpack (5.1.7) + actionview (= 5.1.7) + activesupport (= 5.1.7) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.7.2) - activesupport (= 5.0.7.2) + actionview (5.1.7) + activesupport (= 5.1.7) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.7.2) - activesupport (= 5.0.7.2) + activejob (5.1.7) + activesupport (= 5.1.7) globalid (>= 0.3.6) - activemodel (5.0.7.2) - activesupport (= 5.0.7.2) - activerecord (5.0.7.2) - activemodel (= 5.0.7.2) - activesupport (= 5.0.7.2) - arel (~> 7.0) - activesupport (5.0.7.2) + activemodel (5.1.7) + activesupport (= 5.1.7) + activerecord (5.1.7) + activemodel (= 5.1.7) + activesupport (= 5.1.7) + arel (~> 8.0) + activesupport (5.1.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -104,7 +104,7 @@ GEM akami (1.3.1) gyoku (>= 0.4.0) nokogiri - arel (7.1.4) + arel (8.0.0) autodoc (0.7.3) actionpack activesupport (>= 3.0.0) @@ -181,6 +181,7 @@ GEM dry-equalizer (~> 0.3) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) + erubi (1.9.0) erubis (2.7.0) execjs (2.7.0) ffi (1.12.2) @@ -294,20 +295,20 @@ GEM rack (>= 0.4) rack-protection (2.0.8.1) rack - rack-test (0.6.3) - rack (>= 1.0) + rack-test (1.1.0) + rack (>= 1.0, < 3) railroady (1.3.0) - rails (5.0.7.2) - actioncable (= 5.0.7.2) - actionmailer (= 5.0.7.2) - actionpack (= 5.0.7.2) - actionview (= 5.0.7.2) - activejob (= 5.0.7.2) - activemodel (= 5.0.7.2) - activerecord (= 5.0.7.2) - activesupport (= 5.0.7.2) + rails (5.1.7) + actioncable (= 5.1.7) + actionmailer (= 5.1.7) + actionpack (= 5.1.7) + actionview (= 5.1.7) + activejob (= 5.1.7) + activemodel (= 5.1.7) + activerecord (= 5.1.7) + activesupport (= 5.1.7) bundler (>= 1.3.0) - railties (= 5.0.7.2) + railties (= 5.1.7) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -316,9 +317,9 @@ GEM loofah (~> 2.3) rails-settings-cached (0.7.2) rails (>= 4.2.0) - railties (5.0.7.2) - actionpack (= 5.0.7.2) - activesupport (= 5.0.7.2) + railties (5.1.7) + actionpack (= 5.1.7) + activesupport (= 5.1.7) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -489,7 +490,7 @@ DEPENDENCIES que que-web railroady (= 1.3.0) - rails (~> 5.0.7) + rails (~> 5.1.7) rails-settings-cached (= 0.7.2) ransack (~> 1.8) rest-client diff --git a/bin/setup b/bin/setup index b3067cf22..b5ca43ac5 100755 --- a/bin/setup +++ b/bin/setup @@ -1,33 +1,36 @@ #!/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 -Dir.chdir APP_ROOT do +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. - puts '== Installing dependencies with bundler ==' + puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - puts "\n== Copying sample development database config files ==" - unless File.exist?('config/database.yml') - system! 'cp config/database-example-development.yml config/database.yml' - end + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + puts "\n== Copying sample files ==" + unless File.exist?('config/database.yml') + system! 'cp config/database.yml.sample config/database.yml' + end puts "\n== Preparing database ==" system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rake log:clear tmp:clear' + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system! 'touch tmp/restart.txt' - + system! 'bin/rails restart' end diff --git a/bin/update b/bin/update old mode 100644 new mode 100755 diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 000000000..c2bacef83 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index c70ab2111..57a3878a9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -16,6 +16,7 @@ end module DomainNameRegistry class Application < Rails::Application + #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. diff --git a/config/cable.yml b/config/cable.yml index 0bbde6f74..858bb1f14 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -7,3 +7,4 @@ test: production: adapter: redis url: redis://localhost:6379/1 + channel_prefix: domain_name_registry_production diff --git a/config/environments/production.rb b/config/environments/production.rb index c2262235d..6e13ea1f7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -66,7 +66,7 @@ Rails.application.configure do # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = [I18n.default_locale] + config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index d3b8408d5..ba78ea325 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,7 +5,7 @@ Rails.application.configure do config.assets.version = '1.0' # Add additional assets to the asset load path - config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts') + config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts', 'node_modules') # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. @@ -14,4 +14,5 @@ Rails.application.configure do config.assets.precompile += %w(admin-manifest.css admin-manifest.js) config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js) config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js) + config.assets.precompile += %w( admin.js admin.css ) end diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb new file mode 100644 index 000000000..9010abd5c --- /dev/null +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Unknown asset fallback will return the path passed in when the given +# asset is not present in the asset pipeline. +# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/puma.rb b/config/puma.rb index c7f311f81..1e19380dc 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,13 +1,13 @@ # Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers a minimum and maximum. +# The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum, this matches the default thread size of Active Record. +# and maximum; this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads threads_count, threads_count -# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # port ENV.fetch("PORT") { 3000 } @@ -32,16 +32,25 @@ environment ENV.fetch("RAILS_ENV") { "development" } # # preload_app! +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker -# process is booted this block will be run, if you are using `preload_app!` -# option you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, Ruby +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby # cannot share connections between processes. # # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end +# # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 000000000..c9119b40c --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } diff --git a/test/models/dns/domain_name_test.rb b/test/models/dns/domain_name_test.rb index bd83076bc..4f8922d32 100644 --- a/test/models/dns/domain_name_test.rb +++ b/test/models/dns/domain_name_test.rb @@ -13,6 +13,8 @@ class AuctionDoubleTest < ActiveSupport::TestCase end class DNS::DomainNameTest < ActiveSupport::TestCase + fixtures 'whois/records' + def test_available_when_not_at_auction domain_name = DNS::DomainName.new('auction.test') auctions(:one).update!(domain: 'auction.test', status: Auction.statuses[:domain_registered])