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

JSON, REXML, and ruby 1.9.3 works again! #1950

Merged
merged 3 commits into from
Nov 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
4 changes: 0 additions & 4 deletions fpm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 1.9.3'

# For parsing JSON (required for some Python support, etc)
# http://flori.github.com/json/doc/index.html
spec.add_dependency("json", ">= 1.7.7", "< 3.0") # license: Ruby License

# For logging
# https://github.com/jordansissel/ruby-cabin
spec.add_dependency("cabin", ">= 0.6.0") # license: Apache 2
Expand Down
2 changes: 1 addition & 1 deletion lib/fpm/package/osxpkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require "fpm/package/dir"
require 'tempfile' # stdlib
require 'pathname' # stdlib
require 'rexml/document' # stdlib

# Use an OS X pkg built with pkgbuild.
#
Expand Down Expand Up @@ -103,6 +102,7 @@ def pkginfo_template_path

# Extract name and version from PackageInfo XML
def extract_info(package)
require 'rexml/document'
build_path("expand").tap do |path|
doc = REXML::Document.new File.open(File.join(path, "PackageInfo"))
pkginfo_elem = doc.elements["pkg-info"]
Expand Down
6 changes: 5 additions & 1 deletion lib/fpm/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,11 @@ def erbnew(template_code)
# to invoke ERB.new correctly and without printed warnings.
# References: https://github.com/jordansissel/fpm/issues/1894
# Honestly, I'm not sure if Gem::Version is correct to use in this situation, but it works.
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.1.0")

# on older versions of Ruby, RUBY_VERSION is a frozen string, and
# Gem::Version.new calls String#strip! which throws an exception.
# so we have to call String#dup to get an unfrozen copy.
if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("3.1.0")
# Ruby 3.0.x and older
return ERB.new(template_code, nil, "-")
else
Expand Down