Skip to content

Commit

Permalink
Merge branch 'development' into issue3291
Browse files Browse the repository at this point in the history
  • Loading branch information
briri committed Mar 23, 2023
2 parents e149fd4 + 4d82975 commit 82f9777
Show file tree
Hide file tree
Showing 149 changed files with 1,487 additions and 5,606 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ jobs:

steps:
# Checkout the repo
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Install Ruby and run bundler
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6
ruby-version: '3.0'
bundler-cache: true

# Install Node
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '16.6.0'
cache: 'yarn'
node-version: 16

Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,21 @@ jobs:

steps:
# Checkout the repo
- uses: actions/checkout@v2
- uses: actions/checkout@v3

# Install Ruby and run bundler
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6
ruby-version: '3.0'
bundler-cache: true

## - run: echo 'NODE_OPTIONS="--openssl-legacy-provider"' >> $GITHUB_ENV
## /home/runner/runners/2.301.1/externals/node12/bin/node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

# Install Node
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '16.6.0'
cache: 'yarn'
node-version: 16

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# Install Ruby and run bundler
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6
ruby-version: '3.0'
bundler-cache: true

# Run the Rubocop linter checks
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ yarn-debug.log*
/yarn-error.log
yarn-debug.log*
.yarn-integrity
/app/assets/builds/*
!/app/assets/builds/.keep

# Ignore briley AWS cloud9 script to start the application
cloud9-start.sh
cloud9-start.sh
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
#
# Try to place any new Cops under their relevant section and in alphabetical order

require:
# - rubocop-rails
# - rubocop-rspec
- rubocop-performance

AllCops:
# Show the name of the cops being voilated in the feedback
DisplayCopNames: true
Expand Down
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# Changelog

## v4.1.0

**Note this upgrade is a migration from Ruby v2.7.6 to v3.0.5.** Note that this could have an impact on any customizations you may have made to your fork of this project. Please see https://www.fastruby.io/blog/ruby/upgrades/upgrade-ruby-from-2.7-to-3.0.html for further information on what to check. In particular, please note the changes to the way [Ruby 3 handles keyword arguments](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/)

**Note that the Webpacker gem has been removed in favor of jsbundling-rails.** This was done in preparation for the future migration to Rails 7. See [issue #3185](https://github.com/DMPRoadmap/roadmap/issues/3185) for more details on this change. If, after migrating to this version, you see 'Sprockets' related errors in your application you will need to rebuild you asset library. To do this run `bin/rails assets:clobber && bin/rails assets:precompile` from the project directory.

### Upgrade to Ruby 3

- Upgrade to Ruby version 3.0.5 [#3225](https://github.com/DMPRoadmap/roadmap/issues/3225)
- Bumped all Github actions to use ruby 3.0
- Removed `.freeze` from Regex and Range constants since those types are already immutable
- Fixed Rubocop complaint about redundancy of `r.nil? ? nil : r.user`, so changed it to `r&.user` in `app/models/plan.rb`
- Fixed Rubocop complaint about redundant `::` in config.log_formatter = `::Logger::Formatter.new` in `config/environments/production.rb`
- Froze `lib/deprecators/*.rb` constants that were Strings
- Updated places that were incorrectly using keyword args. See [this article](https://makandracards.com/makandra/496481-changes-to-positional-and-keyword-args-in-ruby-3-0) for an overview

#### Removed webpacker gem

As Webpacker is no longer maintained by the Rails community, we have replaced it by `jsbundling-rails` and `cssbundling-rails` for the Javascript & CSS compilation.

- Removed `webpacker` gem
- Added `jsbundling-rails`
- Updated webpack and its configuration to V5
- Moved `app/javascript/packs/application.js` to `app/javascript/application.js`
- Removed `ruby-sass` gem
- Added `cssbundling-rails` gem and DartSass JS library
- Updated SASS stylesheets following the migration to the latest version of the `sass` package (See below).
- Removed `font-awesome-sass` gem and used `@fortawesome/fontawesome-free` npm package
- Issue with `@import 'font-awesome-sprockets';` line in `app/assets/stylesheets/application.scss`. Removed that line after referring to the latest font-awesome install/setup guide which no longer includes it.

With the removal of Webpacker, the Javascript/SASS code is no longer automaticaly compiled when using the `rails server` command. It has been replaced by the `bin/dev` command that launch the rails server and the processes that watch for changes in the SASS and Javascript code.

#### SASS update : removal of the `@import` keyword

With the removal of the webpacker gem, the DartSass package has been installed to ensure the compilation of the Sass stylesheet and with it, an update to the Sass version used by the code :
- `@import` keyword for custom stylesheets has been removed (although we can still import stylesheets from externals packages) and has been replaced by `@use` and `@forward`
- An `_index.scss` file have to be created in folders containing multiple sass files. Each file have to be included in the index with the `@use` or `@forward` keyword.
- In most cases `@import` can be replaced by `@use` when importing a file.
- `@forward` makes mixins, functions and variables available when a stylesheet is loaded.
- When imported, Sass variables are now namespaced with the file name in which they are declared (ex : `color: colors.$red`). A namespace can be renamed (ex : `@use "colours" as c;`) or removed when included (ex : `@use "colours" as *;`)
- Sass variables are no longer declared globally and have to be included in files where they are used.
For more detailed explanation, please refer to this video : https://www.youtube.com/watch?v=CR-a8upNjJ0

### Cleanup of Capybara configuration
- Cleaned up Gemfile by:
- removing gems that were already commented out
- removed selenium-webdriver and capybara-webmock
- removing version restrictions on: danger, font-awesome-sass, webdrivers
- Cleaned up `spec/rails_helper.rb` and `spec/spec_helper.rb`
- Simplified the `spec/support/capybara.rb` helper to work with the latest version of Capybara and use its built in headless Chrome driver

### Added Rubocop performance gem
- Installed rubocop-performance gem and made suggested changes

### Bug Fixes


## v4.0.2

### Added

- Added CHANGELOG.md and Danger Github Action [#3257](https://github.com/DMPRoadmap/roadmap/issues/3257)
Expand All @@ -8,6 +67,8 @@

### Fixed

- Fixed an issue that was preventing uses from leaving the research output byte_size field blank
- Patched issue that was causing template visibility to default to organizationally visible after saving
- Froze mail gem version [#3254](https://github.com/DMPRoadmap/roadmap/issues/3254)
- Updated the CSV export so that it now includes research outputs
- Updated sans-serif font used in PDF downloads to Roboto since Google API no longer offers Helvetica
Expand Down
79 changes: 12 additions & 67 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

ruby '>= 2.7'
ruby '>= 3.0'

# ===========#
# CORE RAILS #
Expand All @@ -17,19 +17,16 @@ gem 'rails', '~> 6.1'
# Analysis of the issue: https://www.theregister.com/2021/03/25/ruby_rails_code/
gem 'mimemagic'

# Use sqlite3 as the database for Active Record
# gem 'sqlite3', '~> 1.4'

# Use Puma as the app server
gem 'puma', group: :puma, require: false

# Use SCSS for stylesheets
# TODO : might need to move to cssbundling-rails
# SEE: https://dev.to/kolide/how-to-migrate-a-rails-6-app-from-sass-rails-to-cssbundling-rails-4l41
gem 'sass-rails'
# Use esbuild, rollup.js, or Webpack to bundle your JavaScript, then deliver it via the asset pipeline in Rails
# Read more: https://github.com/rails/jsbundling-rails
gem 'jsbundling-rails'

# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker'
# Use Tailwind CSS, Bootstrap, Bulma, PostCSS, or Dart Sass to bundle and process your CSS
# Read more: https://github.com/rails/cssbundling-rails
gem 'cssbundling-rails'

# Turbo gives you the speed of a single-page web application without having to write any JavaScript..
# Read more: https://github.com/hotwired/turbo-rails
Expand All @@ -50,14 +47,6 @@ gem 'jbuilder'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false

# GEMS ADDED TO HELP HANDLE RAILS MIGRATION FROM 3.x to 4.2
# THESE GEMS HELP SUPPORT DEPRACATED FUNCTIONALITY AND WILL LOSE SUPPORT IN
# FUTURE VERSIONS WE SHOULD CONSIDER BRINGING THE CODE UP TO DATE INSTEAD

# A set of Rails responders to dry up your application
# (http://github.com/plataformatec/responders)
# gem "responders"

# ============== #
# ERROR HANDLING #
# ============== #
Expand Down Expand Up @@ -161,23 +150,10 @@ gem 'api-pagination'
# STYLESHEETS #
# =========== #

# Integrate SassC-Ruby into Rails. (https://github.com/sass/sassc-rails)
gem 'sassc-rails'

# Font-Awesome SASS (https://github.com/FortAwesome/font-awesome-sass)
gem 'font-awesome-sass', '~> 5'

# Use webpack to manage app-like JavaScript modules in Rails
# (https://github.com/rails/webpacker)
# gem "webpacker"

# Parse CSS and add vendor prefixes to CSS rules using values from the Can
# I Use website. (https://github.com/ai/autoprefixer-rails)
gem 'autoprefixer-rails'

# Minimal embedded v8 for Ruby (https://github.com/discourse/mini_racer)
# gem "mini_racer"

# ========= #
# EXPORTING #
# ========= #
Expand Down Expand Up @@ -250,18 +226,10 @@ group :test do
# Guard keeps an eye on your file modifications (https://github.com/guard/guard)
gem 'guard'

# Guard gem for RSpec (https://github.com/guard/guard-rspec)
# gem 'guard-rspec'

# Library for stubbing HTTP requests in Ruby.
# (http://github.com/bblimke/webmock)
gem 'webmock'

# Code coverage for Ruby 1.9+ with a powerful configuration library and
# automatic merging of coverage across test suites
# (http://github.com/colszowka/simplecov)
# gem 'simplecov', require: false

# Strategies for cleaning databases. Can be used to ensure a clean state
# for testing. (http://github.com/DatabaseCleaner/database_cleaner)
gem 'database_cleaner', require: false
Expand All @@ -275,17 +243,9 @@ group :test do

# Adds support for Capybara system testing and selenium driver
gem 'capybara'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers', '~> 5.2'

# Automatically create snapshots when Cucumber steps fail with Capybara
# and Rails (http://github.com/mattheworiordan/capybara-screenshot)
# gem 'capybara-screenshot'

# Browser integration tests are expensive. We can mock external requests
# in our tests, but once a browser is involved, we lose control.
gem 'capybara-webmock'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'

# RSpec::CollectionMatchers lets you express expected outcomes on
# collections of an object in an example.
Expand All @@ -299,7 +259,7 @@ group :test do
gem 'rails-controller-testing'

# automating code review
gem 'danger', '~> 9.0', require: false
gem 'danger'
end

group :ci, :development do
Expand All @@ -319,23 +279,8 @@ group :ci, :development do
# (gettext and rails-i18n)
gem 'rubocop-i18n'

# A collection of RuboCop cops to check for performance optimizations in Ruby code.
# gem 'rubocop-performance'

# Automatic Rails code style checking tool. A RuboCop extension focused on enforcing
# Rails best practices and coding conventions.
# gem 'rubocop-rails'

# A RuboCop plugin for Rake tasks
# gem 'rubocop-rake'

# Code style checking for RSpec files. A plugin for the RuboCop code style enforcing
# & linting tool.
# gem 'rubocop-rspec'

# Thread-safety checks via static analysis. A plugin for the RuboCop code style
# enforcing & linting tool.
# gem 'rubocop-thread_safety'
# Performance checks by Rubocop
gem 'rubocop-performance', require: false
end

group :development do
Expand Down
Loading

0 comments on commit 82f9777

Please sign in to comment.