From d65f69baf448c3639ad6aab88872da0882066535 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 18 Nov 2016 17:33:29 +0900 Subject: Unify Psych version constants to psych/versions.rb. --- lib/psych.rb | 4 +--- lib/psych/versions.rb | 7 ++++++- lib/psych_jars.rb | 1 - psych.gemspec | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/psych.rb b/lib/psych.rb index 7e5b0ed..b117b25 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -1,4 +1,5 @@ # frozen_string_literal: false +require 'psych/versions' case RUBY_ENGINE when 'jruby' require 'psych_jars' @@ -223,9 +224,6 @@ require 'psych/class_loader' # # => "a" module Psych - # The version is Psych you're using - VERSION = '2.2.1' - # The version of libyaml Psych is using LIBYAML_VERSION = Psych.libyaml_version.join '.' diff --git a/lib/psych/versions.rb b/lib/psych/versions.rb index 62fca91..b01fa7d 100644 --- a/lib/psych/versions.rb +++ b/lib/psych/versions.rb @@ -1,4 +1,9 @@ # frozen_string_literal: false module Psych - DEFAULT_SNAKEYAML_VERSION = '1.17'.freeze + # The version is Psych you're using + VERSION = '2.2.1' + + if RUBY_ENGINE == 'jruby' + DEFAULT_SNAKEYAML_VERSION = '1.17'.freeze + end end diff --git a/lib/psych_jars.rb b/lib/psych_jars.rb index bd7ea04..2f34e34 100644 --- a/lib/psych_jars.rb +++ b/lib/psych_jars.rb @@ -1,5 +1,4 @@ # frozen_string_literal: false -require 'psych/versions' require 'psych.jar' require 'jar-dependencies' diff --git a/psych.gemspec b/psych.gemspec index db416fa..72d7065 100644 --- a/psych.gemspec +++ b/psych.gemspec @@ -1,8 +1,9 @@ # -*- encoding: utf-8 -*- +require 'psych/versions' Gem::Specification.new do |s| s.name = "psych" - s.version = "2.2.1" + s.version = Psych::VERSION s.authors = ["Aaron Patterson", "SHIBATA Hiroshi", "Charles Oliver Nutter"] s.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org", "headius@headius.com"] s.date = "2016-11-14" @@ -30,9 +31,8 @@ DESCRIPTION s.add_development_dependency 'minitest', "~> 5.0" if RUBY_PLATFORM =~ /java/ - require 'psych/versions' s.platform = 'java' - s.requirements = "jar org.yaml:snakeyaml, 1.17" + s.requirements = "jar org.yaml:snakeyaml, #{Psych::DEFAULT_SNAKEYAML_VERSION}" s.add_dependency 'jar-dependencies', '>= 0.1.7' s.add_development_dependency 'ruby-maven' else -- cgit v1.2.3