Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Dependency, Rails, and Ruby upgrade main branch #912

Draft
wants to merge 128 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
49fa422
Replace poltergeist with apparition; fix failing tests
esoterik Feb 3, 2021
18200f0
Upgrade to ruby 2.7.2
esoterik Feb 6, 2021
2a07151
Upgrade gems to fix deprecation errors; fix failing tests
esoterik Feb 6, 2021
51ac505
Upgrade rubocop to v0.82
esoterik Feb 9, 2021
a47c358
Remove old tasks
esoterik Feb 11, 2021
bea1fe3
Fix rubocop errors
esoterik Feb 11, 2021
a2bf91d
Disable some naming cops inline
esoterik Feb 11, 2021
e245d5a
Disable some rails cops inline
esoterik Feb 11, 2021
44366a8
Disable some Style cops inline
esoterik Feb 11, 2021
bacaafe
Swap paperclip for kt-paperclip; upgrade aws gems
esoterik Feb 9, 2021
ff713fe
Upgrade from factory_bot to factory_girl
esoterik Feb 9, 2021
22be908
Upgrade jbuilder
esoterik Feb 16, 2021
175671d
Remove descriptive statistics gem
esoterik Feb 16, 2021
001705c
Continue FactoryBot upgrade
esoterik Feb 16, 2021
d2ec3f5
Fix pgsearch deprecations
esoterik Feb 16, 2021
db28908
Remove user percentile rank tracking
esoterik Feb 16, 2021
fb47478
Fix failing tests
esoterik Feb 17, 2021
9ecfc7d
More rubocop autofixes
esoterik Feb 18, 2021
1b33d8d
Remove webshims-rails
esoterik Feb 18, 2021
69be899
Remove rails_12factor
esoterik Feb 18, 2021
46306b9
Remove very old image compressor gem
esoterik Feb 18, 2021
3c38c8e
Add missing gem version specifier
esoterik Feb 18, 2021
30eb4ef
Cleanup Gemfile
esoterik Feb 19, 2021
26aba5c
Disable new rubocop cops for now
esoterik Feb 19, 2021
db2c61e
Fix some deprecations
esoterik Feb 20, 2021
11154ac
Initial Rails 5.1 install
esoterik Feb 26, 2021
b1b51a0
Fix image tags, rename CongressMember.filter to .search
esoterik Feb 27, 2021
57c7b84
Fix failing tests
esoterik Feb 27, 2021
bf64835
Finish Rails 5.2 upgrade
esoterik Mar 11, 2021
0cfc10d
Rubocop fixes
esoterik Mar 11, 2021
283f955
Fix asset compilation in dockerfile
esoterik Mar 12, 2021
95efcec
Fix docker entrypoint
esoterik Mar 12, 2021
9ce20e2
Fix rebase error
esoterik Mar 26, 2021
bd6a8a6
Merge branch 'master' into 494_rails_51
esoterik Feb 23, 2022
7fed138
Update mimemagic
esoterik Feb 23, 2022
d075622
Update to rails 5.2.6
esoterik Feb 23, 2022
40434f8
Update node version for Docker
esoterik Feb 23, 2022
e0ef999
Get docker container to build again
esoterik Feb 23, 2022
ded6756
enable state-level emails to be created in the admin panel and sent f…
wtcruft May 23, 2022
a110693
WIP code review response for state level emails
wtcruft Mar 27, 2023
237ba9a
finishing code review for state level emails
wtcruft Jul 19, 2023
7f586b6
leftover CR
wtcruft Aug 29, 2023
077ad3f
Merge branch 'state_level_emails' into rails_52_state_level
esoterik Sep 26, 2023
9f1db3a
Rubocop fixes
esoterik Sep 27, 2023
736c2aa
Remove extremely old development gems
esoterik Sep 28, 2023
b98693e
Fixing test suite; email campaign specs fixed
esoterik Sep 28, 2023
5b6e8cf
Modernize signature factory
esoterik Sep 28, 2023
ceb643b
Update sanitize gem to fix signatures
esoterik Sep 28, 2023
fc8e287
Finish fixing institutions model spec + make complex query safer
esoterik Sep 28, 2023
e68079a
Rubocop
esoterik Sep 28, 2023
1203bf4
FactoryGirl -> FactoryBot
esoterik Sep 28, 2023
1d41357
Swap back to selenium + bundle update
esoterik Sep 29, 2023
55d23da
Downgrade psych gem to < 4
esoterik Sep 29, 2023
1a67458
Config for selenium
esoterik Sep 29, 2023
3e6ffae
Rename remaining .css.scss files in vendor
esoterik Sep 29, 2023
4552c42
Start swapping to selenium
esoterik Oct 1, 2023
10e6f19
Attempt to upgrade selenium-webdriver to v4.11 to support newer versi…
esoterik Oct 1, 2023
2116bf8
Start ruby 3 upgrade
esoterik Oct 1, 2023
e7c9f61
Remove fontello gem + run bundle install
esoterik Oct 1, 2023
4295c08
Start rails 6 upgrade
esoterik Oct 1, 2023
5d33bb3
Upgrade selenium-webdriver to 4.13.1
esoterik Oct 1, 2023
81da389
Upgrade factory_bot_rails v4.11 -> v5.2
esoterik Oct 1, 2023
281f873
Upgrade rspec-rails to 4.1
esoterik Oct 1, 2023
f4593ae
Update factory_bot_rails to v6.2
esoterik Oct 1, 2023
eeef8c1
Update activerecord-session_store -- requires upgrading sessions
esoterik Oct 1, 2023
2b0d255
Fix test db naming
esoterik Feb 8, 2024
116c548
Replace straggling FactoryGirl references
esoterik Feb 8, 2024
525e612
Fixing tests
esoterik Feb 8, 2024
e8eeea1
Start rails 6.1 upgrade
esoterik Feb 8, 2024
98dac4e
begin fixing tests
esoterik Feb 23, 2024
d4fb522
ahoy_matey 1.6 -> v2
esoterik Feb 23, 2024
ceb38a8
Upgrade to ahoy_matey v5
esoterik Feb 23, 2024
9c01f2c
Revert "Upgrade to ahoy_matey v5"
esoterik Feb 23, 2024
462b7e8
WIP ahoy upgrade
esoterik Apr 3, 2024
c3bfa0c
Fix failing tests in tools_controller_spec.rb
jparr Apr 4, 2024
8ceb24e
Set DatabaseCleaner to append_after
jparr Apr 5, 2024
33c81e9
Fix fill attributes in lib/congress_forms
jparr Apr 4, 2024
be75e6f
Fix action_creation_spec
jparr Apr 5, 2024
eebcb8e
Fixing deprecation warnings
jparr Apr 5, 2024
1aa958a
Fixing deprecation warnings dynamic controller actions no longer supp…
jparr Apr 5, 2024
043ef9b
Fixing deprecation warnings update fast_inserter to latest
jparr Apr 5, 2024
586fa72
Merge pull request #908 from EFForg/jparr/fix-tools-controller-spec
esoterik Apr 8, 2024
1b88173
Merge pull request #909 from EFForg/jparr/fix-congress-message-spec
esoterik Apr 8, 2024
b739c67
Merge pull request #910 from EFForg/jparr/fix-call-action-spec
esoterik Apr 8, 2024
320e9ba
Merge pull request #911 from EFForg/jparr/deprecation-fixes
esoterik Apr 8, 2024
1cd3dc6
Upgrade ahoy to v4; fix user model test failure
esoterik Apr 8, 2024
7be5118
update rubocop config
jparr Apr 10, 2024
f9798cc
rubocop autofix of unnecessary inline cop disables
jparr Apr 10, 2024
4525716
Subclass ApplicationRecord per rubocop
jparr Apr 10, 2024
ea38d35
Enable NewCops and fix
jparr Apr 10, 2024
c856083
upgrade rspec-rails
jparr Apr 11, 2024
3514127
Email action small refactors while debugging
esoterik May 7, 2024
b705ed4
Merge pull request #915 from EFForg/jparr/913-rubocop-fixes
esoterik May 9, 2024
16f042c
Merge pull request #917 from EFForg/jparr/upgrade-rspec-rails
esoterik May 9, 2024
2d60ca1
Replace paperclip with carrierwave for ActionPage images
jparr Apr 11, 2024
c360cc3
remove paperclip helper from actionpage migrations
jparr Apr 17, 2024
99befae
remove logo from partners model
jparr Apr 17, 2024
bf186e4
remove TweetTarget attached image
jparr Apr 17, 2024
543fb03
Remove paperclip and supporting code
jparr Apr 17, 2024
c37a2b4
Merge pull request #918 from EFForg/jparr/913-replace-paperclip
esoterik May 16, 2024
126da31
Upgrade sentry-raven gem
jparr Apr 10, 2024
e31d936
Merge pull request #916 from EFForg/jparr/913-upgrade-sentry-raven
jparr May 16, 2024
64f7aa0
Remove DatabaseCleaner
jparr Apr 18, 2024
ac79c33
Rspec modernization
jparr Apr 18, 2024
f4257d9
Update config.ru
jparr Apr 18, 2024
5c585a2
Prep for zeitwerk autoloader
jparr Apr 18, 2024
61c436e
rename CiviCRM to Civicrm
jparr Apr 18, 2024
39170cd
update config for 6.1
jparr Apr 18, 2024
0c7ff3a
configure headless chrome
jparr Apr 19, 2024
83f80d2
Upgrade to rails 7
jparr Apr 19, 2024
6c3fe11
Use rails 7 default config
jparr Apr 19, 2024
54276b9
rubocop fix all
jparr Apr 19, 2024
7f3aaed
Tweaks to ahoy upgrade
esoterik May 7, 2024
db14619
Move ahoy-related callbacks/validations from User to Ahoy::Store
esoterik Jul 2, 2024
f798554
Fix/finish ahoy feature specs
esoterik Jul 2, 2024
bd6c220
Fix email action feature spec
esoterik Jul 2, 2024
68f6c38
First pass dockerfile update to ruby 3.0
esoterik Aug 16, 2024
494eaa5
Merge pull request #922 from EFForg/2024_dockerfile
esoterik Nov 1, 2024
ae71616
Merge pull request #921 from EFForg/ahoy-upgrade
esoterik Nov 1, 2024
973aa50
Upgrade to 3.1 + bundler 2.5
esoterik Nov 1, 2024
be13b45
Start ruby 3.2 upgrade
esoterik Nov 1, 2024
fef7ca0
Switch rails_response_headers to pull directly from our git repo for now
esoterik Nov 1, 2024
d9622b6
Upgrade to ruby 3.3
esoterik Nov 1, 2024
8fb0b6c
Merge pull request #923 from EFForg/ruby-3.3
esoterik Nov 1, 2024
b8c4aff
Merge branch '2024-upgrades-main' into jparr/rails7
esoterik Nov 1, 2024
1086281
Merge pull request #920 from EFForg/jparr/rails7
esoterik Nov 1, 2024
939ba65
Require ostruct in config/application.rb post upgrades
esoterik Nov 1, 2024
446af23
Upgrade Dockerfile for ruby 3.3
esoterik Nov 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ amazon_authorize_key=

# Third party integration (required)
congress_forms_url=http://phantomdc.example.com
google_civic_api_url=https://www.googleapis.com/civicinfo/v2/representatives/
google_civic_api_key=
smarty_streets_id=
smarty_streets_token=

Expand Down
4 changes: 2 additions & 2 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ call_tool_api_key=xyz

storage=s3
amazon_region=us-west-1
amazon_bucket=actioncenter-staging
amazon_bucket_url=actioncentertest.s3-us-west-1.amazonaws.com
amazon_bucket=actioncenter-test
amazon_bucket_url=actioncenter-testurl.s3-us-west-1.amazonaws.com

supporters_api_key=xyz
supporters_host=https://civicrm.test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ public/webshims

# Ignore dotenv file
/.env
/public/uploads
94 changes: 87 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,78 @@
require:
- rubocop-rails
- rubocop-performance

inherit_gem:
rubocop-github:
- config/default.yml
- config/rails.yml

AllCops:
TargetRailsVersion: 4.2
TargetRubyVersion: 2.3
TargetRailsVersion: 7.0
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: false
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'bin/**/*'
- 'vendor/**/*'
- 'features/**/*'

# Handle cops not enabled by default
# Should probably be checked on rubocop version upgrades
# Last checked 02/09/21
# Disables cops marked as unsafe in docs

Layout/SpaceAroundMethodCallOperator:
Enabled: true

Lint/RaiseException:
Enabled: true

Lint/StructNewOverride:
Enabled: true

Style/ExponentialNotation:
Enabled: true

Style/HashEachMethods:
Enabled: false

### Override rubcop-github ###
Style/HashTransformKeys:
Enabled: false

Style/HashTransformValues:
Enabled: false

Performance/AncestorsInclude:
Enabled: false

Performance/BigDecimalWithNumericArgument:
Enabled: true

Performance/RedundantSortBlock:
Enabled: true

Performance/RedundantStringChars:
Enabled: true

Performance/ReverseFirst:
Enabled: true

Performance/SortReverse:
Enabled: true

Performance/Squeeze:
Enabled: true

Performance/StringInclude:
Enabled: true

Bundler/OrderedGems:
Enabled: false

### Override rubocop-github ###

Style/FrozenStringLiteralComment:
# We aren't upgrading to Ruby 3.0, so this is just noise
Expand All @@ -30,9 +90,6 @@ GitHub/RailsControllerRenderPathsExist:
# Doesn't seem to work; can't find templates that exist
Enabled: false

GitHub/RailsApplicationRecord:
# Doesn't apply to < Rails 5.0, and ignores TargetRailsVersion
Enabled: false

Lint/Void:
Exclude:
Expand All @@ -43,7 +100,7 @@ Lint/Debugger:
Exclude:
- 'features/step_definitions/debug_steps.rb'

Style/BlockComments:
Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/**/*'

Expand All @@ -65,7 +122,30 @@ Layout/MultilineHashBraceLayout:
Layout/SpaceAroundOperators:
Enabled: true

Naming/PredicateName:
Exclude:
- 'spec/**/*'

Security/JSONLoad:
Enabled: true
Exclude:
- 'spec/**/*'

Rails/HttpStatus:
EnforcedStyle: 'numeric'

Style/Alias:
Enabled: false

Style/BlockComments:
Exclude:
- 'spec/**/*'

Style/ClassAndModuleChildren:
EnforcedStyle: 'compact'

Style/Documentation:
Enabled: false

Style/NumericLiterals:
MinDigits: 6
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.5
3.3.5
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ before_script:
- npm install
- cp config/database.yml.travis config/database.yml
- psql -c 'create database travis_ci_test;' -U postgres
- RAILS_ENV=test bundle exec rails webdrivers:chromedriver:update
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
script:
- bundle exec rubocop
- $(npm bin)/sass-lint -vq
Expand Down
27 changes: 6 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.5-stretch
FROM ruby:3.3-slim

RUN mkdir /opt/actioncenter
WORKDIR /opt/actioncenter
Expand All @@ -13,24 +13,10 @@ RUN apt-get update && \
postgresql-client \
cron \
gnupg \
libssl-dev

RUN set -x; \
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh \
&& chmod +x nodesource_setup.sh \
&& ./nodesource_setup.sh \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libssl-dev \
shared-mime-info \
nodejs \
npm \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install \
yarn
npm

COPY package.json package-lock.json ./
RUN npm install
Expand Down Expand Up @@ -65,11 +51,10 @@ RUN bundle exec rake assets:precompile \
SECRET_KEY_BASE=noop \
devise_secret_key=noop \
amazon_region=noop \
amazon_bucket=noop \
DATABASE_URL=postgres://noop
RUN bundle exec rake webshims:update_public

RUN mkdir /opt/actioncenter/log \
/var/www
RUN mkdir /var/www
RUN chown -R www-data /opt/actioncenter/public \
/opt/actioncenter/db \
/opt/actioncenter/tmp \
Expand Down
73 changes: 32 additions & 41 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
source "https://rubygems.org"

gem "rails", "~> 5.0"
gem "rails", "~> 7.0.0"

#Database
# Database
gem "pg", "~> 1.1"
gem "pg_search"
gem "pg_search", "~> 2"

# Hosting-related
gem "aws-sdk", "~> 2.3"
gem "aws-sdk-rails", "~> 1"
gem "aws-sdk-rails", "~> 2"
gem "aws-sdk-s3", "~> 1"
gem "dotenv-rails", "~> 2"
gem "rack-attack", "~> 5"
gem "rails_12factor", group: :production # Loads "rails_serve_static_assets" and "rails_stdout_logging"
gem "rails_response_headers", "~> 0"
gem "rails_response_headers", git: "https://github.com/EFForg/rails_response_headers.git"

# Frontend/assets
gem "bootstrap-daterangepicker-rails", "~> 3"
gem "bootstrap-sass", "~> 3.4"
gem "bourbon", "~> 3"
gem "bundler", ">= 1.8.4" # needed for rails-assets
gem "fontello_rails_converter", "~> 0"
gem "react-rails", "~> 1"
gem "redcarpet", "~> 3" # Markdown
gem "sass-rails", "~> 5.0"
gem "sass-rails", "< 5.1"
gem "select2-rails" # Autocomplete select menus
gem "uglifier", ">= 1.3.0" # compressor for JavaScript assets
gem "webshims-rails", "~> 1"

source "https://rails-assets.org" do
gem "rails-assets-chartjs", "~> 2"
gem "rails-assets-congress-images-102x125"
Expand All @@ -44,17 +42,17 @@ source "https://rails-assets.org" do
end

# File upload
gem "paperclip", "~> 5.2"
gem "carrierwave", "~> 3.0"
gem "fog-aws"

# Email preformatting
gem "nokogiri", "~> 1" # Required for premailer-rails
gem "premailer-rails", "~> 1" # Inline styles for emails

# Optimization
gem "sprockets-image_compressor", "~> 0" # Optimizes png/jpg

# Analytics
gem "ahoy_matey", "~> 1.6" # Analytics
gem "ahoy_matey", "~> 4.0"
# required for ahoy_matey 2.0 with activerecordstore
gem "uuidtools", "~> 2"
gem "chartkick", "~> 3"
gem "eff_matomo", "~> 0.2.4", require: "matomo"
gem "groupdate", "~> 2"
Expand All @@ -64,16 +62,15 @@ gem "daemons", "~> 1"
gem "delayed_job_active_record", "~> 4"

# Exception monitoring
gem "sentry-raven", "~> 0.15"
gem "sentry-raven", "~> 3.1.2"

# Fancy counter caches
gem "counter_culture", "~> 2.0"

# Other
gem "activerecord-session_store", "~> 1"
gem "acts_as_paranoid", git: "https://github.com/ActsAsParanoid/acts_as_paranoid.git"
gem "activerecord-session_store", "~> 2.1.0"
gem "acts_as_paranoid", "~> 0.7"
gem "cocoon", "~> 1" # Dynamically add and remove nested associations from forms
gem "descriptive_statistics", "~> 2" # Used for calculating percentiles
gem "devise", "~> 4.7"
gem "ejs", "~> 1" # Embedded javascript
gem "email_validator", "~> 1"
Expand All @@ -84,17 +81,19 @@ gem "gravatar-ultimate", "~> 2"
gem "http_accept_language", "~> 2" # Detect HTTP language header
gem "invisible_captcha", "~> 0" # Prevent form submissions by bots
gem "iso_country_codes", "~> 0"
gem "jbuilder", "~> 1.2" # JSON APIs
gem "jbuilder", "~> 2"
gem "oauth", "~> 0"
gem "rest-client", "~> 2"
gem "sanitize", "~> 4" # Sanitize user input
gem "warden", "1.2.4" # This dep of devise has a bug in 1.2.5 so am avaoiding
gem "sanitize", "~> 6" # Sanitize user input
gem "whenever", "~> 0", require: false # Cron jobs
gem "will_paginate", "~> 3.0"
gem "xmlrpc"
gem "xmlrpc", "~> 0.3"

# For creating many records, quickly
gem "fast_inserter", "~> 0.1"
gem "fast_inserter", "~> 2.0"

# Pin psych to below version 4 until we're on rails 7 and ruby 3.1
gem "psych", "< 4"

group :doc do
# bundle exec rake doc:rails generates the API under doc/api
Expand All @@ -103,31 +102,23 @@ end

group :development do
gem "better_errors", "~> 2"
gem "binding_of_caller", "~> 0"
gem "rails-dev-tweaks", "~> 1.1"
gem "rb-fchange", "~> 0", require: false
gem "rb-fsevent", "~> 0", require: false
gem "rb-inotify", "~> 0", require: false
end

group :test do
gem "webmock", "~> 2"
gem "webmock", "~> 3"
gem "selenium-devtools"
end

group :development, :test do
gem "byebug"
gem "capybara", "~> 3.26"
gem "cucumber-rails", "1.6.0", require: false
gem "database_cleaner", "~> 1"
gem "factory_girl_rails", "~> 4"
gem "poltergeist", "~> 1"
gem "capybara", "~> 3"
gem "factory_bot_rails", "~> 6.2"
gem "rails-controller-testing"
gem "rspec-core", "~> 3"
gem "rspec-rails", "~> 3"
gem "rubocop", "0.52.0"
gem "rubocop-github", "0.9.0"
gem "selenium-webdriver", "~> 3"
gem "webdrivers", "~> 4"
gem "rspec-rails", "~> 6.1"
gem "rubocop"
gem "rubocop-github", "~> 0.16"
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
end

group :production do
Expand Down
Loading