yaml 0.3.0 → 0.4.0

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: 2dc49195cfce5604fb8c6ff7ff3265afcd1c67ebb9bad912452c6f0564179f36
4
- data.tar.gz: 880779b8ddc77af8cd27ab60659a52051d0473306e35971c667d37bd8194f5c9
3
+ metadata.gz: 5dcfdb3cb480354da7ad672a9a0986ad713a5c32557eb90d23f1368bc6981191
4
+ data.tar.gz: ae62a49d7547d21e5e2976a092d301f20a8855756e42dfc6ec4abd77c61708d4
5
5
  SHA512:
6
- metadata.gz: d60f0111093a28c23130dc2c1bfdf9e644a488caa2d10e993fbdad02bedc544c58b8667b1414948755e9c299b50eca1fe4638f69f4fe0a12376bfa486596b597
7
- data.tar.gz: 96854fbcb9435f9e0bb95d873fed77af878783f984385ca73dde1267d10d38ea29ba43b2fa51f1f9ce37a7dc40194492d2028e9e2c5d31b2bbef2ffe261565be
6
+ metadata.gz: ee7b7680940c7928bea5cb030e2f15f4d374346d76bcc61fe6dfb16e3a8320458472be5a431cc51720d4e930c97945e8bf963a418aa8c1c89315b527db8bf821
7
+ data.tar.gz: ba744ec72c51fd63f80e8345e59ff6bf3ef73dae67674908db8650c0235e72f448403a8a623620ed4433aa0dbe44f321867c37d98949ce05c8926cc7457e4453
@@ -0,0 +1,51 @@
1
+ name: Publish gem to rubygems.org
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ push:
13
+ if: github.repository == 'ruby/yaml'
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: rubygems.org
18
+ url: https://rubygems.org/gems/yaml
19
+
20
+ permissions:
21
+ contents: write
22
+ id-token: write
23
+
24
+ steps:
25
+ - name: Harden Runner
26
+ uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
27
+ with:
28
+ egress-policy: audit
29
+
30
+ - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
31
+
32
+ - name: Install system dependencies
33
+ run: |
34
+ sudo apt-get update
35
+ sudo apt-get install -y libdb-dev
36
+
37
+ - name: Set up Ruby
38
+ uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
39
+ with:
40
+ bundler-cache: true
41
+ ruby-version: ruby
42
+
43
+ - name: Publish to RubyGems
44
+ uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1
45
+
46
+ - name: Create GitHub release
47
+ run: |
48
+ tag_name="$(git describe --tags --abbrev=0)"
49
+ gh release create "${tag_name}" --verify-tag --generate-notes
50
+ env:
51
+ GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }}
@@ -16,14 +16,24 @@ jobs:
16
16
  matrix:
17
17
  ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
18
18
  os: [ ubuntu-latest, macos-latest ]
19
+ exclude:
20
+ - os: macos-latest
21
+ ruby: 2.4
22
+ - os: macos-latest
23
+ ruby: 2.5
19
24
  runs-on: ${{ matrix.os }}
20
25
  steps:
21
- - uses: actions/checkout@v4.1.1
26
+ - uses: actions/checkout@v4.2.2
22
27
  - name: Set up Ruby
23
28
  uses: ruby/setup-ruby@v1
24
29
  with:
25
30
  ruby-version: ${{ matrix.ruby }}
31
+ - name: Install system dependencies
32
+ run: |
33
+ sudo apt-get update
34
+ sudo apt-get install -y libdb-dev
35
+ if: matrix.os == 'ubuntu-latest'
26
36
  - name: Install dependencies
27
37
  run: bundle install --jobs 4 --retry 3
28
38
  - name: Run test
29
- run: bundle exec rake test
39
+ run: rake test
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
4
4
  modification, are permitted provided that the following conditions
5
5
  are met:
6
6
  1. Redistributions of source code must retain the above copyright
7
- notice, this list of conditions and the following disclaimer.
7
+ notice, this list of conditions and the following disclaimer.
8
8
  2. Redistributions in binary form must reproduce the above copyright
9
- notice, this list of conditions and the following disclaimer in the
10
- documentation and/or other materials provided with the distribution.
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
11
 
12
12
  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13
13
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
data/COPYING ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <[email protected]>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/Gemfile CHANGED
@@ -1,8 +1,10 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  group :development do
4
- gem "bundler"
5
4
  gem "rake"
6
5
  gem "test-unit"
7
6
  gem "test-unit-ruby-core"
7
+
8
+ gem "pstore"
9
+ gem "dbm"
8
10
  end
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  This module provides a Ruby interface for data serialization in YAML format.
4
4
 
5
5
  The `YAML` module is an alias for
6
- [Psych](https://ruby-doc.org/stdlib/libdoc/psych/rdoc/index.html),
6
+ [Psych](https://ruby-doc.org/stdlib/exts/psych/Psych.html),
7
7
  the `YAML` engine for Ruby.
8
8
 
9
9
  ## Installation
data/lib/yaml/dbm.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: false
2
2
  require 'yaml'
3
- require 'dbm'
3
+
4
+ begin
5
+ require 'dbm'
6
+ rescue LoadError
7
+ end
4
8
 
5
9
  module YAML
6
10
 
@@ -16,7 +20,6 @@ module YAML
16
20
  #
17
21
  # See the documentation for ::DBM and ::YAML for more information.
18
22
  class DBM < ::DBM
19
- VERSION = "0.1" # :nodoc:
20
23
 
21
24
  # :call-seq:
22
25
  # ydbm[key] -> value
@@ -56,7 +59,13 @@ class DBM < ::DBM
56
59
  def fetch( keystr, ifnone = nil )
57
60
  begin
58
61
  val = super( keystr )
59
- return YAML.load( val ) if String === val
62
+ if String === val
63
+ if YAML.respond_to?(:safe_load)
64
+ return YAML.safe_load( val )
65
+ else
66
+ return YAML.load( val )
67
+ end
68
+ end
60
69
  rescue IndexError
61
70
  end
62
71
  if block_given?
@@ -102,7 +111,11 @@ class DBM < ::DBM
102
111
  def delete( key )
103
112
  v = super( key )
104
113
  if String === v
105
- v = YAML.load( v )
114
+ if YAML.respond_to?(:safe_load)
115
+ v = YAML.safe_load( v )
116
+ else
117
+ v = YAML.load( v )
118
+ end
106
119
  end
107
120
  v
108
121
  end
@@ -149,7 +162,7 @@ class DBM < ::DBM
149
162
  #
150
163
  # Returns +self+.
151
164
  def each_value # :yields: value
152
- super { |v| yield YAML.load( v ) }
165
+ super { |v| yield YAML.respond_to?(:safe_load) ? YAML.safe_load( v ) : YAML.load( v ) }
153
166
  self
154
167
  end
155
168
 
@@ -158,7 +171,7 @@ class DBM < ::DBM
158
171
  #
159
172
  # Returns an array of values from the database.
160
173
  def values
161
- super.collect { |v| YAML.load( v ) }
174
+ super.collect { |v| YAML.respond_to?(:safe_load) ? YAML.safe_load( v ) : YAML.load( v ) }
162
175
  end
163
176
 
164
177
  # :call-seq:
@@ -204,7 +217,9 @@ class DBM < ::DBM
204
217
  # The order in which values are removed/returned is not guaranteed.
205
218
  def shift
206
219
  a = super
207
- a[1] = YAML.load( a[1] ) if a
220
+ if a
221
+ a[1] = YAML.respond_to?(:safe_load) ? YAML.safe_load( a[1] ) : YAML.load( a[1] )
222
+ end
208
223
  a
209
224
  end
210
225
 
@@ -277,4 +292,4 @@ class DBM < ::DBM
277
292
  alias :each :each_pair
278
293
  end
279
294
 
280
- end
295
+ end if defined?(DBM)
data/lib/yaml/store.rb CHANGED
@@ -3,7 +3,11 @@
3
3
  # YAML::Store
4
4
  #
5
5
  require 'yaml'
6
- require 'pstore'
6
+
7
+ begin
8
+ require 'pstore'
9
+ rescue LoadError
10
+ end
7
11
 
8
12
  # YAML::Store provides the same functionality as PStore, except it uses YAML
9
13
  # to dump objects instead of Marshal.
@@ -65,8 +69,16 @@ class YAML::Store < PStore
65
69
  end
66
70
 
67
71
  def load(content)
68
- table = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(content) : YAML.load(content)
69
- if table == false
72
+ table = if YAML.respond_to?(:safe_load)
73
+ if Psych::VERSION >= "3.1"
74
+ YAML.safe_load(content, permitted_classes: [Symbol])
75
+ else
76
+ YAML.safe_load(content, [Symbol])
77
+ end
78
+ else
79
+ YAML.load(content)
80
+ end
81
+ if table == false || table == nil
70
82
  {}
71
83
  else
72
84
  table
@@ -83,4 +95,4 @@ class YAML::Store < PStore
83
95
  def empty_marshal_checksum
84
96
  CHECKSUM_ALGO.digest(empty_marshal_data)
85
97
  end
86
- end
98
+ end if defined?(::PStore)
data/lib/yaml.rb CHANGED
@@ -66,5 +66,5 @@ YAML = Psych # :nodoc:
66
66
  #
67
67
  # Syck can also be found on github: https://github.com/ruby/syck
68
68
  module YAML
69
- LOADER_VERSION = "0.3.0"
69
+ LOADER_VERSION = "0.4.0"
70
70
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  - SHIBATA Hiroshi
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-11-06 00:00:00.000000000 Z
12
+ date: 2024-11-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: YAML Ain't Markup Language
15
15
  email:
@@ -20,10 +20,12 @@ extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
22
  - ".github/dependabot.yml"
23
+ - ".github/workflows/push_gem.yml"
23
24
  - ".github/workflows/test.yml"
24
25
  - ".gitignore"
26
+ - BSDL
27
+ - COPYING
25
28
  - Gemfile
26
- - LICENSE.txt
27
29
  - README.md
28
30
  - Rakefile
29
31
  - bin/console
@@ -39,7 +41,7 @@ licenses:
39
41
  metadata:
40
42
  homepage_uri: https://github.com/ruby/yaml
41
43
  source_code_uri: https://github.com/ruby/yaml
42
- post_install_message:
44
+ post_install_message:
43
45
  rdoc_options: []
44
46
  require_paths:
45
47
  - lib
@@ -54,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
56
  - !ruby/object:Gem::Version
55
57
  version: '0'
56
58
  requirements: []
57
- rubygems_version: 3.5.0.dev
58
- signing_key:
59
+ rubygems_version: 3.5.11
60
+ signing_key:
59
61
  specification_version: 4
60
62
  summary: YAML Ain't Markup Language
61
63
  test_files: []
OSZAR »