Skip to content

Commit

Permalink
ruby 3.4: gems batch 2 (#36450)
Browse files Browse the repository at this point in the history
Copied ruby3.3 files to 3.4 sed'd the version, removed sed patch for the
key that've been integrated into the pipeline. Also re add console test.
  • Loading branch information
justinvreeland authored Dec 12, 2024
1 parent 1bae9da commit f9e32c0
Show file tree
Hide file tree
Showing 31 changed files with 2,114 additions and 1 deletion.
69 changes: 69 additions & 0 deletions ruby3.4-addressable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package:
name: ruby3.4-addressable
version: 2.8.7
epoch: 0
description: Addressable is an alternative implementation to the URI implementation that is part of Ruby's standard library. It is flexible, offers heuristic parsing, and additionally provides extensive support for IRIs and URI templates.
copyright:
- license: Apache-2.0
dependencies:
runtime:
- ruby${{vars.rubyMM}}-public_suffix

environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- git
- ruby-${{vars.rubyMM}}
- ruby-${{vars.rubyMM}}-dev

vars:
gem: addressable

pipeline:
- uses: git-checkout
with:
repository: https://github.com/sporkmonger/addressable
tag: addressable-${{package.version}}
expected-commit: 7930ece6e4ae266e67fc927f2e44e39f97fd5f22

- uses: ruby/build
with:
gem: ${{vars.gem}}

- uses: ruby/install
with:
gem: ${{vars.gem}}
version: ${{package.version}}

- uses: ruby/clean

test:
pipeline:
- runs: ruby -e "require 'addressable'"
- name: Parse URI
runs: |
cat <<EOF > /tmp/test.rb
require 'addressable/uri'
uri = Addressable::URI.parse("https://edu.chainguard.dev/open-source/wolfi/overview/")
uri.scheme
uri.host
uri.path
uri.normalize
EOF
ruby /tmp/test.rb
update:
enabled: true
github:
identifier: sporkmonger/addressable
strip-prefix: addressable-
use-tag: true

var-transforms:
- from: ${{package.name}}
match: ^ruby(\d\.\d+)-.*
replace: $1
to: rubyMM
99 changes: 99 additions & 0 deletions ruby3.4-aws-sigv4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#nolint:valid-pipeline-git-checkout-tag
package:
name: ruby3.4-aws-sigv4
version: 1.10.1
epoch: 0
description: Amazon Web Services Signature Version 4 signing library. Generates sigv4 signature for HTTP requests.
copyright:
- license: Apache-2.0
dependencies:
runtime:
- ruby${{vars.rubyMM}}-aws-eventstream

environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- git
- ruby-${{vars.rubyMM}}
- ruby-${{vars.rubyMM}}-dev
- zlib-dev

pipeline:
- uses: git-checkout
with:
expected-commit: 86cccb96ed7a0ee71cd33847151b4219d30b1571
repository: https://github.com/aws/aws-sdk-ruby
branch: version-3
depth: -1

- uses: ruby/build
with:
gem: ${{vars.gem}}
dir: gems/${{vars.gem}}

- uses: ruby/install
with:
gem: ${{vars.gem}}
version: ${{package.version}}
dir: gems/${{vars.gem}}

- uses: ruby/clean

vars:
gem: aws-sigv4

test:
environment:
contents:
packages:
- ruby-${{vars.rubyMM}}
pipeline:
- runs: |
ruby <<-EOF
require 'aws-sigv4'
require 'test/unit'
include Test::Unit::Assertions
# Test basic signer creation
signer = Aws::Sigv4::Signer.new(
service: 'service',
region: 'us-east-1',
access_key_id: 'akid',
secret_access_key: 'secret'
)
assert_kind_of Aws::Sigv4::Signer, signer
puts "Signer creation test passed"
# Test basic signature generation
signature = signer.sign_request(
http_method: 'GET',
url: 'https://service.us-east-1.amazonaws.com',
headers: {
'host' => 'service.us-east-1.amazonaws.com'
}
)
assert_kind_of String, signature.string_to_sign
puts "Signature string generation test passed"
# Test canonical request generation
assert signature.canonical_request.include?('GET')
assert signature.canonical_request.include?('host:service.us-east-1.amazonaws.com')
puts "Canonical request test passed"
puts "All tests passed!"
EOF
update:
enabled: false
manual: true # the library we fetch uses a different version then the package version
release-monitor:
identifier: 174496

var-transforms:
- from: ${{package.name}}
match: ^ruby(\d\.\d+)-.*
replace: $1
to: rubyMM
97 changes: 97 additions & 0 deletions ruby3.4-chronic_duration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Generated from https://github.com/hpoydar/chronic_duration
package:
name: ruby3.4-chronic_duration
version: 0.10.6
epoch: 0
description: A simple Ruby natural language parser for elapsed time. (For example, 4 hours and 30 minutes, 6 minutes 4 seconds, 3 days, etc.) Returns all results in seconds. Will return an integer unless you get tricky and need a float. (4 minutes and 13.47 seconds, for example.) The reverse can also be performed via the output method.
copyright:
- license: MIT
dependencies:
runtime:
- ruby${{vars.rubyMM}}-numerizer

environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- git
- ruby-${{vars.rubyMM}}
- ruby-${{vars.rubyMM}}-dev

pipeline:
- uses: git-checkout
with:
repository: https://github.com/hpoydar/chronic_duration
tag: v${{package.version}}
expected-commit: 55f992d6715a0920fefb5c4051e9eff40f948a21

# Upstream pin to an eol version of `numerizer` as a runtime dependency. This
# results in runtime failures when we attempt to use our (newer) version.
# This patch removes upstream pinning to a particular version at runtime.
#
# There hasn't been any updates for quite some time upstream, so there doesn't
# look to be any other reason for the pinning.
- uses: patch
with:
patches: numerizer-dependency.patch

- uses: ruby/build
with:
gem: ${{vars.gem}}

- uses: ruby/install
with:
gem: ${{vars.gem}}
version: ${{package.version}}

- uses: ruby/clean

vars:
gem: chronic_duration

test:
pipeline:
- runs: |
ruby -e "require 'chronic_duration'; puts 'ChronicDuration loaded successfully!'"
- runs: |
ruby <<-EOF
require 'chronic_duration'
# Test case 1: Parsing a simple duration
result = ChronicDuration.parse('4 hours and 30 minutes')
if result != 16200
raise 'Assertion failed: Expected 16200, got ' + result.to_s
end
puts 'Test case 1 passed: Simple duration parsing'
# Test case 2: Parsing a duration with seconds
result = ChronicDuration.parse('3 minutes and 20 seconds')
if result != 200
raise 'Assertion failed: Expected 200, got ' + result.to_s
end
puts 'Test case 2 passed: Duration with seconds parsing'
# Test case 3: Invalid input
result = ChronicDuration.parse('invalid input')
if result != nil
raise 'Assertion failed: Expected nil for invalid input, got ' + result.to_s
end
puts 'Test case 3 passed: Handling invalid input'
puts 'All test cases passed!'
EOF
update:
enabled: true
github:
identifier: hpoydar/chronic_duration
strip-prefix: v
use-tag: true

var-transforms:
- from: ${{package.name}}
match: ^ruby(\d\.\d+)-.*
replace: $1
to: rubyMM
13 changes: 13 additions & 0 deletions ruby3.4-chronic_duration/numerizer-dependency.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/chronic_duration.gemspec b/chronic_duration.gemspec
index c94711a..abd5fcc 100644
--- a/chronic_duration.gemspec
+++ b/chronic_duration.gemspec
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]

- gem.add_runtime_dependency "numerizer", "~> 0.1.1"
+ gem.add_runtime_dependency "numerizer"

gem.add_development_dependency "rake", "~> 10.0.3"
gem.add_development_dependency "rspec", "~> 2.12.0"
Loading

0 comments on commit f9e32c0

Please sign in to comment.