measured 3.2.0 → 3.2.2
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/.github/dependabot.yml +4 -0
- data/.github/release.yml +22 -0
- data/.github/workflows/ci.yml +2 -5
- data/.github/workflows/dependabot_auto_merge.yml +4 -4
- data/.github/workflows/release.yml +52 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +7 -0
- data/dev.yml +1 -1
- data/lib/measured/cache/json.rb +4 -2
- data/lib/measured/version.rb +1 -1
- data/measured.gemspec +1 -1
- data/test/cache/json_test.rb +25 -0
- metadata +7 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28b85a1e372c462023f0ad7985c8d8cb3c87b3de116593e8f26904e7734cfe85
|
|
4
|
+
data.tar.gz: fc223a541062dd7f3f94b9fe499f2af21ea198f2c73f2067ebf9f241086e856e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3189c14a03d9558b121c945f823475f0a21293461e9c4034da5ef48a8500c10cafd8be75dbc1e1b3b377efaf8ede981eb74a47b4fdb30dfd1db0f12b6da5e092
|
|
7
|
+
data.tar.gz: 02d983b4ce3860b6f2a88f1a8ef0d3332e5898675d6fce527ac8b5744de19742a9b5209a5eac414c46bfd4d0b1ef0356191a1361a5032f7b72602cd89af68d3e
|
data/.github/dependabot.yml
CHANGED
|
@@ -11,6 +11,10 @@ registries:
|
|
|
11
11
|
username: ${{secrets.DEPENDENCIES_GITHUB_USER}}
|
|
12
12
|
password: ${{secrets.DEPENDENCIES_GITHUB_TOKEN}}
|
|
13
13
|
updates:
|
|
14
|
+
- package-ecosystem: github-actions
|
|
15
|
+
directory: "/"
|
|
16
|
+
schedule:
|
|
17
|
+
interval: weekly
|
|
14
18
|
- package-ecosystem: bundler
|
|
15
19
|
directory: "/"
|
|
16
20
|
schedule:
|
data/.github/release.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
changelog:
|
|
2
|
+
exclude:
|
|
3
|
+
labels:
|
|
4
|
+
- dependencies
|
|
5
|
+
- chore
|
|
6
|
+
- documentation
|
|
7
|
+
authors:
|
|
8
|
+
- dependabot
|
|
9
|
+
categories:
|
|
10
|
+
- title: 🚧 Breaking Changes
|
|
11
|
+
labels:
|
|
12
|
+
- breaking-change
|
|
13
|
+
- title: ✨ Enhancements
|
|
14
|
+
labels:
|
|
15
|
+
- enhancement
|
|
16
|
+
- feature
|
|
17
|
+
- title: 🐛 Bug Fixes
|
|
18
|
+
labels:
|
|
19
|
+
- bugfix
|
|
20
|
+
- title: 🛠 Other Changes
|
|
21
|
+
labels:
|
|
22
|
+
- "*"
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -10,7 +10,6 @@ jobs:
|
|
|
10
10
|
strategy:
|
|
11
11
|
matrix:
|
|
12
12
|
ruby:
|
|
13
|
-
- '3.1'
|
|
14
13
|
- '3.2'
|
|
15
14
|
- '3.3'
|
|
16
15
|
gemfile:
|
|
@@ -19,16 +18,14 @@ jobs:
|
|
|
19
18
|
- gemfiles/rails-7.1.gemfile
|
|
20
19
|
- gemfiles/rails-edge.gemfile
|
|
21
20
|
exclude:
|
|
22
|
-
- ruby: '3.1'
|
|
23
|
-
gemfile: gemfiles/rails-edge.gemfile
|
|
24
21
|
- ruby: '3.2'
|
|
25
22
|
gemfile: gemfiles/rails-edge.gemfile
|
|
26
23
|
|
|
27
24
|
name: Ruby ${{ matrix.ruby }} ${{ matrix.gemfile }}
|
|
28
25
|
steps:
|
|
29
|
-
- uses: actions/checkout@v1
|
|
26
|
+
- uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1.2.0
|
|
30
27
|
- name: Set up Ruby ${{ matrix.ruby }}
|
|
31
|
-
uses: ruby/setup-ruby@v1
|
|
28
|
+
uses: ruby/setup-ruby@e34163cd15f4bb403dcd72d98e295997e6a55798 # v1.238.0
|
|
32
29
|
with:
|
|
33
30
|
ruby-version: ${{ matrix.ruby }}
|
|
34
31
|
bundler-cache: true
|
|
@@ -8,7 +8,7 @@ jobs:
|
|
|
8
8
|
steps:
|
|
9
9
|
- name: Dependabot metadata
|
|
10
10
|
id: metadata
|
|
11
|
-
uses: dependabot/fetch-metadata@v1.6.0
|
|
11
|
+
uses: dependabot/fetch-metadata@c9c4182bf1b97f5224aee3906fd373f6b61b4526 # v1.6.0
|
|
12
12
|
with:
|
|
13
13
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ jobs:
|
|
|
16
16
|
id: check_ci_failure
|
|
17
17
|
continue-on-error: true
|
|
18
18
|
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.dependency-group == 'auto_merge' }}
|
|
19
|
-
uses: actions/github-script@v6
|
|
19
|
+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
|
|
20
20
|
with:
|
|
21
21
|
script: |
|
|
22
22
|
function sleep(ms) {
|
|
@@ -62,7 +62,7 @@ jobs:
|
|
|
62
62
|
core.setOutput("ci_state", ci_state)
|
|
63
63
|
- name: Send Slack notification if auto-merge failed
|
|
64
64
|
if: ${{ steps.check_ci_failure.outputs.ci_state == 'false' }}
|
|
65
|
-
uses: ruby/action-slack@v3.0.0
|
|
65
|
+
uses: ruby/action-slack@b6882ea6ef8f556f9f9af9ec1220d3f1ced74acf # v3.0.0
|
|
66
66
|
with:
|
|
67
67
|
payload: |
|
|
68
68
|
{
|
|
@@ -77,7 +77,7 @@ jobs:
|
|
|
77
77
|
|
|
78
78
|
- name: Approve and merge
|
|
79
79
|
if: ${{ steps.check_ci_failure.outputs.ci_state == 'true' && (steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.dependency-group == 'auto_merge') }}
|
|
80
|
-
uses: actions/github-script@v6
|
|
80
|
+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
|
|
81
81
|
with:
|
|
82
82
|
script: |
|
|
83
83
|
await github.rest.pulls.createReview({
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Release gem on RubyGems.org and create GitHub release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release_gem:
|
|
10
|
+
name: Release gem on RubyGems.org
|
|
11
|
+
if: github.repository == 'Shopify/measured'
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: write
|
|
16
|
+
id-token: write
|
|
17
|
+
|
|
18
|
+
environment: release
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout repository
|
|
22
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
|
|
26
|
+
- name: Set up Ruby
|
|
27
|
+
uses: ruby/setup-ruby@26e5b7d197ebf60545ee9667bcbace0be11ccaec # v1.334.0
|
|
28
|
+
with:
|
|
29
|
+
bundler-cache: true
|
|
30
|
+
|
|
31
|
+
- name: Release gem on RubyGems.org
|
|
32
|
+
uses: rubygems/release-gem@7f9650160c1a4e7989fdc9855807bdbd421d8b6b # v1.4.1
|
|
33
|
+
|
|
34
|
+
release_github:
|
|
35
|
+
name: Create GitHub release
|
|
36
|
+
if: github.repository == 'Shopify/measured'
|
|
37
|
+
needs: release_gem
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
|
|
40
|
+
permissions:
|
|
41
|
+
contents: write
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: Checkout repository
|
|
45
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
46
|
+
|
|
47
|
+
- name: Create GitHub release
|
|
48
|
+
run: |
|
|
49
|
+
tag_name="$(git describe --tags --abbrev=0)"
|
|
50
|
+
gh release create "${tag_name}" --verify-tag --generate-notes
|
|
51
|
+
env:
|
|
52
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4.0.7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Unreleased
|
|
2
|
+
|
|
3
|
+
3.2.2
|
|
4
|
+
-----
|
|
5
|
+
* Fix loading the JSON conversion table cache under json 3.0, which no longer accepts comments by default. (@bonjourjules)
|
|
6
|
+
|
|
7
|
+
3.2.1
|
|
2
8
|
-----
|
|
9
|
+
* Restrict Measured::Cache::Json initializer to valid filenames. (@caseyshop)
|
|
3
10
|
|
|
4
11
|
3.2.0
|
|
5
12
|
-----
|
data/dev.yml
CHANGED
data/lib/measured/cache/json.rb
CHANGED
|
@@ -5,7 +5,8 @@ module Measured::Cache
|
|
|
5
5
|
|
|
6
6
|
def initialize(filename)
|
|
7
7
|
@filename = filename
|
|
8
|
-
|
|
8
|
+
raise ArgumentError, "Invalid cache file: #{filename}" unless %w[length.json weight.json volume.json test.json].include?(filename.to_s)
|
|
9
|
+
@path = Pathname.new(File.join(File.dirname(__FILE__), "../../../cache", filename)).cleanpath
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def exist?
|
|
@@ -14,7 +15,8 @@ module Measured::Cache
|
|
|
14
15
|
|
|
15
16
|
def read
|
|
16
17
|
return unless exist?
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
decode(JSON.load(File.read(@path), nil, freeze: true, allow_comments: true))
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def write(table)
|
data/lib/measured/version.rb
CHANGED
data/measured.gemspec
CHANGED
|
@@ -37,5 +37,5 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_development_dependency "pry"
|
|
38
38
|
spec.add_development_dependency "combustion"
|
|
39
39
|
spec.add_development_dependency "sqlite3", "> 1.4"
|
|
40
|
-
spec.add_development_dependency "tapioca"
|
|
40
|
+
spec.add_development_dependency "tapioca", ">= 0.17.0"
|
|
41
41
|
end
|
data/test/cache/json_test.rb
CHANGED
|
@@ -14,6 +14,24 @@ class Measured::Cache::JsonTest < ActiveSupport::TestCase
|
|
|
14
14
|
refute_match "../", @cache.path.to_s
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
test "#initialize accepts valid cache filenames for Measured::Measurable.subclasses, and test file" do
|
|
18
|
+
valid_files = %w[length.json weight.json volume.json test.json]
|
|
19
|
+
valid_files.each do |filename|
|
|
20
|
+
assert_nothing_raised do
|
|
21
|
+
Measured::Cache::Json.new(filename)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
test "#initialize rejects invalid cache filenames" do
|
|
27
|
+
invalid_files = ["volum.json", "../volume.json", "other.txt"]
|
|
28
|
+
invalid_files.each do |filename|
|
|
29
|
+
assert_raises ArgumentError do
|
|
30
|
+
Measured::Cache::Json.new(filename)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
17
35
|
test "#exist? returns false if the file does not exist" do
|
|
18
36
|
File.expects(:exist?).with(@cache.path).returns(false)
|
|
19
37
|
refute_predicate @cache, :exist?
|
|
@@ -35,6 +53,13 @@ class Measured::Cache::JsonTest < ActiveSupport::TestCase
|
|
|
35
53
|
assert_equal @table_hash, @cache.read
|
|
36
54
|
end
|
|
37
55
|
|
|
56
|
+
test "#read loads a file that starts with the comment header written by the writer" do
|
|
57
|
+
commented_json = "// Do not modify this file directly. Regenerate it with 'rake cache:write'.\n#{@table_json}"
|
|
58
|
+
File.expects(:exist?).with(@cache.path).returns(true)
|
|
59
|
+
File.expects(:read).with(@cache.path).returns(commented_json)
|
|
60
|
+
assert_equal @table_hash, @cache.read
|
|
61
|
+
end
|
|
62
|
+
|
|
38
63
|
test "#write raises not implemented" do
|
|
39
64
|
assert_raises(ArgumentError) do
|
|
40
65
|
@cache.write({})
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: measured
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.2.
|
|
4
|
+
version: 3.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin McPhillips
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
- Javier Honduvilla Coto
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
@@ -129,14 +129,14 @@ dependencies:
|
|
|
129
129
|
requirements:
|
|
130
130
|
- - ">="
|
|
131
131
|
- !ruby/object:Gem::Version
|
|
132
|
-
version:
|
|
132
|
+
version: 0.17.0
|
|
133
133
|
type: :development
|
|
134
134
|
prerelease: false
|
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
|
136
136
|
requirements:
|
|
137
137
|
- - ">="
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
|
-
version:
|
|
139
|
+
version: 0.17.0
|
|
140
140
|
description: Wrapper objects which encapsulate measurements and their associated units
|
|
141
141
|
in Ruby.
|
|
142
142
|
email:
|
|
@@ -146,9 +146,11 @@ extensions: []
|
|
|
146
146
|
extra_rdoc_files: []
|
|
147
147
|
files:
|
|
148
148
|
- ".github/dependabot.yml"
|
|
149
|
+
- ".github/release.yml"
|
|
149
150
|
- ".github/workflows/ci.yml"
|
|
150
151
|
- ".github/workflows/cla.yml"
|
|
151
152
|
- ".github/workflows/dependabot_auto_merge.yml"
|
|
153
|
+
- ".github/workflows/release.yml"
|
|
152
154
|
- ".gitignore"
|
|
153
155
|
- ".ruby-version"
|
|
154
156
|
- CHANGELOG.md
|
|
@@ -240,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
240
242
|
- !ruby/object:Gem::Version
|
|
241
243
|
version: '0'
|
|
242
244
|
requirements: []
|
|
243
|
-
rubygems_version:
|
|
245
|
+
rubygems_version: 4.0.20
|
|
244
246
|
specification_version: 4
|
|
245
247
|
summary: Encapsulate measurements with their units in Ruby
|
|
246
248
|
test_files:
|