Skip to content

Commit

Permalink
Bump mini_racer to 0.14.1 (#112)
Browse files Browse the repository at this point in the history
Remove locally compiled CentOS 7 binaries, plan.io #29148
  • Loading branch information
bshand authored Sep 5, 2024
1 parent 1f81617 commit 4b4cf89
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 303 deletions.
38 changes: 1 addition & 37 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,14 @@ gem 'pg', '~> 1.4.6' # All client instance have postgres version >= 9.3
gem 'puma', '~> 6.0'
gem 'puma-daemon', require: false

# We have built our own CentOS 7 binaries for various gems
# (with separate gem files for different ruby versions)
# Copy these into place if needed
def add_custom_centos_7_binaries(gem_dir_basename, gem_fnames)
gem_dir = if RUBY_PLATFORM == 'x86_64-linux' && File.exist?('/etc/os-release') &&
File.readlines('/etc/os-release').grep(/^(ID="centos"|VERSION_ID="7")$/).count == 2
"vendor/#{gem_dir_basename}-x86_64-linux-ruby#{RUBY_VERSION.split('.')[0..1].join}"
end
require 'fileutils'
gem_fnames.each do |gem_fname|
if gem_dir && Dir.exist?(gem_dir)
begin
FileUtils.cp "#{gem_dir}/#{gem_fname}", 'vendor/cache/'
rescue Errno::EACCES
# Deployer account may not have write access to vendor/cache/
# (in which case the file in vendor/cache/ is probably already correct)
end
else
FileUtils.rm_f "vendor/cache/#{gem_fname}"
end
end
end

# Use SCSS for stylesheets
gem 'sass-rails'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# gem 'mini_racer'
# Allow mini_racer version to be overridden in a custom Gemfile
# We need this for mini_racer on Mac OS Monterey, where the old libv8 no longer compiles
unless defined?(BUNDLER_OVERRIDE_MINI_RACER) && BUNDLER_OVERRIDE_MINI_RACER
# We have built our own CentOS 7 binaries for mini_racer
# (with separate gem files for Ruby 3.0 and Ruby 3.1)
# Copy these into place if needed
mini_racer_version = '0.12.0'
add_custom_centos_7_binaries('mini_racer',
["mini_racer-#{mini_racer_version}-x86_64-linux.gem"])
gem 'libv8-node', '~> 21.7.2.0'
# gem 'mini_racer', '~> 0.12.0'
# Lock the gem version: if this changes, we need to rebuild our binaries
gem 'mini_racer', mini_racer_version
end
gem 'mini_racer', '~> 0.14'

gem 'parser'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
Expand Down
17 changes: 7 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ GEM
json (2.6.3)
launchy (2.5.2)
addressable (~> 2.8)
libv8-node (21.7.2.0)
libv8-node (21.7.2.0-arm64-darwin)
libv8-node (21.7.2.0-x86_64-darwin)
libv8-node (21.7.2.0-x86_64-linux)
libv8-node (18.19.0.0)
libv8-node (18.19.0.0-arm64-darwin)
libv8-node (18.19.0.0-x86_64-darwin)
libv8-node (18.19.0.0-x86_64-linux)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand All @@ -226,10 +226,8 @@ GEM
method_source (1.0.0)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
mini_racer (0.12.0)
libv8-node (~> 21.7.2.0)
mini_racer (0.12.0-x86_64-linux)
libv8-node (~> 21.7.2.0)
mini_racer (0.14.1)
libv8-node (~> 18.19.0.0)
minitest (5.19.0)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
Expand Down Expand Up @@ -560,10 +558,9 @@ DEPENDENCIES
highline
jquery-rails
jquery-ui-rails!
libv8-node (~> 21.7.2.0)
loofah (>= 2.3.1)
mail (>= 2.1.1, < 2.8.0)
mini_racer (= 0.12.0)
mini_racer (~> 0.14)
minitest
mocha
ndr_authenticate (~> 0.3, >= 0.3.3)
Expand Down
19 changes: 6 additions & 13 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@
ruby -e "require 'yaml'; puts YAML.dump('production' => { 'secret_key_base' => 'compile_me' })" > config/secrets.yml
touch config/special_users.production.yml config/admin_users.yml config/odr_users.yml \
config/user_yubikeys.yml
# Remove mini_racer CentOS 7 shim from Gemfile.lock unless needed
if [ -e /etc/os-release ] && \
[ 2 -ne $(grep -Ec '^(ID="centos"|VERSION_ID="7")$' /etc/os-release) ]; then
sed -i.bak -e '/mini_racer ([0-9.]*-x86_64-linux)/,+1d' Gemfile.lock
fi
printf 'disable-self-update-check true\\nyarn-offline-mirror "./vendor/npm-packages-offline-cache"\\nyarn-offline-mirror-pruning false\\n' > .yarnrc
RAILS_ENV=production bundle exec rake assets:clobber assets:precompile
rm config/secrets.yml config/database.yml
Expand Down Expand Up @@ -179,14 +174,12 @@

desc 'ensure additional configuration for CentOS deployments'
task :centos_deployment_specifics do
if /\A(3[.]0[.][567]|3[.][123][.])/.match?(fetch(:ruby))
# On CentOS 7, we need a newer GCC installation to build gems for new ruby versions
# We'd like to do the following, but scl incorrectly handles double quotes in passed commands:
# set :default_shell, 'scl enable devtoolset-9 -- sh'
set :default_shell, <<~CMD.chomp
sh -c 'scl_run() { echo "$@" | scl enable devtoolset-9 -; }; scl_run "$@"'
CMD
end
# On CentOS 7, we need a newer GCC installation to build gems for new ruby versions
# We'd like to do the following, but scl incorrectly handles double quotes in passed commands:
# set :default_shell, 'scl enable devtoolset-9 -- sh'
set :default_shell, <<~CMD.chomp
sh -c 'scl_run() { echo "$@" | scl enable devtoolset-9 -; }; scl_run "$@"'
CMD
end

# ==========================================[ DEPLOY ]==========================================
Expand Down
37 changes: 0 additions & 37 deletions test/lib/gemfile_test.rb

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added vendor/cache/libv8-node-18.19.0.0.gem
Binary file not shown.
Binary file removed vendor/cache/libv8-node-21.7.2.0.gem
Binary file not shown.
Binary file removed vendor/cache/mini_racer-0.12.0.gem
Binary file not shown.
Binary file added vendor/cache/mini_racer-0.14.1.gem
Binary file not shown.
103 changes: 0 additions & 103 deletions vendor/mini_racer-x86_64-linux-ruby30/CentOS7_build_notes_ruby30.txt

This file was deleted.

Binary file not shown.
103 changes: 0 additions & 103 deletions vendor/mini_racer-x86_64-linux-ruby31/CentOS7_build_notes_ruby31.txt

This file was deleted.

Binary file not shown.

0 comments on commit 4b4cf89

Please sign in to comment.