Browse Source

Merge branch 'rails6'

pull/106/head
Jérémy Lecour 1 year ago
parent
commit
29ee6fae97
103 changed files with 3181 additions and 3208 deletions
  1. +0
    -18
      .babelrc
  2. +1
    -0
      .browserslistrc
  3. +7
    -3
      .gitignore
  4. +0
    -3
      .postcssrc.yml
  5. +3
    -4
      .travis.yml
  6. +24
    -27
      Gemfile
  7. +104
    -78
      Gemfile.lock
  8. +31
    -11
      INSTALL.md
  9. +1
    -0
      app/assets/config/manifest.js
  10. +1
    -1
      app/controllers/application_controller.rb
  11. +0
    -15
      app/frontend/scss/_variables.scss
  12. +0
    -4
      app/frontend/scss/index.js
  13. +0
    -0
      app/javascript/components/check_validation.js
  14. +12
    -14
      app/javascript/packs/application.js
  15. +15
    -0
      app/javascript/stylesheets/_custom.scss
  16. +3
    -4
      app/javascript/stylesheets/application.scss
  17. +0
    -0
      app/javascript/stylesheets/components/callouts.scss
  18. +0
    -0
      app/javascript/stylesheets/components/checks.scss
  19. +0
    -0
      app/javascript/stylesheets/components/notifications.scss
  20. +0
    -0
      app/javascript/stylesheets/components/users.scss
  21. +0
    -0
      app/javascript/stylesheets/icons.scss
  22. +1
    -1
      app/javascript/stylesheets/layout.scss
  23. +6
    -0
      app/jobs/application_job.rb
  24. +3
    -0
      app/jobs/ssl_sync_job.rb
  25. +3
    -0
      app/jobs/whois_sync_job.rb
  26. +2
    -6
      app/mailers/notifications_mailer.rb
  27. +8
    -1
      app/models/check.rb
  28. +0
    -2
      app/services/notifier.rb
  29. +0
    -2
      app/services/null_logger.rb
  30. +12
    -8
      app/services/ssl.rb
  31. +0
    -14
      app/services/ssl/errors.rb
  32. +0
    -3
      app/services/ssl/parser.rb
  33. +4
    -6
      app/services/system_command.rb
  34. +11
    -8
      app/services/whois.rb
  35. +0
    -14
      app/services/whois/errors.rb
  36. +0
    -10
      app/services/whois/parser.rb
  37. +0
    -4
      app/services/whois/parser/afilias.rb
  38. +0
    -4
      app/services/whois/parser/afnic.rb
  39. +0
    -3
      app/services/whois/parser/base.rb
  40. +0
    -4
      app/services/whois/parser/cira.rb
  41. +0
    -2
      app/services/whois/parser/entry/blank.rb
  42. +0
    -2
      app/services/whois/parser/entry/field.rb
  43. +0
    -2
      app/services/whois/parser/entry/text.rb
  44. +0
    -4
      app/services/whois/parser/entry_builder.rb
  45. +0
    -4
      app/services/whois/parser/io.rb
  46. +0
    -4
      app/services/whois/parser/neustar.rb
  47. +0
    -4
      app/services/whois/parser/sonic.rb
  48. +0
    -4
      app/services/whois/parser/verisign.rb
  49. +1
    -1
      app/views/checks/_filters.html.erb
  50. +49
    -50
      app/views/shared/_navbar.html.erb
  51. +72
    -0
      babel.config.js
  52. +104
    -2
      bin/bundle
  53. +0
    -5
      bin/rails
  54. +0
    -5
      bin/rake
  55. +6
    -6
      bin/setup
  56. +5
    -6
      bin/update
  57. +5
    -1
      bin/webpack
  58. +5
    -1
      bin/webpack-dev-server
  59. +7
    -2
      config/application.rb
  60. +4
    -0
      config/deploy.rb
  61. +21
    -0
      config/deploy/puma-chexpire@.service
  62. +4
    -3
      config/environments/development.rb
  63. +25
    -7
      config/environments/production.rb
  64. +4
    -7
      config/environments/test.rb
  65. +10
    -2
      config/initializers/content_security_policy.rb
  66. +3
    -0
      config/initializers/inflections.rb
  67. +45
    -0
      config/initializers/new_framework_defaults_6_0.rb
  68. +40
    -23
      config/puma.rb
  69. +2
    -2
      config/routes.rb
  70. +6
    -6
      config/spring.rb
  71. +2
    -3
      config/webpack/environment.js
  72. +32
    -2
      config/webpacker.yml
  73. +10
    -0
      db/migrate/20190816223645_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb
  74. +6
    -6
      db/schema.rb
  75. +0
    -4
      lib/errors.rb
  76. +0
    -2
      lib/tasks/checks.rake
  77. +0
    -2
      lib/tasks/notifications.rake
  78. +10
    -7
      package.json
  79. +12
    -0
      postcss.config.js
  80. +1
    -0
      script/to_production
  81. +8
    -0
      script/to_staging
  82. +1
    -1
      test/application_system_test_case.rb
  83. +0
    -1
      test/helpers/domain_helper_test.rb
  84. +82
    -86
      test/mailers/notifications_mailer_test.rb
  85. +18
    -0
      test/models/check_test.rb
  86. +3
    -5
      test/services/check_logger_test.rb
  87. +0
    -1
      test/services/notifier_test.rb
  88. +2
    -4
      test/services/ssl/parser_test.rb
  89. +9
    -11
      test/services/ssl_test.rb
  90. +1
    -2
      test/services/system_command_test.rb
  91. +8
    -11
      test/services/whois/parser/afilias_test.rb
  92. +4
    -7
      test/services/whois/parser/afnic_test.rb
  93. +4
    -7
      test/services/whois/parser/cira_test.rb
  94. +4
    -7
      test/services/whois/parser/io_test.rb
  95. +4
    -7
      test/services/whois/parser/neustar_test.rb
  96. +4
    -7
      test/services/whois/parser/sonic_test.rb
  97. +4
    -7
      test/services/whois/parser/verisign_test.rb
  98. +0
    -2
      test/services/whois/parser_test.rb
  99. +5
    -7
      test/services/whois_test.rb
  100. +5
    -5
      test/system/checks_test.rb

+ 0
- 18
.babelrc View File

@ -1,18 +0,0 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
["transform-class-properties", { "spec": true }]
]
}

+ 1
- 0
.browserslistrc View File

@ -0,0 +1 @@
defaults

+ 7
- 3
.gitignore View File

@ -19,9 +19,6 @@
# Ignore uploaded files in development
/storage/*
/node_modules
/yarn-error.log
/public/assets
.byebug_history
@ -44,3 +41,10 @@ yarn-debug.log*
# OS file
.DS_Store
/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity

+ 0
- 3
.postcssrc.yml View File

@ -1,3 +0,0 @@
plugins:
postcss-import: {}
postcss-cssnext: {}

+ 3
- 4
.travis.yml View File

@ -4,8 +4,8 @@
language:
- ruby
rvm:
- 2.3
- 2.4
### Zeitwerk is not fully compatible with < 2.5.4
### cf. https://github.com/Evolix/chexpire/pull/104
- 2.5
- 2.6
@ -23,8 +23,6 @@ services:
- mysql
before_install:
- gem update --system
- gem install bundler
- mysql -e 'CREATE DATABASE chexpire_test;'
- cp config/database.travis.yml config/database.yml
- cp config/secrets.example.yml config/secrets.yml
@ -37,6 +35,7 @@ install:
- bundle install
- yarn install
- rails db:create db:migrate
- rails webpacker:compile
script:
- bundle exec rubocop


+ 24
- 27
Gemfile View File

@ -1,45 +1,44 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '>= 2.3.3'
ruby '>= 2.5.4'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
gem 'rails-i18n', '~> 5.1'
gem 'rails', '6.0.0'
gem 'rails-i18n', '~> 6.0.0'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
gem 'devise', '~> 4.4'
gem 'devise-i18n', '~> 1.6'
# responders 3 depends on Ruy >= 2.4.0, let's keep a 2.x for now
gem 'responders', '~> 2.4.1'
gem 'puma', '~> 4.0'
gem 'devise', '~> 4.7'
gem 'devise-i18n', '~> 1.8'
gem 'simple_form', '~> 4.0'
gem 'pundit', '~> 1.1'
# Use SCSS for stylesheets
# sass-rails 5.1 depends on Ruy >= 2.4.0, let's keep 5.0.7 for now
gem 'sass-rails', '5.0.7'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem 'webpacker', '~> 3.5'
gem 'sass-rails', '~> 5'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
# gem 'coffee-rails', '~> 4.2'
gem 'bootstrap', '~> 4.3.1'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use ActiveModel has_secure_password
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
gem 'rack-contrib'
@ -55,12 +54,10 @@ gem 'has_scope'
gem 'logging'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'binding_of_caller'
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# gem 'binding_of_caller'
gem 'pry-byebug'
gem 'pry-rails'
@ -69,7 +66,7 @@ end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'web-console', '~> 4.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
@ -95,7 +92,7 @@ end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15', '< 4.0'
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'webdrivers'
gem 'launchy'


+ 104
- 78
Gemfile.lock View File

@ -1,47 +1,61 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.3)
actionpack (= 5.2.3)
actioncable (6.0.0)
actionpack (= 6.0.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
actionmailbox (6.0.0)
actionpack (= 6.0.0)
activejob (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
mail (>= 2.7.1)
actionmailer (6.0.0)
actionpack (= 6.0.0)
actionview (= 6.0.0)
activejob (= 6.0.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
actionpack (6.0.0)
actionview (= 6.0.0)
activesupport (= 6.0.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.0)
actionpack (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
nokogiri (>= 1.8.5)
actionview (6.0.0)
activesupport (= 6.0.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.0)
activesupport (= 6.0.0)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
activemodel (6.0.0)
activesupport (= 6.0.0)
activerecord (6.0.0)
activemodel (= 6.0.0)
activesupport (= 6.0.0)
activestorage (6.0.0)
actionpack (= 6.0.0)
activejob (= 6.0.0)
activerecord (= 6.0.0)
marcel (~> 0.3.1)
activesupport (5.2.3)
activesupport (6.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.1, >= 2.1.8)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
airbrussh (1.3.3)
@ -49,15 +63,18 @@ GEM
annotate (2.7.5)
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 13.0)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.6.1.1)
execjs
bcrypt (3.1.13)
bcrypt_pbkdf (1.0.1)
bindex (0.8.1)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootsnap (1.4.4)
msgpack (~> 1.0)
bootstrap (4.3.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
builder (3.2.3)
byebug (11.0.1)
capistrano (3.11.0)
@ -73,10 +90,10 @@ GEM
capistrano-rbenv (2.1.4)
capistrano (~> 3.1)
sshkit (~> 1.3)
capistrano3-puma (3.1.1)
capistrano3-puma (4.0.0)
capistrano (~> 3.7)
capistrano-bundler
puma (~> 3.4)
puma (~> 4.0)
capybara (3.28.0)
addressable
mini_mime (>= 0.1.3)
@ -92,11 +109,10 @@ GEM
concurrent-ruby (1.1.5)
crass (1.0.4)
database_cleaner (1.7.0)
debug_inspector (0.0.3)
devise (4.6.2)
devise (4.7.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.8.1)
@ -198,6 +214,7 @@ GEM
parallel (1.17.0)
parser (2.6.3.0)
ast (~> 2.4.0)
popper_js (1.14.5)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
@ -208,7 +225,8 @@ GEM
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (3.1.1)
puma (3.12.1)
puma (4.1.0)
nio4r (~> 2.0)
pundit (1.1.0)
activesupport (>= 3.0.0)
rack (2.0.7)
@ -218,33 +236,35 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
rails (6.0.0)
actioncable (= 6.0.0)
actionmailbox (= 6.0.0)
actionmailer (= 6.0.0)
actionpack (= 6.0.0)
actiontext (= 6.0.0)
actionview (= 6.0.0)
activejob (= 6.0.0)
activemodel (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
bundler (>= 1.3.0)
railties (= 5.2.3)
railties (= 6.0.0)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
rails-i18n (5.1.3)
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
railties (>= 6.0.0, < 7)
railties (6.0.0)
actionpack (= 6.0.0)
activesupport (= 6.0.0)
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.3)
rb-fsevent (0.10.3)
@ -253,9 +273,9 @@ GEM
rbnacl (4.0.2)
ffi
regexp_parser (1.6.0)
responders (2.4.1)
actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0)
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
rubocop (0.56.0)
parallel (~> 1.10)
parser (>= 2.5)
@ -271,12 +291,20 @@ GEM
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (2.1.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (3.142.3)
childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2)
@ -311,21 +339,19 @@ GEM
turbolinks-source (5.2.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.6.0)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
web-console (4.0.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 5.0)
railties (>= 6.0.0)
webdrivers (4.1.2)
nokogiri (~> 1.6)
rubyzip (~> 1.0)
selenium-webdriver (>= 3.0, < 4.0)
webpacker (3.6.0)
webpacker (4.0.7)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
@ -336,6 +362,7 @@ GEM
chronic (>= 0.6.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.1.9)
PLATFORMS
ruby
@ -344,23 +371,24 @@ DEPENDENCIES
annotate
bcrypt (~> 3.1.7)
bcrypt_pbkdf (>= 1.0, < 2.0)
binding_of_caller
bootsnap (>= 1.1.0)
bootsnap (>= 1.4.2)
bootstrap (~> 4.3.1)
byebug
capistrano (~> 3.10)
capistrano-rails (~> 1.4)
capistrano-rbenv
capistrano3-puma
capybara (>= 2.15, < 4.0)
capybara (>= 2.15)
database_cleaner
devise (~> 4.4)
devise-i18n (~> 1.6)
devise (~> 4.7)
devise-i18n (~> 1.8)
ed25519 (>= 1.2, < 2.0)
factory_bot_rails (~> 5.0)
guard
guard-minitest
has_scope
hashie
jbuilder (~> 2.5)
jbuilder (~> 2.7)
kaminari
launchy
letter_opener_web
@ -372,15 +400,14 @@ DEPENDENCIES
open4
pry-byebug
pry-rails
puma (~> 3.11)
puma (~> 4.0)
pundit (~> 1.1)
rack-contrib
rails (~> 5.2.0)
rails-i18n (~> 5.1)
rails (= 6.0.0)
rails-i18n (~> 6.0.0)
rbnacl (>= 3.2, < 5.0)
responders (~> 2.4.1)
rubocop (~> 0.56.0)
sass-rails (= 5.0.7)
sass-rails (~> 5)
selenium-webdriver
simple_form (~> 4.0)
simplecov
@ -388,14 +415,13 @@ DEPENDENCIES
spring-watcher-listen (~> 2.0.0)
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
web-console (~> 4.0)
webdrivers
webpacker (~> 3.5)
webpacker (~> 4.0)
whenever
RUBY VERSION
ruby 2.3.3p222
ruby 2.6.3p62
BUNDLED WITH
1.17.2

+ 31
- 11
INSTALL.md View File

@ -3,15 +3,15 @@
## Requirements
Chexpire requires :
* Ruby > 2.3.3 and Bundler
* Ruby > 2.5.4 and Bundler
* NodeJS and Yarn
* MySQL or MariaDB
We are usually running Chexpire on typical POSIX servers like :
- Linux Debian 9, Ruby 2.5.1, NodeJS 8.11 and MariaDB 10.1
- macOS High Sierra, Ruby 2.5.1, NodeJS 10.2.1 and MariaDB 10.2
- Linux Debian 9, Ruby 2.5.4, NodeJS 8.11 and MariaDB 10.1
- macOS High Sierra, Ruby 2.5.4, NodeJS 10.2.1 and MariaDB 10.2
It probably works on any system that supports Ruby >2.3, NodeJS >6 and MySQL >5.5. Feel free to report any unexpected incompatibilities.
It probably works on any system that supports Ruby >= 2.5.4, NodeJS >= 6 and MySQL >= 5.5. Feel free to report any unexpected incompatibilities.
If you use rbenv, chruby or RVM, you can set your prefered Ruby version in the `.ruby-version` file at the root of the project.
@ -21,7 +21,7 @@ If you are familiar with Ansible, you can use our [Ansible roles](http://forge.e
[…]
roles:
- mysql
- { role: rbenv, username: "{{ ansible_user }}", rbenv_ruby_version: "2.5.1" }
- { role: rbenv, username: "{{ ansible_user }}", rbenv_ruby_version: "2.5.4" }
- { role: nodejs, nodejs_install_yarn: yes }
[…]
```
@ -34,7 +34,7 @@ If you want to do manual installations, you can use our Wiki documentations for
Execute `# bundle install` to install Ruby gems (including Rails itself).
Execute `# yarn install` to install Javascript/NodeJS packages.
Execute `# yarn install --check-files` to install Javascript/NodeJS packages.
Depending on what is already installed on your OS or not, you might need to install a few system packages to be able to have everything working.
@ -45,15 +45,21 @@ To use elliptic curve SSH keys, we need to have `libsodium` and its headers.
* on macOS with Homebrew : `# brew install libsodium`.
## Rails configuration
## Application configuration
After cloning this repository, you have to create and edit a few files for your local development/test configuration. Theses files will be ignored by git.
### Environment variables
A handful of settings can be set by environment variables. If you use Heroku-like platforms they offer a simple way to set them.
If you use Rbenv, there is the `rbenv-vars` plugin. That is what we recommend on POSIX servers. You have to put an `.rbenv-vars` file at the root of the project. If you use Capistrano, put it in the shared directory and have it linked in the `current` directory at deploy time.
### Database configuration
Create the file if missing : `cp config/database.example.yml config/database.yml`. If you change the settings in the `defaults` section it applies to the `development` and `test` sections. More information is available at "guides.rubyonrails.org":https://guides.rubyonrails.org/configuring.html#configuring-a-database
Note that on Debian 9 with MariaDB, the database socket is at `/var/run/mysqld/mysqld.sock`, which is not the default in the configuration file.
Note that on Debian 9+ with MariaDB, the database socket is at `/var/run/mysqld/mysqld.sock`, which is not the default in the configuration file.
### Rails secrets
@ -63,7 +69,7 @@ Create the file if missing : `cp config/secrets.example.yml config/secrets.yml`.
Create the file if missing : `cp config/chexpire.example.yml config/chexpire.yml`. Set at least the `mailer_default_from` and `host` variables. See other configuration overridable in `config/chexpire.defaults.yml`.
## Database
## Database
You need databases for development and tests. You can create them like this (once connected to you MySQL server) :
@ -75,8 +81,8 @@ MariaDB [none]> CREATE DATABASE `chexpire_test`;
If you don't want to use the default `root` MySQL user with no password, you can create users :
```
MariaDB [none]> GRANT ALL PRIVILEGES ON `chexpire_development`.* TO `chexpire_development`@localhost IDENTIFIED BY 'MY_PASSWORD_FOR_DEV';
MariaDB [none]> GRANT ALL PRIVILEGES ON `chexpire_test`.* TO `chexpire_test`@localhost IDENTIFIED BY 'MY_PASSWORD_FOR_TEST';
MariaDB [none]> GRANT ALL PRIVILEGES ON `chexpire_development%`.* TO `chexpire_development`@localhost IDENTIFIED BY 'MY_PASSWORD_FOR_DEV';
MariaDB [none]> GRANT ALL PRIVILEGES ON `chexpire_test%`.* TO `chexpire_test`@localhost IDENTIFIED BY 'MY_PASSWORD_FOR_TEST';
MariaDB [none]> FLUSH PRIVILEGES;
```
@ -113,3 +119,17 @@ You can use the `script/to_staging` and/or `script/to_production` scripts.
* with `to_production` you deploy the `master` branch to production.
On the remote servers – where the application will be deployed – you have to copy the configuration files just as you've just did for your development setup. The files has to go in the `shared/config/` directory, relative to your `deploy_to` path. They will be symlinked to the proper destination by Capistrano.
If an `.rbenv-vars` file is found in the shared directory, it will be linked to help loading environment files (by Ruby via Rbenv, systemd…).
### systemd
If you want to use systemd to manage your Puma process, there are [a few different ways](https://github.com/puma/puma/blob/master/docs/systemd.md). We've prepared a systemd unit file (`config/deploy/puma-chexpire@.service`) but you can adjust to better suit your needs.
If you deploy your application to `/home/chexpire_<environment>`, the systemd unit can be used as a template, for example : `puma-chexpire@production.service`. This template is compatible with systemd actions like `systemctl stop puma-chexpire@production.service` and also with Capistrano tasks like `cap production puma:stop`.
To install the systemd unit :
```
$ cp config/deploy/puma-chexpire@.service /etc/systemd/system/puma-chexpire@.service
$ systemctl enable puma-chexpire@<environment>.service
```

+ 1
- 0
app/assets/config/manifest.js View File

@ -1 +1,2 @@
//= link_tree ../images
//= link_directory ../stylesheets .css

+ 1
- 1
app/controllers/application_controller.rb View File

@ -45,6 +45,6 @@ class ApplicationController < ActionController::Base
end
def render_404
render file: "#{Rails.root}/public/404", status: :not_found
render file: "#{Rails.root}/public/404.html", status: :not_found
end
end

+ 0
- 15
app/frontend/scss/_variables.scss View File

@ -1,15 +0,0 @@
// Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
// License: GNU AGPL-3+ (see full text in LICENSE file)
$input-placeholder-color: #b9bbbb;
$enable-rounded: false;
$theme-colors: (
"primary": #118b83, //light-green
"secondary": #013d3a, //dark-green
"tertiary": #be0c04, //red
"quaternary": #d6b20e, // yellow
"success": #118b83, //light-green
"warning": #F6AE2D,
"danger": #be0c04, //red
"info": #2E86AB,
);

+ 0
- 4
app/frontend/scss/index.js View File

@ -1,4 +0,0 @@
// Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
// License: GNU AGPL-3+ (see full text in LICENSE file)
import './index.scss';

app/frontend/components/check_validation.js → app/javascript/components/check_validation.js View File


app/frontend/packs/application.js → app/javascript/packs/application.js View File

@ -6,27 +6,25 @@
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb
import Rails from 'rails-ujs';
import Turbolinks from 'turbolinks';
import 'bootstrap/js/dist/collapse';
import 'bootstrap/js/dist/dropdown';
import 'bootstrap/js/dist/button';
import 'bootstrap/js/dist/tooltip';
require("@rails/ujs").start()
require("turbolinks").start()
// require("@rails/activestorage").start()
// require("channels")
import '../scss';
import 'bootstrap'
import '../stylesheets/application'
import checkValidationInitialize from '../components/check_validation';
Rails.start()
Turbolinks.start()
document.addEventListener("turbolinks:load", () => {
$('[data-toggle="tooltip"]').tooltip();
checkValidationInitialize();
});
// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)

+ 15
- 0
app/javascript/stylesheets/_custom.scss View File

@ -0,0 +1,15 @@
// Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
// License: GNU AGPL-3+ (see full text in LICENSE file)
$input-placeholder-color: #b9bbbb;
$enable-rounded: false;
$theme-colors: (
"primary": #118b83, //light-green
"secondary": #013d3a, //dark-green
"tertiary": #be0c04, //red
"quaternary": #d6b20e, //yellow
"success": #118b83, //light-green
"warning": #F6AE2D, //orange
"danger": #be0c04, //red
"info": #2E86AB, //light-blue
);

app/frontend/scss/index.scss → app/javascript/stylesheets/application.scss View File

@ -1,10 +1,9 @@
// Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
// License: GNU AGPL-3+ (see full text in LICENSE file)
@import '_variables';
@import '_custom';
@import '~bootstrap/scss/bootstrap';
@import 'layout';
@import 'icons';
@import 'components/callouts';
@import 'components/users';
@import 'components/checks';

app/frontend/scss/components/callouts.scss → app/javascript/stylesheets/components/callouts.scss View File


app/frontend/scss/components/checks.scss → app/javascript/stylesheets/components/checks.scss View File


app/frontend/scss/components/notifications.scss → app/javascript/stylesheets/components/notifications.scss View File


app/frontend/scss/components/users.scss → app/javascript/stylesheets/components/users.scss View File


app/frontend/scss/icons.scss → app/javascript/stylesheets/icons.scss View File


app/frontend/scss/layout.scss → app/javascript/stylesheets/layout.scss View File

@ -146,7 +146,7 @@ a.navbar-item.navbar-link {
.row {
height: 100%;
}
.homepage-img {
border: 1px solid map-get($theme-colors, secondary);
}

+ 6
- 0
app/jobs/application_job.rb View File

@ -1,4 +1,10 @@
class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
# from http://api.rubyonrails.org/classes/ActiveJob/Core.html
attr_writer :attempt_number


+ 3
- 0
app/jobs/ssl_sync_job.rb View File

@ -1,3 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
class SSLSyncJob < ApplicationJob
queue_as :default


+ 3
- 0
app/jobs/whois_sync_job.rb View File

@ -1,3 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
class WhoisSyncJob < ApplicationJob
queue_as :default


+ 2
- 6
app/mailers/notifications_mailer.rb View File

@ -11,19 +11,15 @@ class NotificationsMailer < ApplicationMailer
end
def domain_expires_soon
@expire_in_days = Integer(@check.domain_expires_at.to_date - Date.today)
I18n.with_locale params&.fetch(:locale) { @check.user.locale } do
subject = t(".subject", domain: @check.domain, count: @expire_in_days)
subject = t(".subject", domain: @check.domain, count: @check.domain_expires_in_days)
mail subject: subject, to: @notification.recipient
end
end
def ssl_expires_soon
@expire_in_days = Integer(@check.domain_expires_at.to_date - Date.today)
I18n.with_locale params&.fetch(:locale) { @check.user.locale } do
subject = t(".subject", domain: @check.domain, count: @expire_in_days)
subject = t(".subject", domain: @check.domain, count: @check.domain_expires_in_days)
mail subject: subject, to: @notification.recipient
end
end


+ 8
- 1
app/models/check.rb View File

@ -44,6 +44,8 @@ class Check < ApplicationRecord
enum kind: [:domain, :ssl]
enum mode: [:auto, :manual]
# Those dates are written as UTC,
# but not converted back when read from the database
self.skip_time_zone_conversion_for_attributes = [
:domain_created_at,
:domain_updated_at,
@ -82,7 +84,8 @@ class Check < ApplicationRecord
def days_from_last_success
return unless last_success_at.present?
(Date.today - last_success_at.to_date).to_i
# return the number of whole days
((Time.now - last_success_at) / (24 * 3600)).to_i
end
def increment_consecutive_failures!
@ -104,6 +107,10 @@ class Check < ApplicationRecord
end
end
def domain_expires_in_days
Integer(domain_expires_at.to_date - Time.now.utc.to_date)
end
private
def domain_created_at_past


+ 0
- 2
app/services/notifier.rb View File

@ -1,8 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "notifier/processor"
module Notifier
class << self
def process_all(configuration = nil)


lib/null_logger.rb → app/services/null_logger.rb View File

@ -1,6 +1,4 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "naught"
NullLogger = Naught.build

+ 12
- 8
app/services/ssl.rb View File

@ -1,13 +1,17 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "null_logger"
require "system_command"
require_relative "ssl/parser"
require_relative "ssl/response"
require_relative "ssl/errors"
module SSL
class Error < StandardError; end
class CommandError < Error; end
class ConfigurationError < Error; end
class ParserError < Error; end
class DomainNotMatchError < ParserError; end
class InvalidResponseError < ParserError; end
class InvalidDateError < ParserError; end
class << self
def ask(domain, system_klass: SystemCommand, logger: NullLogger.new)
Service.new(domain, system_klass: system_klass, logger: logger).call
@ -41,7 +45,7 @@ module SSL
result = command.execute
unless result.exit_status.zero?
fail SSLCommandError, "SSL command failed with status #{result.exit_status}"
fail SSL::CommandError, "SSL command failed with status #{result.exit_status}"
end
result
@ -69,7 +73,7 @@ module SSL
def custom_check_http_args
return nil unless configuration.check_http_args.present?
fail SSLConfigurationError, "check_http_args option must be an array of argument." \
fail SSL::ConfigurationError, "check_http_args option must be an array of argument." \
unless configuration.check_http_args.is_a?(Array)
configuration.check_http_args


+ 0
- 14
app/services/ssl/errors.rb View File

@ -1,14 +0,0 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
module SSL
class Error < StandardError; end
class SSLCommandError < Error; end
class SSLConfigurationError < Error; end
class ParserError < Error; end
class DomainNotMatchError < ParserError; end
class InvalidResponseError < ParserError; end
class InvalidDateError < ParserError; end
end

+ 0
- 3
app/services/ssl/parser.rb View File

@ -1,9 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "null_logger"
require "ssl/errors"
module SSL
class Parser
DATE_REGEX = /will expire on (.+)\./


+ 4
- 6
app/services/system_command.rb View File

@ -1,12 +1,10 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "open4"
require "null_logger"
SystemCommandResult = Struct.new(:command, :exit_status, :stdout, :stderr)
class SystemCommand
Result = Struct.new(:command, :exit_status, :stdout, :stderr)
class NotAllowedError < StandardError; end
attr_reader :program
attr_reader :args
attr_reader :logger
@ -42,7 +40,7 @@ class SystemCommand
pid, _, stdout, stderr = Open4.popen4 cmd
_, status = Process.waitpid2 pid
SystemCommandResult.new(
Result.new(
syscmd,
status.exitstatus || 255,
stdout.read.strip,


+ 11
- 8
app/services/whois.rb View File

@ -1,14 +1,17 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "null_logger"
require "domain_helper"
require "system_command"
require_relative "whois/parser"
require_relative "whois/response"
require_relative "whois/errors"
module Whois
class Error < StandardError; end
class CommandError < Error; end
class UnsupportedDomainError < Error; end
class DomainNotFoundError < Error; end
class ParserError < Error; end
class FieldNotFoundError < ParserError; end
class InvalidDateError < ParserError; end
class << self
def ask(domain, system_klass: SystemCommand, logger: NullLogger.new)
Service.new(domain, system_klass: system_klass, logger: logger).call
@ -39,7 +42,7 @@ module Whois
result = command.execute
unless result.exit_status.zero?
fail WhoisCommandError, "Whois command failed with status #{result.exit_status}"
fail Whois::CommandError, "Whois command failed with status #{result.exit_status}"
end
result


+ 0
- 14
app/services/whois/errors.rb View File

@ -1,14 +0,0 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
module Whois
class Error < StandardError; end
class WhoisCommandError < Error; end
class UnsupportedDomainError < Error; end
class DomainNotFoundError < Error; end
class ParserError < Error; end
class FieldNotFoundError < ParserError; end
class InvalidDateError < ParserError; end
end

+ 0
- 10
app/services/whois/parser.rb View File

@ -1,16 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "null_logger"
require "whois/errors"
require "whois/parser/afilias"
require "whois/parser/afnic"
require "whois/parser/cira"
require "whois/parser/io"
require "whois/parser/neustar"
require "whois/parser/sonic"
require "whois/parser/verisign"
module Whois
module Parser
PARSERS = [


+ 0
- 4
app/services/whois/parser/afilias.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "domain_helper"
require "whois/errors"
require_relative "base"
module Whois
module Parser
class Afilias < Base


+ 0
- 4
app/services/whois/parser/afnic.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "domain_helper"
require "whois/errors"
require_relative "base"
module Whois
module Parser
class AFNIC < Base


+ 0
- 3
app/services/whois/parser/base.rb View File

@ -1,10 +1,7 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "null_logger"
require_relative "../response"
require_relative "../errors"
require_relative "entry_builder"
module Whois
module Parser


+ 0
- 4
app/services/whois/parser/cira.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "domain_helper"
require "whois/errors"
require_relative "base"
module Whois
module Parser
class CIRA < Base


+ 0
- 2
app/services/whois/parser/entry/blank.rb View File

@ -1,8 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require_relative "base"
module Whois
module Parser
module Entry


+ 0
- 2
app/services/whois/parser/entry/field.rb View File

@ -1,8 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require_relative "base"
module Whois
module Parser
module Entry


+ 0
- 2
app/services/whois/parser/entry/text.rb View File

@ -1,8 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require_relative "base"
module Whois
module Parser
module Entry


+ 0
- 4
app/services/whois/parser/entry_builder.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require_relative "entry/blank"
require_relative "entry/field"
require_relative "entry/text"
module Whois
module Parser
class EntryBuilder


+ 0
- 4
app/services/whois/parser/io.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "domain_helper"
require "whois/errors"
require_relative "base"
module Whois
module Parser
class IO < Base


+ 0
- 4
app/services/whois/parser/neustar.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "domain_helper"
require "whois/errors"
require_relative "base"
module Whois
module Parser
class Neustar < Base


+ 0
- 4
app/services/whois/parser/sonic.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "domain_helper"
require "whois/errors"
require_relative "base"
module Whois
module Parser
class Sonic < Base


+ 0
- 4
app/services/whois/parser/verisign.rb View File

@ -1,10 +1,6 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
require "domain_helper"
require "whois/errors"
require_relative "base"
module Whois
module Parser
class Verisign < Base


+ 1
- 1
app/views/checks/_filters.html.erb View File

@ -33,7 +33,7 @@
</div>
<div class="col-auto">
<%= link_to Octicons::Octicon.new("x").to_svg.html_safe, checks_path, class: "btn btn-danger btn-sm btn-outline-danger" %>
<%= link_to Octicons::Octicon.new("x").to_svg.html_safe, checks_path, class: "btn btn-sm btn-outline-danger" %>
</div>
</div>


+ 49
- 50
app/views/shared/_navbar.html.erb View File

@ -1,63 +1,62 @@
<% # Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr> %>
<% # License: GNU AGPL-3+ (see full text in LICENSE file) %>
<nav class="navbar navbar-expand-lg navbar-dark justify-content-between">
<div class="container-fluid">
<%= link_to (user_signed_in? ? checks_path : root_path), class: "navbar-brand" do %>
<%= image_tag 'chexpire10.png', width: 200, alt: 'chexpire logo' %>
<% end %>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<% # License: GNU AGPL-3+ (see full text in LICENSE file) %>
<nav class="navbar navbar-expand-lg navbar-dark justify-content-between">
<div class="container-fluid">
<%= link_to (user_signed_in? ? checks_path : root_path), class: "navbar-brand" do %>
<%= image_tag 'chexpire10.png', width: 200, alt: 'chexpire logo' %>
<% end %>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<% if user_signed_in? %>
<li class="nav-item">
<%= link_to(t(".my_checks"), checks_path, class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to(t(".new_domain_check"), new_check_path(kind: :domain), class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to(t(".new_ssl_check"), new_check_path(kind: :ssl), class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to(t(".my_notifications"), notifications_path, class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to("GitHub", "https://github.com/Evolix/chexpire", class: "nav-link") %>
</li>
<% end %>
</ul>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<% if user_signed_in? %>
<li class="nav-item">
<%= link_to(t(".my_checks"), checks_path, class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to(t(".new_domain_check"), new_check_path(kind: :domain), class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to(t(".new_ssl_check"), new_check_path(kind: :ssl), class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to(t(".my_notifications"), notifications_path, class: "nav-link") %>
</li>
<li class="nav-item">
<%= link_to("GitHub", "https://github.com/Evolix/chexpire", class: "nav-link") %>
</li>
<% end %>
</ul>
<div class="my-2 my-lg-0">
<% if user_signed_in? %>
<div class="navbar-item">
<div class="dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= current_user.email %>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<%= link_to edit_user_registration_path, class: "dropdown-item" do %>
<div class="my-2 my-lg-0">
<% if user_signed_in? %>
<div class="navbar-item">
<div class="dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= current_user.email %>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<%= link_to edit_user_registration_path, class: "dropdown-item" do %>
<i class="fa fa-user"></i>
<%= t(".profile", default: "Profile") %>
<% end %>
<%= link_to destroy_user_session_path, method: :delete, class: "dropdown-item" do %>
<i class="fa fa-sign-out"></i>
<%= t(".sign_out", default: "Sign out") %>
<% end %>
<i class="fa fa-sign-out"></i>
<%= t(".sign_out", default: "Sign out") %>
<% end %>
</div>
</div>
</div>
</div>
<% else %>
<!-- Login link (when logged out) -->
<%= link_to t(".sign_in"), new_user_session_path, class: "navbar-item navbar-link" %>
<%= link_to t(".sign_up"), new_user_registration_path, class: "navbar-item navbar-link" %>
<%= link_to "GitHub", "https://github.com/Evolix/chexpire", class: "navbar-item navbar-link" %>
<% end %>
<% else %>
<!-- Login link (when logged out) -->
<%= link_to t(".sign_in"), new_user_session_path, class: "navbar-item navbar-link" %>
<%= link_to t(".sign_up"), new_user_registration_path, class: "navbar-item navbar-link" %>
<%= link_to "GitHub", "https://github.com/Evolix/chexpire", class: "navbar-item navbar-link" %>
<% end %>
</div>
</div>
</div>
</div>
</nav>

+ 72
- 0
babel.config.js View File

@ -0,0 +1,72 @@
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
var isTestEnv = api.env('test')
if (!validEnv.includes(currentEnv)) {
throw new Error(
'Please specify a valid `NODE_ENV` or ' +
'`BABEL_ENV` environment variables. Valid values are "development", ' +
'"test", and "production". Instead, received: ' +
JSON.stringify(currentEnv) +
'.'
)
}
return {
presets: [
isTestEnv && [
require('@babel/preset-env').default,
{
targets: {
node: 'current'
}
}
],
(isProductionEnv || isDevelopmentEnv) && [
require('@babel/preset-env').default,
{
forceAllTransforms: true,
useBuiltIns: 'entry',
corejs: 3,
modules: false,
exclude: ['transform-typeof-symbol']
}
]
].filter(Boolean),
plugins: [
require('babel-plugin-macros'),
require('@babel/plugin-syntax-dynamic-import').default,
isTestEnv && require('babel-plugin-dynamic-import-node'),
require('@babel/plugin-transform-destructuring').default,
[
require('@babel/plugin-proposal-class-properties').default,
{
loose: true
}
],
[
require('@babel/plugin-proposal-object-rest-spread').default,
{
useBuiltIns: true
}
],
[
require('@babel/plugin-transform-runtime').default,
{
helpers: false,
regenerator: true,
corejs: false
}
],
[
require('@babel/plugin-transform-regenerator').default,
{
async: false
}
]
].filter(Boolean)
}
}

+ 104
- 2
bin/bundle View File

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

+ 0
- 5
bin/rails View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'

+ 0
- 5
bin/rake View File

@ -1,9 +1,4 @@
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run

+ 6
- 6
bin/setup View File

@ -1,6 +1,5 @@
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
@ -9,24 +8,25 @@ 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.
FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
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 =="
system! 'bin/rails db:setup'
system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'


+ 5
- 6
bin/update View File

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