pstore 0.1.4 → 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 +5 -5
- data/.github/workflows/test.yml +6 -2
- data/lib/pstore.rb +15 -10
- metadata +4 -6
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
|
@@ -23,24 +23,24 @@ jobs:
|
|
|
23
23
|
|
|
24
24
|
steps:
|
|
25
25
|
- name: Harden Runner
|
|
26
|
-
uses: step-security/harden-runner@
|
|
26
|
+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
|
|
27
27
|
with:
|
|
28
28
|
egress-policy: audit
|
|
29
29
|
|
|
30
|
-
- uses: actions/checkout@
|
|
30
|
+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
31
31
|
|
|
32
32
|
- name: Set up Ruby
|
|
33
|
-
uses: ruby/setup-ruby@
|
|
33
|
+
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
|
|
34
34
|
with:
|
|
35
35
|
bundler-cache: true
|
|
36
36
|
ruby-version: ruby
|
|
37
37
|
|
|
38
38
|
- name: Publish to RubyGems
|
|
39
|
-
uses: rubygems/release-gem@
|
|
39
|
+
uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
|
|
40
40
|
|
|
41
41
|
- name: Create GitHub release
|
|
42
42
|
run: |
|
|
43
43
|
tag_name="$(git describe --tags --abbrev=0)"
|
|
44
44
|
gh release create "${tag_name}" --verify-tag --generate-notes
|
|
45
45
|
env:
|
|
46
|
-
GITHUB_TOKEN: ${{ secrets.
|
|
46
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.github/workflows/test.yml
CHANGED
|
@@ -15,13 +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
19
|
exclude:
|
|
20
20
|
- { os: macos-latest, ruby: '2.4' }
|
|
21
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 }
|
|
22
26
|
runs-on: ${{ matrix.os }}
|
|
23
27
|
steps:
|
|
24
|
-
- uses: actions/checkout@
|
|
28
|
+
- uses: actions/checkout@v6
|
|
25
29
|
- name: Set up Ruby
|
|
26
30
|
uses: ruby/setup-ruby@v1
|
|
27
31
|
with:
|
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
|
|
@@ -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,6 +16,7 @@ executables: []
|
|
|
17
16
|
extensions: []
|
|
18
17
|
extra_rdoc_files: []
|
|
19
18
|
files:
|
|
19
|
+
- ".document"
|
|
20
20
|
- ".github/dependabot.yml"
|
|
21
21
|
- ".github/workflows/push_gem.yml"
|
|
22
22
|
- ".github/workflows/test.yml"
|
|
@@ -37,7 +37,6 @@ licenses:
|
|
|
37
37
|
metadata:
|
|
38
38
|
homepage_uri: https://github.com/ruby/pstore
|
|
39
39
|
source_code_uri: https://github.com/ruby/pstore
|
|
40
|
-
post_install_message:
|
|
41
40
|
rdoc_options: []
|
|
42
41
|
require_paths:
|
|
43
42
|
- lib
|
|
@@ -52,8 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
51
|
- !ruby/object:Gem::Version
|
|
53
52
|
version: '0'
|
|
54
53
|
requirements: []
|
|
55
|
-
rubygems_version: 3.
|
|
56
|
-
signing_key:
|
|
54
|
+
rubygems_version: 3.6.9
|
|
57
55
|
specification_version: 4
|
|
58
56
|
summary: Transactional File Storage for Ruby Objects
|
|
59
57
|
test_files: []
|