diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..c7fbd00 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,281 @@ +--- +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Snippets +# +# Reusable snippets are defined below this section. These are yaml fragments that can injected into the standard +# CircleCI configuration, reducing the complexity of the entire block. +# --------------------------------------------------------------------------------------------------------------------- +version: 2.1 + +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Commands Configuration +# +# Commands are re-usable steps that can be shared across jobs. For example the installation of gems using bundler or +# waiting on a database connection. By defining them inside the commands section, they can be invoked as any standard +# command on the system, but will already be preconfigured. This allows us to keep the jobs definition small and clean +# --------------------------------------------------------------------------------------------------------------------- +commands: + install_dependencies: + description: "Installs the required OS packages to ensure all gems compile" + steps: + - run: + name: "Aptitude Install" + command: | + apt update + apt install -y --no-install-recommends libsqlite3-dev pkg-config + appraisal_install: + description: "Performs the bundler installation, relying on the CircleCI cache for performance" + parameters: + ruby-version: + type: string + steps: + - restore_cache: + keys: + - appraisal-cache-<< parameters.ruby-version >>-1.1-{{ checksum "is_it_ready.gemspec" }} + - run: + name: "Appraisal Install" + command: | + gem install bundler:1.17.3 --force + bundle config --local path vendor/bundle + bundle install --jobs 4 --retry 3 + bundle exec appraisal install + - save_cache: + key: appraisal-cache-<< parameters.ruby-version >>-1.1-{{ checksum "is_it_ready.gemspec" }} + paths: + - vendor/bundle + +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Job Configuration +# +# This section defines all the available jobs that can be executed inside a Workflow. +# Think of a Job as a batch of tasks that need to be performed to setup the environment and perform a specific task +# such as running RSpec, uploading the test results to CodeClimate etc. +# --------------------------------------------------------------------------------------------------------------------- +jobs: + tests: + parameters: + ruby-version: + type: string + gemfile: + type: string + docker: + - image: 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/ruby:focal-<< parameters.ruby-version >> + user: root + aws_auth: + aws_access_key_id: ${PRODUCTION_AWS_ACCESS_KEY_ID} + aws_secret_access_key: ${PRODUCTION_AWS_SECRET_ACCESS_KEY} + environment: + RAILS_ENV: test + RACK_ENV: test + steps: + - checkout + - install_dependencies + - appraisal_install: + ruby-version: << parameters.ruby-version >> + - run: + name: "Tests" + command: bundle exec appraisal << parameters.gemfile >> rake test + - store_artifacts: + path: ./coverage + - store_test_results: + path: ./test/reports + - store_artifacts: + path: ./test/reports + build_and_publish: + docker: + - image: 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/ruby:focal-3.0 + aws_auth: + aws_access_key_id: ${PRODUCTION_AWS_ACCESS_KEY_ID} + aws_secret_access_key: ${PRODUCTION_AWS_SECRET_ACCESS_KEY} + user: root + steps: + - checkout + - run: + name: "Configure Rubygems" + command: | + mkdir ~/.gem + touch ~/.gem/credentials + echo "---" >> ~/.gem/credentials + echo ":github: Bearer $CINK_CIRCLE_CI_GITHUB_PACKAGES_TOKEN" >> ~/.gem/credentials + chmod 600 ~/.gem/credentials + - run: + name: "Gem build" + command: gem build is_it_up.gemspec + - run: + name: "Gem Push" + command: gem push --key github --host https://rubygems.pkg.github.com/customink is_it_up-*.gem + +# --------------------------------------------------------------------------------------------------------------------- +# CircleCI Workflow Execution Order +# +# Here we define the Workflow, the order of the various jobs and their dependencies. +# This allows us to decide whether to run certain tasks sequentially or run several of them in parallel. +# --------------------------------------------------------------------------------------------------------------------- +workflows: + version: 2.1 + build-and-test: + jobs: + # Ruby 2.2 + - tests: + name: "Ruby 2.2 with Ruby on Rails 3.2" + context: "customink" + gemfile: "rails32" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 with Ruby on Rails 4.0" + context: "customink" + gemfile: "rails40" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 with Ruby on Rails 4.1" + context: "customink" + gemfile: "rails41" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 with Ruby on Rails 4.2" + context: "customink" + gemfile: "rails42" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 with Ruby on Rails 5.0" + context: "customink" + gemfile: "rails50" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 with Ruby on Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.2" + - tests: + name: "Ruby 2.2 with Ruby on Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.2" + # Ruby 2.3 + - tests: + name: "Ruby 2.3 with Ruby on Rails 5.0" + context: "customink" + gemfile: "rails50" + ruby-version: "2.3" + - tests: + name: "Ruby 2.3 with Ruby on Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.3" + - tests: + name: "Ruby 2.3 with Ruby on Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.3" + # Ruby 2.4 + - tests: + name: "Ruby 2.4 with Ruby on Rails 5.0" + context: "customink" + gemfile: "rails50" + ruby-version: "2.4" + - tests: + name: "Ruby 2.4 with Ruby on Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.4" + - tests: + name: "Ruby 2.4 with Ruby on Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.4" + # Ruby 2.5 + - tests: + name: "Ruby 2.5 with Ruby on Rails 5.1" + context: "customink" + gemfile: "rails51" + ruby-version: "2.5" + - tests: + name: "Ruby 2.5 with Ruby on Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.5" + - tests: + name: "Ruby 2.5 with Ruby on Rails 6.0" + context: "customink" + gemfile: "rails60" + ruby-version: "2.5" + - tests: + name: "Ruby 2.5 with Ruby on Rails 6.1" + context: "customink" + gemfile: "rails61" + ruby-version: "2.5" + # Ruby 2.6 + - tests: + name: "Ruby 2.6 with Ruby on Rails 5.2" + context: "customink" + gemfile: "rails52" + ruby-version: "2.6" + - tests: + name: "Ruby 2.6 with Ruby on Rails 6.0" + context: "customink" + gemfile: "rails60" + ruby-version: "2.6" + - tests: + name: "Ruby 2.6 with Ruby on Rails 6.1" + context: "customink" + gemfile: "rails61" + ruby-version: "2.6" + # Ruby 2.7 + - tests: + name: "Ruby 2.7 with Ruby on Rails 6.0" + context: "customink" + gemfile: "rails60" + ruby-version: "2.7" + - tests: + name: "Ruby 2.7 with Ruby on Rails 6.1" + context: "customink" + gemfile: "rails61" + ruby-version: "2.7" + - tests: + name: "Ruby 2.7 with Ruby on Rails 7.0.0" + context: "customink" + gemfile: "rails70" + ruby-version: "2.7" + # Ruby 3.0 + - tests: + name: "Ruby 3.0 with Ruby on Rails 7.0.0" + context: "customink" + gemfile: "rails70" + ruby-version: "3.0" + # Ruby 3.1 + - tests: + name: "Ruby 3.1 with Ruby on Rails 7.0" + context: "customink" + gemfile: "rails7" + ruby-version: "3.1" + - build_and_publish: + context: "customink" + requires: + - "Ruby 2.2 with Ruby on Rails 3.2" + - "Ruby 2.2 with Ruby on Rails 4.0" + - "Ruby 2.2 with Ruby on Rails 4.1" + - "Ruby 2.2 with Ruby on Rails 4.2" + - "Ruby 2.2 with Ruby on Rails 5.0" + - "Ruby 2.2 with Ruby on Rails 5.1" + - "Ruby 2.2 with Ruby on Rails 5.2" + - "Ruby 2.3 with Ruby on Rails 5.0" + - "Ruby 2.3 with Ruby on Rails 5.1" + - "Ruby 2.3 with Ruby on Rails 5.2" + - "Ruby 2.4 with Ruby on Rails 5.1" + - "Ruby 2.4 with Ruby on Rails 5.2" + - "Ruby 2.5 with Ruby on Rails 5.1" + - "Ruby 2.5 with Ruby on Rails 5.2" + - "Ruby 2.5 with Ruby on Rails 6.0" + - "Ruby 2.5 with Ruby on Rails 6.1" + - "Ruby 2.6 with Ruby on Rails 5.2" + - "Ruby 2.6 with Ruby on Rails 6.0" + - "Ruby 2.6 with Ruby on Rails 6.1" + - "Ruby 2.7 with Ruby on Rails 6.0" + - "Ruby 2.7 with Ruby on Rails 6.1" + - "Ruby 2.7 with Ruby on Rails 7.0.0" + - "Ruby 3.0 with Ruby on Rails 7.0.0" + - "Ruby 3.1 with Ruby on Rails 7.0" + filters: + branches: + only: + - main diff --git a/.gitignore b/.gitignore index 1dfe31e..512b02c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ test/dummy/db/*.sqlite3 test/dummy/log/*.log test/dummy/tmp/ test/dummy/.sass-cache +gemfiles/ +vendor/ +Gemfile.lock diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..0d3ad67 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.2.10 diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..91115bc --- /dev/null +++ b/Appraisals @@ -0,0 +1,75 @@ +# This is the Appraisals file that determines which specific gems should be tested based upon the selected +# Ruby version and Ruby on Rails framework. +# Because each of these configurations have their own requirements, we will build a compatibility matrix and +# make sure that each step includes the correct version of Ruby on Rails, and freezes the dependencies to the +# requirements of that version. + +# Ruby 2.2 will be used to test all EOL Ruby on Rails versions still in use by Custom Ink. +# This is simply to provide a guarantee our code works against them until we can drop these versions. +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.3.0') + appraise 'rails32' do + gem 'rails', '~> 3.2.0' + gem 'rake', '< 13' + end + + appraise 'rails40' do + gem 'rails', '~> 4.0.0' + gem 'rake', '< 13' + end + + appraise 'rails41' do + gem 'rails', '~> 4.1.0' + gem 'rake', '< 13' + end + + appraise 'rails42' do + gem 'rails', '~> 4.2.0' + gem 'rake', '< 13' + end +end + +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.5.0') + appraise 'rails50' do + gem 'rails', '~> 5.0.0' + gem 'rake', '< 13' + end +end + +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.6.0') + appraise 'rails51' do + gem 'rails', '~> 5.1.0' + gem 'rake', '< 13' + end +end + +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.7.0') + appraise 'rails52' do + gem 'rails', '~> 5.2.0' + gem 'rake', '< 13' + end +end + +# For Ruby versions >= 2.5.0 and < 3.0 we can test all Rails 6 +if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.5.0') && ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('3.0.0') + appraise 'rails60' do + gem 'rails', '~> 6.0.0' + end + + appraise 'rails61' do + gem 'rails', '~> 6.1.0' + end +end + +# Ruby on Rails 7.0.0 recommends Ruby to be >= 2.7.0 +if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.7.0') + appraise 'rails70' do + gem 'rails', '7.0.0' + end +end + +# Ruby on Rails 7.0.x recommend Ruby to be >= 3.1.0 +if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1.0') + appraise 'rails7' do + gem 'rails', '~> 7.0.0' + end +end diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5c43904 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Is It Ready? CHANGELOG + +## 0.0.2 +* Enabled the CircleCI Pipeline +* Added the test matrix +* Updated documentation + +## 0.0.1 +* Initial implementation diff --git a/Gemfile b/Gemfile index 3c136af..3ca4444 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,24 @@ -source "https://rubygems.org" +source 'https://rubygems.org' # Declare your gem's dependencies in is_it_ready.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec -# jquery-rails is used by the dummy application -gem "jquery-rails" +# On Ruby 2.2, the gem test-unit is not included anymore by default +# For Rails 3.2, this is a required dependency, so ensure this is installed automatically for all +# versions of Ruby that support Rails 3.2 +if ::Gem::Version.new(RUBY_VERSION) < ::Gem::Version.new('2.5.0') + gem 'test-unit', '~> 3.0' +end -# Required since Ruby 2.2 -gem 'test-unit', '~> 3.0' +# These are testing dependencies for the CircleCI environment and our general test reporting. +# They don't need to be inside the gemspec as they are specific to the CI, not the project. +group :test do + gem 'appraisal' + gem 'minitest-ci', require: false + gem 'simplecov', require: false + + # jquery-rails is used by the dummy application + gem 'jquery-rails' +end diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 557cad0..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,108 +0,0 @@ -PATH - remote: . - specs: - is_it_ready (0.0.1) - rails (~> 3.2.22.5) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (3.2.22.5) - actionpack (= 3.2.22.5) - mail (~> 2.5.4) - actionpack (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) - activerecord (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - activesupport (3.2.22.5) - i18n (~> 0.6, >= 0.6.4) - multi_json (~> 1.0) - arel (3.0.3) - builder (3.0.4) - concurrent-ruby (1.1.10) - erubis (2.7.0) - hike (1.2.3) - i18n (0.9.5) - concurrent-ruby (~> 1.0) - journey (1.0.4) - jquery-rails (3.1.5) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.6) - mail (2.5.5) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (5.15.0) - multi_json (1.15.0) - polyglot (0.3.5) - power_assert (2.0.1) - rack (1.4.7) - rack-cache (1.9.0) - rack (>= 0.4) - rack-ssl (1.3.4) - rack - rack-test (0.6.3) - rack (>= 1.0) - rails (3.2.22.5) - actionmailer (= 3.2.22.5) - actionpack (= 3.2.22.5) - activerecord (= 3.2.22.5) - activeresource (= 3.2.22.5) - activesupport (= 3.2.22.5) - bundler (~> 1.0) - railties (= 3.2.22.5) - railties (3.2.22.5) - actionpack (= 3.2.22.5) - activesupport (= 3.2.22.5) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (13.0.6) - rdoc (3.12.2) - json (~> 1.4) - sprockets (2.2.3) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.13) - test-unit (3.5.3) - power_assert - thor (1.2.1) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.61) - -PLATFORMS - ruby - -DEPENDENCIES - is_it_ready! - jquery-rails - minitest - sqlite3 (~> 1.3.5) - test-unit (~> 3.0) - -BUNDLED WITH - 1.17.3 diff --git a/README.md b/README.md index b9fa0c2..b170e5e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Is It Ready? +[![CircleCI](https://dl.circleci.com/status-badge/img/gh/customink/is_it_ready/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/customink/is_it_ready/tree/main) + A Ruby gem that adds a simple Rails engine to your application to see if it's ready to serve requests. The endpoint and mounting options are configurable using the standard Rails conventions. @@ -10,6 +12,21 @@ and allows Kubernetes to add/remove applications from the load-balancer based up * Ruby `>= 2.2.0` * Ruby on Rails `>= 3.2.22.5` +### Compatibility Matrix +This Matrix provides an overview on which versions of Ruby are tested against which Ruby on Rails versions. +These combinations are guaranteed to work, whereas other combinations might work but are not guaranteed. + +| Ruby Version | Rails `~> 3.2` | Rails `~> 4.0` | Rails `~> 4.1` | Rails `~> 4.2` | Rails `~> 5.0` | Rails `~> 5.1` | Rails `~> 5.2` | Rails `~> 6.0` | Rails `~> 6.1` | Rails 7.0.0 | Rails `~> 7.0` | +|--------------|----------------|----------------|----------------|----------------|----------------|----------------|----------------|----------------|----------------|-------------|----------------| +| `2.2` | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | ☑️ | - | - | - | - | +| `2.3` | - | - | - | - | ☑️ | ☑️ | ☑️ | - | - | - | - | - | +| `2.4` | - | - | - | - | ☑️ | ☑️ | ☑️ | - | - | - | - | - | +| `2.5` | - | - | - | - | - | ☑️ | ☑️ | ☑️ | ☑️ | - | - | - | +| `2.6` | - | - | - | - | - | - | ☑️ | ☑️ | ☑️ | - | - | - | +| `2.7` | - | - | - | - | - | - | - | ☑️ | ☑️ | ☑️ | - | +| `3.0` | - | - | - | - | - | - | - | - | - | ☑️ | - | +| `3.1` | - | - | - | - | - | - | - | - | - | - | ☑️ | + ## Installation Add this line to your application's Gemfile: @@ -26,6 +43,37 @@ And then execute: ## Usage +Simply mount the engine in your `config/routes.rb` and the routes will be available under the given path. + +```ruby +Rails.application.routes.draw do + mount IsItReady::Engine => "/is_it_ready" +end +``` + +With the above snippet, the health check will be available under: + +* https://your-domain/is_it_ready +* https://your-domain/is_it_ready/is_it_ready + +## Configuration + +Sometimes additional configuration might be required. For example when the endpoint is reserved in your application +or conflicts with another plugin. In this case, creating an initializer under `config/initializers/is_it_ready.rb` can help. + +```ruby +# Initializer example to overwrite specific settings for the gem, or to enable certain features. +# + +# Overwrite the endpoint that's used for listening to the required calls from the ReadinessProbe. +# Setting this value, changes the second entry to be the path defined here, as well as the path under which +# the application has been mounted: +# * https://your-domain/ +# * https://your-domain//something_else +# This is more for cosmetic purposes, or when mountain multiple engines under the same endpoint with distinct routes. +::IsItReady.endpoint = '/something_else' +``` + ## Contributing 1. Fork it (https://github.com/customink/is_it_ready/fork). diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000..bf0ee0b --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,4 @@ +// Required for Rails 6+ and Sprockets +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..d69c321 --- /dev/null +++ b/bin/console @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +require 'bundler/setup' +require 'is_it_ready' + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require 'irb' +::IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..1c6928a --- /dev/null +++ b/bin/setup @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle config --local path vendor/bundle +bundle install + +# Do any other automated setup that you need to do here diff --git a/bin/test b/bin/test new file mode 100755 index 0000000..1ad9db8 --- /dev/null +++ b/bin/test @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +set -e + +echo "== Running Appraisal Install ==" + +bundle exec appraisal install + +echo "== Running tests ==" + +bundle exec appraisal rake test diff --git a/is_it_ready.gemspec b/is_it_ready.gemspec index dce3c37..61c7dda 100644 --- a/is_it_ready.gemspec +++ b/is_it_ready.gemspec @@ -13,11 +13,26 @@ Gem::Specification.new do |s| s.summary = "Rails Engine to verify whether application can serve traffic" s.description = "An internal tool used by Custom Ink to take application from the Kubernetes load-balancer" + # Specify the required version to ensure we keep up to date with releases and gem requirements + s.required_ruby_version = '>= 2.2.0' + + # Ensure that people are actually using an up to date version of RubyGems + unless s.respond_to?(:metadata) + raise(::StandardError, 'RubyGems 2.0 or newer is required to protect against public gem pushes') + end + + s.metadata['allowed_push_host'] = 'https://rubygems.pkg.github.com/customink' + s.metadata['homepage_uri'] = s.homepage + s.metadata['source_code_uri'] = 'https://github.com/customink/is_it_ready' + s.metadata['changelog_uri'] = 'https://github.com/customink/is_it_ready/CHANGELOG.md' + s.metadata['rubygems_mfa_required'] = 'true' + s.files = Dir["{app,config,db,lib}/**/*"] + %w[MIT-LICENSE Rakefile README.md] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 3.2.22.5" + s.add_dependency "rails" - s.add_development_dependency "sqlite3", '~> 1.3.5' + s.add_development_dependency "sqlite3" s.add_development_dependency "minitest" + s.add_development_dependency "bundler" end diff --git a/lib/is_it_ready/version.rb b/lib/is_it_ready/version.rb index 42cd4cc..0549d4e 100644 --- a/lib/is_it_ready/version.rb +++ b/lib/is_it_ready/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module IsItReady - VERSION = '0.0.1' + VERSION = '0.0.2' end diff --git a/test/dummy/app/assets/config/manifest.js b/test/dummy/app/assets/config/manifest.js new file mode 100644 index 0000000..bf0ee0b --- /dev/null +++ b/test/dummy/app/assets/config/manifest.js @@ -0,0 +1,4 @@ +// Required for Rails 6+ and Sprockets +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 93b765e..c87c404 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -28,32 +28,6 @@ class Application < Rails::Application # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Enable escaping HTML in JSON. - config.active_support.escape_html_entities_in_json = true - - # Use SQL instead of Active Record's schema dumper when creating the database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - config.active_record.whitelist_attributes = true - - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' end end diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb index 82c74d1..21f33a8 100644 --- a/test/dummy/config/environments/development.rb +++ b/test/dummy/config/environments/development.rb @@ -1,6 +1,9 @@ Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # Do not eager load the code in the development environment + config.eager_load = false + # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. @@ -22,8 +25,10 @@ # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict + if ::Gem::Version.new(::Rails.version) < ::Gem::Version.new('4.0.0') + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + end # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb index bdac56a..18c1e3f 100644 --- a/test/dummy/config/environments/production.rb +++ b/test/dummy/config/environments/production.rb @@ -1,6 +1,9 @@ Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # Eager load all code + config.eager_load = true + # Code is not reloaded between requests config.cache_classes = true diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb index f1a4814..53e870c 100644 --- a/test/dummy/config/environments/test.rb +++ b/test/dummy/config/environments/test.rb @@ -1,6 +1,9 @@ Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # Do not eager load our code + config.eager_load = false + # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped @@ -29,8 +32,10 @@ # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict + if ::Gem::Version.new(::Rails.version) < ::Gem::Version.new('4.0.0') + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + end # Print deprecation notices to the stderr config.active_support.deprecation = :stderr