psych 3.0.3.pre5-java → 3.1.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 597372a1e259ddb9f66aaadda0c15f96004fc1e69c116b6e10a37c4c9ed055a8
4
- data.tar.gz: 27e766199b404cc981a42f6b7b37b74acd7d4b85121f1fe6eae700905f5a9fbc
3
+ metadata.gz: aecf497b38e244ea95807fb3fe1d141b389e0d37c0e173b2f4bdc158e8726d28
4
+ data.tar.gz: a809b927f7912dc80ffd65854fc3d8ab532392766c8c0266b832c4af3403d8f9
5
5
  SHA512:
6
- metadata.gz: c4a25250ab36eef2a8bd696a063dbde70dff894ba1da6d95338d2763ad3df55c6ac8ad5b733e4a0359d768571fb852b05a48a8e164af156ecd7c3cba0d2f378d
7
- data.tar.gz: 4f52b174edbf8c3df7334b092c8ecab1ff374fc2f670001d73353970bee7bb13d0f91198ac0ca6801d4f71bb84a182eb69ef7226545fd66904fe2cf9073887b9
6
+ metadata.gz: d17f6a46ca368eb95aacbbd382c50b9551c957b0102c7e36c1fb7813ee54dfd1aecd9a215e5fdda61eca2dbf8e85358357ff32d0c960a064a8ac333259c984d0
7
+ data.tar.gz: cdfb0def297ab0a049dca31280c298fa5a6ea71578fa0151da3a1ff64f93d50e93d8ed6b616f0cb5b74dbedffe3516568ee71b924779273bfbacf5bb79c9a2ae
@@ -1,7 +1,7 @@
1
1
  rvm:
2
- - 2.3.7
3
- - 2.4.4
4
- - 2.5.1
2
+ - 2.3.8
3
+ - 2.4.5
4
+ - 2.5.3
5
5
  - ruby-head
6
6
  - jruby-9.1.17.0
7
7
  - jruby-9.2.0.0
@@ -1,3 +1,10 @@
1
+ Thu Nov 8 12:00:00 2018 Juanito Fatas <me@juanitofatas.com>
2
+
3
+ * lib/psych.rb: Use friendlier terminology in YAML.safe_load.
4
+ Replace keyword argumment whitelist_classes and whitelist_symbols.
5
+ with permitted_classes and permitted_symbols.
6
+ * test/psych/test_safer_load.rb: Update tests accordingly.
7
+
1
8
  Fri Feb 6 17:47:05 2015 Aaron Patterson <aaron@tenderlovemaking.com>
2
9
 
3
10
  * ext/psych/lib/psych/visitors/yaml_tree.rb: register nodes when
data/Rakefile CHANGED
@@ -34,7 +34,7 @@ else
34
34
  ext.cross_compile = true
35
35
  ext.cross_platform = %w[x86-mingw32 x64-mingw32]
36
36
  ext.cross_compiling do |s|
37
- s.files.concat ["lib/2.2/psych.so", "lib/2.3/psych.so", "lib/2.4/psych.so"]
37
+ s.files.concat ["lib/2.3/psych.so", "lib/2.4/psych.so", "lib/2.5/psych.so"]
38
38
  end
39
39
  end
40
40
  end
@@ -42,7 +42,7 @@ end
42
42
  desc "Compile binaries for mingw platform using rake-compiler-dock"
43
43
  task 'build:mingw' do
44
44
  require 'rake_compiler_dock'
45
- RakeCompilerDock.sh "bundle && rake cross native gem RUBY_CC_VERSION=2.2.2:2.3.0:2.4.0"
45
+ RakeCompilerDock.sh "bundle && rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0"
46
46
  end
47
47
 
48
48
  task :default => [:compile, :test]
@@ -270,7 +270,7 @@ module Psych
270
270
  #
271
271
  def self.load yaml, legacy_filename = NOT_GIVEN, filename: nil, fallback: false, symbolize_names: false
272
272
  if legacy_filename != NOT_GIVEN
273
- warn 'warning: Passing filename with the 2nd argument of Psych.load is deprecated. Use keyword argument like Psych.load(yaml, filename: ...) instead.'
273
+ warn_with_uplevel 'Passing filename with the 2nd argument of Psych.load is deprecated. Use keyword argument like Psych.load(yaml, filename: ...) instead.', uplevel: 1 if $VERBOSE
274
274
  filename = legacy_filename
275
275
  end
276
276
 
@@ -294,10 +294,10 @@ module Psych
294
294
  # * Hash
295
295
  #
296
296
  # Recursive data structures are not allowed by default. Arbitrary classes
297
- # can be allowed by adding those classes to the +whitelist_classes+ keyword argument. They are
297
+ # can be allowed by adding those classes to the +permitted_classes+ keyword argument. They are
298
298
  # additive. For example, to allow Date deserialization:
299
299
  #
300
- # Psych.safe_load(yaml, whitelist_classes: [Date])
300
+ # Psych.safe_load(yaml, permitted_classes: [Date])
301
301
  #
302
302
  # Now the Date class can be loaded in addition to the classes listed above.
303
303
  #
@@ -311,7 +311,7 @@ module Psych
311
311
  # Psych.safe_load yaml, aliases: true # => loads the aliases
312
312
  #
313
313
  # A Psych::DisallowedClass exception will be raised if the yaml contains a
314
- # class that isn't in the whitelist.
314
+ # class that isn't in the +permitted_classes+ list.
315
315
  #
316
316
  # A Psych::BadAlias exception will be raised if the yaml contains aliases
317
317
  # but the +aliases+ keyword argument is set to false.
@@ -325,32 +325,32 @@ module Psych
325
325
  # Psych.safe_load("---\n foo: bar") # => {"foo"=>"bar"}
326
326
  # Psych.safe_load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
327
327
  #
328
- def self.safe_load yaml, legacy_whitelist_classes = NOT_GIVEN, legacy_whitelist_symbols = NOT_GIVEN, legacy_aliases = NOT_GIVEN, legacy_filename = NOT_GIVEN, whitelist_classes: [], whitelist_symbols: [], aliases: false, filename: nil, fallback: nil, symbolize_names: false
329
- if legacy_whitelist_classes != NOT_GIVEN
330
- warn 'warning: Passing whitelist_classes with the 2nd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, whitelist_classes: ...) instead.'
331
- whitelist_classes = legacy_whitelist_classes
328
+ def self.safe_load yaml, legacy_permitted_classes = NOT_GIVEN, legacy_permitted_symbols = NOT_GIVEN, legacy_aliases = NOT_GIVEN, legacy_filename = NOT_GIVEN, permitted_classes: [], permitted_symbols: [], aliases: false, filename: nil, fallback: nil, symbolize_names: false
329
+ if legacy_permitted_classes != NOT_GIVEN
330
+ warn_with_uplevel 'Passing permitted_classes with the 2nd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, permitted_classes: ...) instead.', uplevel: 1 if $VERBOSE
331
+ permitted_classes = legacy_permitted_classes
332
332
  end
333
333
 
334
- if legacy_whitelist_symbols != NOT_GIVEN
335
- warn 'warning: Passing whitelist_symbols with the 3rd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, whitelist_symbols: ...) instead.'
336
- whitelist_symbols = legacy_whitelist_symbols
334
+ if legacy_permitted_symbols != NOT_GIVEN
335
+ warn_with_uplevel 'Passing permitted_symbols with the 3rd argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, permitted_symbols: ...) instead.', uplevel: 1 if $VERBOSE
336
+ permitted_symbols = legacy_permitted_symbols
337
337
  end
338
338
 
339
339
  if legacy_aliases != NOT_GIVEN
340
- warn 'warning: Passing aliases with the 4th argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, aliases: ...) instead.'
340
+ warn_with_uplevel 'Passing aliases with the 4th argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, aliases: ...) instead.', uplevel: 1 if $VERBOSE
341
341
  aliases = legacy_aliases
342
342
  end
343
343
 
344
344
  if legacy_filename != NOT_GIVEN
345
- warn 'warning: Passing filename with the 5th argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, filename: ...) instead.'
345
+ warn_with_uplevel 'Passing filename with the 5th argument of Psych.safe_load is deprecated. Use keyword argument like Psych.safe_load(yaml, filename: ...) instead.', uplevel: 1 if $VERBOSE
346
346
  filename = legacy_filename
347
347
  end
348
348
 
349
349
  result = parse(yaml, filename: filename)
350
350
  return fallback unless result
351
351
 
352
- class_loader = ClassLoader::Restricted.new(whitelist_classes.map(&:to_s),
353
- whitelist_symbols.map(&:to_s))
352
+ class_loader = ClassLoader::Restricted.new(permitted_classes.map(&:to_s),
353
+ permitted_symbols.map(&:to_s))
354
354
  scanner = ScalarScanner.new class_loader
355
355
  visitor = if aliases
356
356
  Visitors::ToRuby.new scanner, class_loader
@@ -383,7 +383,7 @@ module Psych
383
383
  # See Psych::Nodes for more information about YAML AST.
384
384
  def self.parse yaml, legacy_filename = NOT_GIVEN, filename: nil, fallback: NOT_GIVEN
385
385
  if legacy_filename != NOT_GIVEN
386
- warn 'warning: Passing filename with the 2nd argument of Psych.parse is deprecated. Use keyword argument like Psych.parse(yaml, filename: ...) instead.'
386
+ warn_with_uplevel 'Passing filename with the 2nd argument of Psych.parse is deprecated. Use keyword argument like Psych.parse(yaml, filename: ...) instead.', uplevel: 1 if $VERBOSE
387
387
  filename = legacy_filename
388
388
  end
389
389
 
@@ -392,7 +392,7 @@ module Psych
392
392
  end
393
393
 
394
394
  if fallback != NOT_GIVEN
395
- warn 'warning: Passing the `fallback` keyword argument of Psych.parse is deprecated.'
395
+ warn_with_uplevel 'Passing the `fallback` keyword argument of Psych.parse is deprecated.', uplevel: 1 if $VERBOSE
396
396
  fallback
397
397
  else
398
398
  false
@@ -447,7 +447,7 @@ module Psych
447
447
  # See Psych::Nodes for more information about YAML AST.
448
448
  def self.parse_stream yaml, legacy_filename = NOT_GIVEN, filename: nil, &block
449
449
  if legacy_filename != NOT_GIVEN
450
- warn 'warning: Passing filename with the 2nd argument of Psych.parse_stream is deprecated. Use keyword argument like Psych.parse_stream(yaml, filename: ...) instead.'
450
+ warn_with_uplevel 'Passing filename with the 2nd argument of Psych.parse_stream is deprecated. Use keyword argument like Psych.parse_stream(yaml, filename: ...) instead.', uplevel: 1 if $VERBOSE
451
451
  filename = legacy_filename
452
452
  end
453
453
 
@@ -553,7 +553,7 @@ module Psych
553
553
  #
554
554
  def self.load_stream yaml, legacy_filename = NOT_GIVEN, filename: nil, fallback: []
555
555
  if legacy_filename != NOT_GIVEN
556
- warn 'warning: Passing filename with the 2nd argument of Psych.load_stream is deprecated. Use keyword argument like Psych.load_stream(yaml, filename: ...) instead.'
556
+ warn_with_uplevel 'Passing filename with the 2nd argument of Psych.load_stream is deprecated. Use keyword argument like Psych.load_stream(yaml, filename: ...) instead.', uplevel: 1 if $VERBOSE
557
557
  filename = legacy_filename
558
558
  end
559
559
 
@@ -617,6 +617,21 @@ module Psych
617
617
  end
618
618
  private_class_method :symbolize_names!
619
619
 
620
+ # Workaround for emulating `warn '...', uplevel: 1` in Ruby 2.4 or lower.
621
+ def self.warn_with_uplevel(message, uplevel: 1)
622
+ at = parse_caller(caller[uplevel]).join(':')
623
+ warn "#{at}: #{message}"
624
+ end
625
+
626
+ def self.parse_caller(at)
627
+ if /^(.+?):(\d+)(?::in `.*')?/ =~ at
628
+ file = $1
629
+ line = $2.to_i
630
+ [file, line]
631
+ end
632
+ end
633
+ private_class_method :warn_with_uplevel, :parse_caller
634
+
620
635
  class << self
621
636
  attr_accessor :load_tags
622
637
  attr_accessor :dump_tags
@@ -1,7 +1,8 @@
1
+
1
2
  # frozen_string_literal: true
2
3
  module Psych
3
4
  # The version of Psych you are using
4
- VERSION = '3.0.3.pre5' unless defined?(::Psych::VERSION)
5
+ VERSION = '3.1.0' unless defined?(::Psych::VERSION)
5
6
 
6
7
  if RUBY_ENGINE == 'jruby'
7
8
  DEFAULT_SNAKEYAML_VERSION = '1.23'.freeze
@@ -57,14 +57,19 @@ DESCRIPTION
57
57
  if RUBY_ENGINE == 'jruby'
58
58
  s.platform = 'java'
59
59
  s.files.concat [
60
- "ext/java/PsychEmitter.java", "ext/java/PsychLibrary.java", "ext/java/PsychParser.java", "ext/java/PsychToRuby.java",
61
- "ext/java/PsychYamlTree.java", "lib/psych_jars.rb", "lib/psych.jar"
60
+ "ext/java/org/jruby/ext/psych/PsychEmitter.java",
61
+ "ext/java/org/jruby/ext/psych/PsychLibrary.java",
62
+ "ext/java/org/jruby/ext/psych/PsychParser.java",
63
+ "ext/java/org/jruby/ext/psych/PsychToRuby.java",
64
+ "ext/java/org/jruby/ext/psych/PsychYamlTree.java",
65
+ "lib/psych_jars.rb",
66
+ "lib/psych.jar"
62
67
  ]
63
68
  s.requirements = "jar org.yaml:snakeyaml, #{Psych::DEFAULT_SNAKEYAML_VERSION}"
64
69
  s.add_dependency 'jar-dependencies', '>= 0.1.7'
65
70
  s.add_development_dependency 'ruby-maven'
66
71
  else
67
72
  s.extensions = ["ext/psych/extconf.rb"]
68
- s.add_development_dependency 'rake-compiler-dock', ">= 0.6.1"
73
+ s.add_development_dependency 'rake-compiler-dock', ">= 0.6.3"
69
74
  end
70
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3.pre5
4
+ version: 3.1.0
5
5
  platform: java
6
6
  authors:
7
7
  - Aaron Patterson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-10-19 00:00:00.000000000 Z
13
+ date: 2018-12-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
@@ -91,11 +91,11 @@ files:
91
91
  - Rakefile
92
92
  - bin/console
93
93
  - bin/setup
94
- - ext/java/PsychEmitter.java
95
- - ext/java/PsychLibrary.java
96
- - ext/java/PsychParser.java
97
- - ext/java/PsychToRuby.java
98
- - ext/java/PsychYamlTree.java
94
+ - ext/java/org/jruby/ext/psych/PsychEmitter.java
95
+ - ext/java/org/jruby/ext/psych/PsychLibrary.java
96
+ - ext/java/org/jruby/ext/psych/PsychParser.java
97
+ - ext/java/org/jruby/ext/psych/PsychToRuby.java
98
+ - ext/java/org/jruby/ext/psych/PsychYamlTree.java
99
99
  - ext/psych/depend
100
100
  - ext/psych/extconf.rb
101
101
  - ext/psych/psych.c