Compare commits

..

16 Commits

Author SHA1 Message Date
Gaetan Craig-Riou
cae1655ec3 Merge pull request #13848 from dacook/cleanup-tmp-ctrl
Remove unused file
2026-01-14 16:23:11 +11:00
David Cook
26702e6f0d Remove unused file
Low-hanging fruit 🍇
2026-01-13 14:59:26 +11:00
Maikel
7fc9a6bf93 Merge pull request #13829 from mkllnk/ruby-3.3
Bump ruby from 3.2.9p265 to 3.3.10p183
2026-01-13 12:22:28 +11:00
David Cook
781bf940f6 Merge pull request #13837 from mkllnk/fix-seeds
Fix database seeding with admin user
2026-01-13 12:02:32 +11:00
Maikel Linke
92382ca473 Remove outdated warning
We only create a user when seeding the database and we check that
there's no user already. We don't have a use case for adding an admin
user to a database with user data.

It also referred to a spree task that doesn't exist in our code base.
2026-01-13 11:02:49 +11:00
Maikel Linke
76a3e913df Remove unnecessary load 2026-01-13 11:00:02 +11:00
Maikel Linke
23ab6bb489 Create seed admin user without prompting for details
We don't really need it. In development, we use default values. And when
preparing a new server, we set env vars.

This fixes a broken dependency on HighLine. I found removal easier than
fixing something we don't use.
2026-01-13 10:59:31 +11:00
David Cook
c799f15067 Update ruby-build with homebrew if installed
This is commonly used on Mac.
2026-01-12 15:09:49 +11:00
David Cook
54f1047dcb Merge pull request #13830 from mkllnk/highline
Bump highline from 2.0.3 to 3.1.2 to support newer rubies
2026-01-12 11:14:06 +11:00
Maikel
c1e599deef Merge pull request #13833 from mkllnk/nodenv
Add instructions how to install nodenv
2026-01-12 10:40:54 +11:00
Maikel Linke
476daf0d30 Add instructions how to install nodenv 2026-01-09 13:47:41 +11:00
Maikel Linke
79a9dbcf68 Bump highline from 2.0.3 to 3.1.2 to support newer rubies 2026-01-07 14:12:59 +11:00
Maikel Linke
61c7c26822 Remove version restriction on highline
It came from a very old version of the Spree code.
2026-01-07 14:09:42 +11:00
Maikel Linke
969dcae8d0 Remove unnecessary require statement 2026-01-07 14:08:10 +11:00
Maikel Linke
ce5a95ff4f Bump bundler from 2.4.19 to 2.5.22 (default gem) 2026-01-07 12:24:03 +11:00
Maikel Linke
0d5330d388 Bump ruby from 3.2.9p265 to 3.3.10p183 2026-01-07 12:21:13 +11:00
8 changed files with 32 additions and 72 deletions

View File

@@ -1 +1 @@
3.2.9
3.3.10

View File

@@ -1,4 +1,4 @@
FROM ruby:3.2.9-alpine3.19 AS base
FROM ruby:3.3.10-alpine3.19 AS base
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
TZ=Europe/London \
@@ -31,4 +31,4 @@ FROM development-base
COPY . $RAILS_ROOT
COPY Gemfile Gemfile.lock ./
RUN bundle install --jobs "$(nproc)"
COPY --from=yarn-dependencies $RAILS_ROOT/node_modules ./node_modules
COPY --from=yarn-dependencies $RAILS_ROOT/node_modules ./node_modules

View File

@@ -49,7 +49,7 @@ gem 'acts_as_list', '1.0.4'
gem 'cancancan', '~> 1.15.0'
gem 'digest'
gem 'ffaker'
gem 'highline', '2.0.3' # Necessary for the install generator
gem 'highline'
gem 'json'
gem 'monetize', '~> 1.11'
gem 'paranoia', '~> 2.4'

View File

@@ -389,7 +389,8 @@ GEM
hashdiff (1.2.1)
hashery (2.1.2)
hashie (5.0.0)
highline (2.0.3)
highline (3.1.2)
reline
htmlentities (4.4.2)
http_parser.rb (0.8.0)
i18n (1.14.7)
@@ -1018,7 +1019,7 @@ DEPENDENCIES
good_migrations
haml
haml_lint
highline (= 2.0.3)
highline
i18n
i18n-js (~> 3.9.0)
i18n-tasks
@@ -1113,7 +1114,7 @@ DEPENDENCIES
wkhtmltopdf-binary
RUBY VERSION
ruby 3.2.9p265
ruby 3.3.10p183
BUNDLED WITH
2.4.19
2.5.22

View File

@@ -1,2 +0,0 @@
angular.module('Darkswarm').controller "TmpCtrl", ($scope)->
$scope.test = {foo: "bar"}

View File

@@ -1,57 +1,8 @@
# frozen_string_literal: true
require 'highline/import'
# see last line where we create an admin if there is none, asking for email and password
def prompt_for_admin_password
if ENV['ADMIN_PASSWORD']
password = ENV['ADMIN_PASSWORD'].dup
say "Admin Password #{password}"
else
password = ask('Password [ofn123]: ') do |q|
q.echo = false
q.validate = /^(|.{5,40})$/
q.responses[:not_valid] = 'Invalid password. Must be at least 5 characters long.'
q.whitespace = :strip
end
password = 'ofn123' if password.blank?
end
password
end
def prompt_for_admin_email
if ENV['ADMIN_EMAIL']
email = ENV['ADMIN_EMAIL'].dup
say "Admin User #{email}"
else
email = ask('Email [ofn@example.com]: ') do |q|
q.echo = true
q.whitespace = :strip
end
email = 'ofn@example.com' if email.blank?
end
email
end
def create_admin_user
attributes = read_user_attributes
load 'spree/user.rb'
if Spree::User.find_by(email: attributes[:email])
say <<~TEXT
WARNING: There is already a user with the email: #{email},
so no account changes were made. If you wish to create an additional admin
user, please run rake spree_auth:admin:create again with a different email.
TEXT
return
end
admin = Spree::User.new(attributes)
admin.skip_confirmation!
admin.skip_confirmation_notification!
@@ -60,24 +11,22 @@ def create_admin_user
ValidEmail2::Address.define_method(:valid_mx?) { true }
if admin.save
say "New admin user persisted!"
printf <<~TEXT
New admin user persisted!
Username: #{admin.email}
Password: #{admin.password}
TEXT
else
say "There was some problems with persisting new admin user:"
printf "There was some problems with persisting new admin user:\n"
admin.errors.full_messages.each do |error|
say error
printf "#{error}\n"
end
end
end
def read_user_attributes
if ENV.fetch("AUTO_ACCEPT", true)
password = ENV.fetch("ADMIN_PASSWORD", "ofn123")
email = ENV.fetch("ADMIN_EMAIL", "ofn@example.com")
else
say 'Create the admin user (press enter for defaults).'
email = prompt_for_admin_email
password = prompt_for_admin_password
end
password = ENV.fetch("ADMIN_PASSWORD", "ofn123")
email = ENV.fetch("ADMIN_EMAIL", "ofn@example.com")
{
admin: true,
@@ -88,4 +37,4 @@ def read_user_attributes
}
end
create_admin_user if Spree::User.admin.empty?
create_admin_user if Spree::User.none?

View File

@@ -10,6 +10,12 @@ set -e
if ! command -v nodenv > /dev/null; then
printf "Please install https://github.com/nodenv/nodenv.\n"
printf '```'"\n"
printf "git clone https://github.com/nodenv/nodenv.git ~/.nodenv\n"
printf "git clone https://github.com/nodenv/node-build.git ~/.nodenv/plugins/node-build\n"
printf "nodenv init\n"
printf 'eval "$(nodenv init -)"'"\n"
printf '```'"\n"
exit 1
fi

View File

@@ -24,7 +24,13 @@ if rbenv install --skip-existing; then
echo "Ruby is installed."
else
echo "Upgrading rbenv's ruby-build:"
git -C "$(rbenv root)"/plugins/ruby-build pull
# If installed with homebrew, use that to update
if (command -v brew && brew list --versions ruby-build); then
brew update && brew upgrade ruby-build
else
# Update with git
git -C "$(rbenv root)"/plugins/ruby-build pull
fi
rbenv install
fi