Skip to content

Commit

Permalink
Merge pull request #2655 from alphagov/drop-psych-4-dependency
Browse files Browse the repository at this point in the history
Drop Psych 4 dependency
  • Loading branch information
Ollie Treend authored Mar 2, 2022
2 parents 714de3b + 5e6b814 commit 5f78cdb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
useful summary for people upgrading their application, not a replication
of the commit log.

## 28.8.1

* Drop dependency `psych >= 4` that was breaking downstream apps [PR #2655](https://github.com/alphagov/govuk_publishing_components/pull/2655)

## 28.8.0

* Allow attachments to display link to accessible format request form [PR #2636](https://github.com/alphagov/govuk_publishing_components/pull/2636)
Expand Down
6 changes: 1 addition & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
PATH
remote: .
specs:
govuk_publishing_components (28.8.0)
govuk_publishing_components (28.8.1)
govuk_app_config
govuk_personalisation (>= 0.7.0)
kramdown
plek
psych (>= 4)
rails (>= 6)
rouge
sprockets (< 4)
Expand Down Expand Up @@ -215,8 +214,6 @@ GEM
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
psych (4.0.3)
stringio
public_suffix (4.0.6)
puma (5.6.2)
nio4r (~> 2.0)
Expand Down Expand Up @@ -346,7 +343,6 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
statsd-ruby (1.5.0)
stringio (3.0.1)
strscan (3.0.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand Down
5 changes: 4 additions & 1 deletion app/models/govuk_publishing_components/component_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def fetch_component_doc(id)
end

def parse_documentation(file)
{ id: File.basename(file, ".yml") }.merge(YAML.unsafe_load_file(file)).with_indifferent_access
# Psych 4's YAML.unsafe_load_file === Psych 3's YAML.load_file
# but until we drop support for Ruby 2.7 and Ruby 3.0, we need to support both major versions of Psych
yaml = YAML.respond_to?(:unsafe_load_file) ? YAML.unsafe_load_file(file) : YAML.load_file(file)
{ id: File.basename(file, ".yml") }.merge(yaml).with_indifferent_access
end

def app_documentation_directory
Expand Down
1 change: 0 additions & 1 deletion govuk_publishing_components.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Gem::Specification.new do |s|
s.add_dependency "govuk_personalisation", ">= 0.7.0"
s.add_dependency "kramdown"
s.add_dependency "plek"
s.add_dependency "psych", ">= 4"
s.add_dependency "rails", ">= 6"
s.add_dependency "rouge"
s.add_dependency "sprockets", "< 4"
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_publishing_components/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module GovukPublishingComponents
VERSION = "28.8.0".freeze
VERSION = "28.8.1".freeze
end
4 changes: 3 additions & 1 deletion spec/components/all_components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
end

it "has the correct documentation" do
yaml = YAML.unsafe_load_file(yaml_file)
# Psych 4's YAML.unsafe_load_file === Psych 3's YAML.load_file
# but until we drop support for Ruby 2.7 and Ruby 3.0, we need to support both major versions of Psych
yaml = YAML.respond_to?(:unsafe_load_file) ? YAML.unsafe_load_file(yaml_file) : YAML.load_file(yaml_file)

expect(yaml["name"]).not_to be_nil
expect(yaml["description"]).not_to be_nil
Expand Down

0 comments on commit 5f78cdb

Please sign in to comment.