Skip to content

Commit

Permalink
Fix support for ruby 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Danial Pearce committed Aug 23, 2022
1 parent 6b1e51f commit 856a934
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGES

## 1.8.0 (2022-08-23)

* Feature: Add support for ruby 3.1
* Dev: Upgrade dev setup and base docker image to ruby 3.1
* Dev: Replace docker-compose dev setup with normal docker
* Dev: Add helpers to easily test all supported ruby versions locally

## 1.7.2 (2021-12-24)

* Upgrade dev setup and base docker image to ruby 3.0
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.0-alpine@sha256:9afcc885895358e84929c19ea53cb62ecc50daf93dcbd45de469f2e668d96e9a as build
FROM ruby:3.1-alpine@sha256:499a310e8fab835ad47ab6251302aba1fd6ba91ebdfa22d621f495a5d0ded170 as build

WORKDIR /app
COPY bin /app/bin
Expand All @@ -10,7 +10,7 @@ COPY LICENSE.md /app/
COPY stackup.gemspec /app/
RUN gem build stackup.gemspec

FROM ruby:3.0-alpine@sha256:9afcc885895358e84929c19ea53cb62ecc50daf93dcbd45de469f2e668d96e9a
FROM ruby:3.1-alpine@sha256:499a310e8fab835ad47ab6251302aba1fd6ba91ebdfa22d621f495a5d0ded170

MAINTAINER https://github.com/realestate-com-au/stackup

Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ENV BUNDLE_JOBS=3
RUN mkdir -p /work/
WORKDIR /work/

COPY .rubocop.yml /work/
COPY .rspec /work/
COPY examples /work/examples
COPY bin /work/bin
COPY stackup.gemspec /work/
Expand Down
3 changes: 2 additions & 1 deletion auto/lint
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -eu -o pipefail
cd $(dirname $0)/..

echo "+++ Running linter"
./auto/ruby-3.1 rubocop
# We lint on the lowest supported ruby version
./auto/ruby-2.7 rubocop
7 changes: 3 additions & 4 deletions auto/release-gem
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#! /bin/bash -eu
#
# Release Stackup
#!/usr/bin/env bash

set -eu -o pipefail
cd $(dirname $0)/..

rm -f stackup-*.gem
Expand All @@ -11,4 +10,4 @@ git fetch origin
git diff origin/main --exit-code

echo "--- Releasing gem"
docker run --rm -itw /cwd -v "$PWD:/cwd" ruby:3.0-alpine auto/release-in-docker
docker run --rm -itw /cwd -v "$PWD:/cwd" ruby:3.1-alpine auto/release-in-docker
3 changes: 2 additions & 1 deletion lib/stackup/yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def dump(*args)
# `!Foo blah` as a shortcut for `{ "Fn::Foo" => blah }`
#
def load(yaml, filename = nil)
tree = ::YAML.parse(yaml, filename)
legacy_yaml = Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
tree = legacy_yaml ? ::YAML.parse(yaml, filename) : ::YAML.parse(yaml, :filename => filename)
return tree unless tree

CloudFormationToRuby.create.accept(tree)
Expand Down

0 comments on commit 856a934

Please sign in to comment.