Pump rails version, fix tests

This commit is contained in:
Alex Sherman 2020-01-29 14:51:00 +05:00
parent 1a59487724
commit af57711dc0
13 changed files with 110 additions and 61 deletions

View file

@ -2,7 +2,7 @@ source 'https://rubygems.org'
# core # core
gem 'iso8601', '0.8.6' # for dates and times gem 'iso8601', '0.8.6' # for dates and times
gem 'rails', '~> 5.0.7' gem 'rails', '~> 5.1.7'
gem 'rest-client' gem 'rest-client'
gem 'uglifier' gem 'uglifier'

View file

@ -58,39 +58,39 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.0.7.2) actioncable (5.1.7)
actionpack (= 5.0.7.2) actionpack (= 5.1.7)
nio4r (>= 1.2, < 3.0) nio4r (~> 2.0)
websocket-driver (~> 0.6.1) websocket-driver (~> 0.6.1)
actionmailer (5.0.7.2) actionmailer (5.1.7)
actionpack (= 5.0.7.2) actionpack (= 5.1.7)
actionview (= 5.0.7.2) actionview (= 5.1.7)
activejob (= 5.0.7.2) activejob (= 5.1.7)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.0.7.2) actionpack (5.1.7)
actionview (= 5.0.7.2) actionview (= 5.1.7)
activesupport (= 5.0.7.2) activesupport (= 5.1.7)
rack (~> 2.0) rack (~> 2.0)
rack-test (~> 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7.2) actionview (5.1.7)
activesupport (= 5.0.7.2) activesupport (= 5.1.7)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.7.2) activejob (5.1.7)
activesupport (= 5.0.7.2) activesupport (= 5.1.7)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.0.7.2) activemodel (5.1.7)
activesupport (= 5.0.7.2) activesupport (= 5.1.7)
activerecord (5.0.7.2) activerecord (5.1.7)
activemodel (= 5.0.7.2) activemodel (= 5.1.7)
activesupport (= 5.0.7.2) activesupport (= 5.1.7)
arel (~> 7.0) arel (~> 8.0)
activesupport (5.0.7.2) activesupport (5.1.7)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
@ -104,7 +104,7 @@ GEM
akami (1.3.1) akami (1.3.1)
gyoku (>= 0.4.0) gyoku (>= 0.4.0)
nokogiri nokogiri
arel (7.1.4) arel (8.0.0)
autodoc (0.7.3) autodoc (0.7.3)
actionpack actionpack
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -181,6 +181,7 @@ GEM
dry-equalizer (~> 0.3) dry-equalizer (~> 0.3)
dry-inflector (~> 0.1, >= 0.1.2) dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2) dry-logic (~> 1.0, >= 1.0.2)
erubi (1.9.0)
erubis (2.7.0) erubis (2.7.0)
execjs (2.7.0) execjs (2.7.0)
ffi (1.12.2) ffi (1.12.2)
@ -294,20 +295,20 @@ GEM
rack (>= 0.4) rack (>= 0.4)
rack-protection (2.0.8.1) rack-protection (2.0.8.1)
rack rack
rack-test (0.6.3) rack-test (1.1.0)
rack (>= 1.0) rack (>= 1.0, < 3)
railroady (1.3.0) railroady (1.3.0)
rails (5.0.7.2) rails (5.1.7)
actioncable (= 5.0.7.2) actioncable (= 5.1.7)
actionmailer (= 5.0.7.2) actionmailer (= 5.1.7)
actionpack (= 5.0.7.2) actionpack (= 5.1.7)
actionview (= 5.0.7.2) actionview (= 5.1.7)
activejob (= 5.0.7.2) activejob (= 5.1.7)
activemodel (= 5.0.7.2) activemodel (= 5.1.7)
activerecord (= 5.0.7.2) activerecord (= 5.1.7)
activesupport (= 5.0.7.2) activesupport (= 5.1.7)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.0.7.2) railties (= 5.1.7)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@ -316,9 +317,9 @@ GEM
loofah (~> 2.3) loofah (~> 2.3)
rails-settings-cached (0.7.2) rails-settings-cached (0.7.2)
rails (>= 4.2.0) rails (>= 4.2.0)
railties (5.0.7.2) railties (5.1.7)
actionpack (= 5.0.7.2) actionpack (= 5.1.7)
activesupport (= 5.0.7.2) activesupport (= 5.1.7)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
@ -489,7 +490,7 @@ DEPENDENCIES
que que
que-web que-web
railroady (= 1.3.0) railroady (= 1.3.0)
rails (~> 5.0.7) rails (~> 5.1.7)
rails-settings-cached (= 0.7.2) rails-settings-cached (= 0.7.2)
ransack (~> 1.8) ransack (~> 1.8)
rest-client rest-client

View file

@ -1,33 +1,36 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'pathname' require 'pathname'
require 'fileutils' include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args) def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==") system(*args) || abort("\n== Command #{args} failed ==")
end 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! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install') system('bundle check') || system!('bundle install')
puts "\n== Copying sample development database config files ==" # Install JavaScript dependencies if using Yarn
unless File.exist?('config/database.yml') # system('bin/yarn')
system! 'cp config/database-example-development.yml config/database.yml'
end 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 ==" puts "\n== Preparing database =="
system! 'bin/rails db:setup' system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles ==" 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 ==" puts "\n== Restarting application server =="
system! 'touch tmp/restart.txt' system! 'bin/rails restart'
end end

0
bin/update Normal file → Executable file
View file

11
bin/yarn Executable file
View file

@ -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

View file

@ -16,6 +16,7 @@ end
module DomainNameRegistry module DomainNameRegistry
class Application < Rails::Application class Application < Rails::Application
#config.load_defaults 5.1
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.

View file

@ -7,3 +7,4 @@ test:
production: production:
adapter: redis adapter: redis
url: redis://localhost:6379/1 url: redis://localhost:6379/1
channel_prefix: domain_name_registry_production

View file

@ -66,7 +66,7 @@ Rails.application.configure do
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found). # 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. # Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify config.active_support.deprecation = :notify

View file

@ -5,7 +5,7 @@ Rails.application.configure do
config.assets.version = '1.0' config.assets.version = '1.0'
# Add additional assets to the asset load path # 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. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # 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(admin-manifest.css admin-manifest.js)
config.assets.precompile += %w(registrar-manifest.css registrar-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(registrant-manifest.css registrant-manifest.js)
config.assets.precompile += %w( admin.js admin.css )
end end

View file

@ -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

View file

@ -1,13 +1,13 @@
# Puma can serve each request in a thread from an internal thread pool. # 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 # 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 # 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 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 } port ENV.fetch("PORT") { 3000 }
@ -32,16 +32,25 @@ environment ENV.fetch("RAILS_ENV") { "development" }
# #
# preload_app! # 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 # 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 # 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!` # 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 # option, you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby # or connections that may have been created at application boot, as Ruby
# cannot share connections between processes. # cannot share connections between processes.
# #
# on_worker_boot do # on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end # end
#
# Allow puma to be restarted by `rails restart` command. # Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart plugin :tmp_restart

6
config/spring.rb Normal file
View file

@ -0,0 +1,6 @@
%w(
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
).each { |path| Spring.watch(path) }

View file

@ -13,6 +13,8 @@ class AuctionDoubleTest < ActiveSupport::TestCase
end end
class DNS::DomainNameTest < ActiveSupport::TestCase class DNS::DomainNameTest < ActiveSupport::TestCase
fixtures 'whois/records'
def test_available_when_not_at_auction def test_available_when_not_at_auction
domain_name = DNS::DomainName.new('auction.test') domain_name = DNS::DomainName.new('auction.test')
auctions(:one).update!(domain: 'auction.test', status: Auction.statuses[:domain_registered]) auctions(:one).update!(domain: 'auction.test', status: Auction.statuses[:domain_registered])