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

avoid false const warnings (when using bundler) #390

Closed
wants to merge 2 commits into from
Closed
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: 2 additions & 4 deletions lib/psych/versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# frozen_string_literal: true
module Psych
# The version of Psych you are using
VERSION = '3.1.0' unless defined?(::Psych::VERSION)
VERSION = '3.1.0'

if RUBY_ENGINE == 'jruby'
DEFAULT_SNAKEYAML_VERSION = '1.23'.freeze
end
DEFAULT_SNAKEYAML_VERSION = '1.23' if RUBY_ENGINE == 'jruby'
end
16 changes: 8 additions & 8 deletions psych.gemspec
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# -*- encoding: utf-8 -*-
# frozen_string_literal: true

begin
require_relative 'lib/psych/versions'
rescue LoadError
# for Ruby core repository
require_relative 'versions'
end
versions = File.expand_path('lib/psych/versions.rb', File.dirname(__FILE__))
versions = File.read(versions)
versions =
{ VERSION: nil, DEFAULT_SNAKEYAML_VERSION: nil }.map do |const, _|
[ const, versions.match( /.*\s#{const}\s*=\s*['"](.*?)['"]/ )[1] ]
end.to_h

Gem::Specification.new do |s|
s.name = "psych"
s.version = Psych::VERSION
s.version = versions[:VERSION]
s.authors = ["Aaron Patterson", "SHIBATA Hiroshi", "Charles Oliver Nutter"]
s.email = ["[email protected]", "[email protected]", "[email protected]"]
s.summary = "Psych is a YAML parser and emitter"
Expand Down Expand Up @@ -65,7 +65,7 @@ DESCRIPTION
"lib/psych_jars.rb",
"lib/psych.jar"
]
s.requirements = "jar org.yaml:snakeyaml, #{Psych::DEFAULT_SNAKEYAML_VERSION}"
s.requirements = "jar org.yaml:snakeyaml, #{versions[:DEFAULT_SNAKEYAML_VERSION] || raise}"
s.add_dependency 'jar-dependencies', '>= 0.1.7'
s.add_development_dependency 'ruby-maven'
else
Expand Down