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

Upgrade to Ruby 3 / Rails 7 and remove node.js dependency #55

Merged
merged 8 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ jobs:
bundler-cache: true
- name: Setup config
run: mv config/hdm.yml{.template,}
- name: Install webpacker
run: bundle exec rake webpacker:install
- name: Generate assets
run: bundle exec rake webpacker:compile
- name: Verify assets
run: bundle exec rake webpacker:verify_install
- name: Run tests
run: bundle exec rake test:all

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

# Ignore bundler config.
/.bundle
/vendor
/.vendor

# Ignore the default SQLite database.
Expand Down Expand Up @@ -60,3 +59,6 @@ package-lock.json

# Vagrant
/.vagrant

/app/assets/builds/*
!/app/assets/builds/.keep
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ AllCops:
Include:
- '**/*.rb'
Exclude:
- bin/*
- config/application.rb
- config/environments/*
- vendor/**/*
- .vendor/**/*
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.5.9
ruby-3.1.2
15 changes: 4 additions & 11 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,12 @@
In case you are using an Apple M1 Chip you might run into trouble building
Ruby. A work around for that is using the command

rvm install 2.5.9 --with-cflags="-Wno-error=implicit-function-declaration"
rvm install 3.1.2 --with-cflags="-Wno-error=implicit-function-declaration"

On intel you can proceed with the following:

rvm install 2.5.9
rvm use 2.5.9
gem install bundler

## **yarn/nodejs**

brew install node@14
npm install -g yarn
rvm install 3.1.2
rvm use 3.1.2

## **Main part**

Expand All @@ -30,15 +24,14 @@ On intel you can proceed with the following:
bundle config set --local path 'vendor/bundle'
bundle config set --local with 'development'
bundle install
yarn install --check-files

## **Configure hdm**

cp config/hdm.yml.template config/hdm.yml
# vim config/hdm.yml # adopt config
bundle exec rails db:setup
echo "secret" | EDITOR="vim" bundle exec rails credentials:edit
bundle exec rails server &
bin/dev

For development there is per default a fake_puppet_db configured.
It can be startet on a second shell:
Expand Down
14 changes: 3 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
FROM ruby:2.5.9-alpine as build

RUN apk add --update --no-cache \
nodejs \
yarn
FROM ruby:3.1.2-alpine as build

ENV APP_HOME /hdm
WORKDIR $APP_HOME

COPY package.json $APP_HOME
COPY yarn.lock $APP_HOME
RUN yarn install --check-files

COPY . $APP_HOME
COPY config/hdm.yml.template $APP_HOME/config/hdm.yml

FROM ruby:2.5.9-alpine
FROM ruby:3.1.2-alpine

RUN apk add --update --no-cache \
binutils-gold \
Expand All @@ -35,7 +27,7 @@ RUN apk add --update --no-cache \
# yarn \ # works without this but produces a short error, that yarn is not found
tzdata

RUN gem install bundler -v 2.3.6
RUN gem install bundler -v 2.3.11

COPY --from=build /hdm /hdm
WORKDIR /hdm
Expand Down
23 changes: 14 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "/~https://github.com/#{repo}.git" }

ruby '2.5.9'
ruby '3.1.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.5', '>= 6.1.0.0'
gem 'rails', '~> 7.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 5.6'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: /~https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: /~https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'

# Asset handling
gem 'sprockets-rails'
gem 'importmap-rails'
gem 'dartsass-rails'
gem 'turbo-rails'
gem 'stimulus-rails'
gem 'bootstrap', '~> 4.6.0'
gem 'bootstrap-icons-helper'
gem 'jquery-rails'

# Build JSON APIs with ease. Read more: /~https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
gem 'bcrypt', '~> 3.1.7'

Expand Down
Loading