pstore 0.1.3 → 0.2.1
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 +4 -4
- data/.document +4 -0
- data/.github/workflows/push_gem.yml +46 -0
- data/.github/workflows/test.yml +9 -2
- data/{LICENSE.txt → BSDL} +3 -3
- data/COPYING +56 -0
- data/lib/pstore.rb +16 -11
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 581505ed1677d161bfeab6b72527336b3593726a2ef3e354155e944c0189bf8b
|
|
4
|
+
data.tar.gz: 29a99aead3e82f72c1bbcf821a39dbba0601f58d93cbc8649d6d522da938e8c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2713ed297961e320cc23a3ae9659f233bff05769878312f0516dbdd207dac8bcd6f979ca082717ba5ca65dd7b39c129149b7bcb269b39e243dac4294270353b2
|
|
7
|
+
data.tar.gz: f3833ca460fe0406a9bb1d21c8b19dfd515a0b5706aa91cfc4114b2f62696962cbad1773b8bfe62701a24321d77aa15d0e96aabbbf91586ca82284dd5d412a84
|
data/.document
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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/pstore'
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
environment:
|
|
17
|
+
name: rubygems.org
|
|
18
|
+
url: https://rubygems.org/gems/pstore
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: write
|
|
22
|
+
id-token: write
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- name: Harden Runner
|
|
26
|
+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
|
27
|
+
with:
|
|
28
|
+
egress-policy: audit
|
|
29
|
+
|
|
30
|
+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
31
|
+
|
|
32
|
+
- name: Set up Ruby
|
|
33
|
+
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
|
|
34
|
+
with:
|
|
35
|
+
bundler-cache: true
|
|
36
|
+
ruby-version: ruby
|
|
37
|
+
|
|
38
|
+
- name: Publish to RubyGems
|
|
39
|
+
uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
|
|
40
|
+
|
|
41
|
+
- name: Create GitHub release
|
|
42
|
+
run: |
|
|
43
|
+
tag_name="$(git describe --tags --abbrev=0)"
|
|
44
|
+
gh release create "${tag_name}" --verify-tag --generate-notes
|
|
45
|
+
env:
|
|
46
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.github/workflows/test.yml
CHANGED
|
@@ -15,10 +15,17 @@ jobs:
|
|
|
15
15
|
strategy:
|
|
16
16
|
matrix:
|
|
17
17
|
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
|
18
|
-
os: [ ubuntu-latest, macos-latest ]
|
|
18
|
+
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
|
19
|
+
exclude:
|
|
20
|
+
- { os: macos-latest, ruby: '2.4' }
|
|
21
|
+
- { os: macos-latest, ruby: '2.5' }
|
|
22
|
+
- { os: windows-latest, ruby: head }
|
|
23
|
+
include:
|
|
24
|
+
- { os: windows-latest, ruby: mingw }
|
|
25
|
+
- { os: windows-latest, ruby: mswin }
|
|
19
26
|
runs-on: ${{ matrix.os }}
|
|
20
27
|
steps:
|
|
21
|
-
- uses: actions/checkout@
|
|
28
|
+
- uses: actions/checkout@v6
|
|
22
29
|
- name: Set up Ruby
|
|
23
30
|
uses: ruby/setup-ruby@v1
|
|
24
31
|
with:
|
data/{LICENSE.txt → BSDL}
RENAMED
|
@@ -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 <matz@netlab.jp>.
|
|
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/lib/pstore.rb
CHANGED
|
@@ -326,11 +326,14 @@ require "digest"
|
|
|
326
326
|
# end
|
|
327
327
|
#
|
|
328
328
|
class PStore
|
|
329
|
-
|
|
329
|
+
# :stopdoc:
|
|
330
|
+
VERSION = "0.2.1"
|
|
330
331
|
|
|
331
332
|
RDWR_ACCESS = {mode: IO::RDWR | IO::CREAT | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
|
|
332
333
|
RD_ACCESS = {mode: IO::RDONLY | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
|
|
333
334
|
WR_ACCESS = {mode: IO::WRONLY | IO::CREAT | IO::TRUNC | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
|
|
335
|
+
private_constant :RDWR_ACCESS, :RD_ACCESS, :WR_ACCESS
|
|
336
|
+
# :startdoc:
|
|
334
337
|
|
|
335
338
|
# The error type thrown by all PStore methods.
|
|
336
339
|
class Error < StandardError
|
|
@@ -437,7 +440,7 @@ class PStore
|
|
|
437
440
|
in_transaction
|
|
438
441
|
unless @table.key? key
|
|
439
442
|
if default == PStore::Error
|
|
440
|
-
raise PStore::Error, format("undefined key
|
|
443
|
+
raise PStore::Error, format("undefined key '%s'", key)
|
|
441
444
|
else
|
|
442
445
|
return default
|
|
443
446
|
end
|
|
@@ -591,6 +594,8 @@ class PStore
|
|
|
591
594
|
end
|
|
592
595
|
|
|
593
596
|
private
|
|
597
|
+
# :stopdoc:
|
|
598
|
+
|
|
594
599
|
# Constant for relieving Ruby's garbage collector.
|
|
595
600
|
CHECKSUM_ALGO = %w[SHA512 SHA384 SHA256 SHA1 RMD160 MD5].each do |algo|
|
|
596
601
|
begin
|
|
@@ -602,6 +607,10 @@ class PStore
|
|
|
602
607
|
EMPTY_MARSHAL_DATA = Marshal.dump({})
|
|
603
608
|
EMPTY_MARSHAL_CHECKSUM = CHECKSUM_ALGO.digest(EMPTY_MARSHAL_DATA)
|
|
604
609
|
|
|
610
|
+
EMPTY_MARSHAL_DATA.freeze
|
|
611
|
+
EMPTY_MARSHAL_CHECKSUM.freeze
|
|
612
|
+
private_constant :CHECKSUM_ALGO, :EMPTY_STRING, :EMPTY_MARSHAL_DATA, :EMPTY_MARSHAL_CHECKSUM
|
|
613
|
+
|
|
605
614
|
#
|
|
606
615
|
# Open the specified filename (either in read-only mode or in
|
|
607
616
|
# read-write mode) and lock it for reading or writing.
|
|
@@ -664,20 +673,16 @@ class PStore
|
|
|
664
673
|
end
|
|
665
674
|
end
|
|
666
675
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
self.class.__send__(:define_method, :on_windows?) do
|
|
670
|
-
is_windows
|
|
671
|
-
end
|
|
672
|
-
is_windows
|
|
673
|
-
end
|
|
676
|
+
ON_WINDOWS = true & (/mswin|mingw|bccwin|wince/ =~ RUBY_PLATFORM) # :nodoc:
|
|
677
|
+
private_constant :ON_WINDOWS
|
|
674
678
|
|
|
675
679
|
def save_data(original_checksum, original_file_size, file)
|
|
676
680
|
new_data = dump(@table)
|
|
677
681
|
|
|
678
682
|
if new_data.bytesize != original_file_size || CHECKSUM_ALGO.digest(new_data) != original_checksum
|
|
679
|
-
if @ultra_safe && !
|
|
680
|
-
# Windows
|
|
683
|
+
if @ultra_safe && !ON_WINDOWS
|
|
684
|
+
# Once a file is locked, Windows does not guarantee that the
|
|
685
|
+
# lock will be released until the file is closed.
|
|
681
686
|
save_data_with_atomic_file_rename_strategy(new_data, file)
|
|
682
687
|
else
|
|
683
688
|
save_data_with_fast_strategy(new_data, file)
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pstore
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yukihiro Matsumoto
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Transactional File Storage for Ruby Objects
|
|
14
13
|
email:
|
|
@@ -17,11 +16,14 @@ executables: []
|
|
|
17
16
|
extensions: []
|
|
18
17
|
extra_rdoc_files: []
|
|
19
18
|
files:
|
|
19
|
+
- ".document"
|
|
20
20
|
- ".github/dependabot.yml"
|
|
21
|
+
- ".github/workflows/push_gem.yml"
|
|
21
22
|
- ".github/workflows/test.yml"
|
|
22
23
|
- ".gitignore"
|
|
24
|
+
- BSDL
|
|
25
|
+
- COPYING
|
|
23
26
|
- Gemfile
|
|
24
|
-
- LICENSE.txt
|
|
25
27
|
- README.md
|
|
26
28
|
- Rakefile
|
|
27
29
|
- bin/console
|
|
@@ -35,7 +37,6 @@ licenses:
|
|
|
35
37
|
metadata:
|
|
36
38
|
homepage_uri: https://github.com/ruby/pstore
|
|
37
39
|
source_code_uri: https://github.com/ruby/pstore
|
|
38
|
-
post_install_message:
|
|
39
40
|
rdoc_options: []
|
|
40
41
|
require_paths:
|
|
41
42
|
- lib
|
|
@@ -50,8 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
50
51
|
- !ruby/object:Gem::Version
|
|
51
52
|
version: '0'
|
|
52
53
|
requirements: []
|
|
53
|
-
rubygems_version: 3.
|
|
54
|
-
signing_key:
|
|
54
|
+
rubygems_version: 3.6.9
|
|
55
55
|
specification_version: 4
|
|
56
56
|
summary: Transactional File Storage for Ruby Objects
|
|
57
57
|
test_files: []
|