active_utils 3.4.1 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9de480a810228c07a1d980254f1d402df7ba80f2e988feacc95aec1afd883675
4
- data.tar.gz: c2ebda446fe2252803c210ec96252417a3e3f7c1bb99a21471358b639254f7ae
3
+ metadata.gz: 749cb044fcb177e843182013d5caaf8a6a13efa33c1218644df2c1ffddecf0b5
4
+ data.tar.gz: 35a1d31ebe872e755c590e3a3055c1c6b54b7672274f766774b21eca5d6c3016
5
5
  SHA512:
6
- metadata.gz: 14a096c421ce499640357f80be62252783ca9ab300b56c019bdde6e13fcf45b1dfedde17ce1f398efd364d4f2f1613256ee9e1b72be301fe99fc6a19838e57a0
7
- data.tar.gz: 58fcc9f444a65ca230009c4a341ee4ad80ae037ac6316e6f01b2e55e215cfbc88c525f1fa6e31cfdb8c31a865b4183176d15a51a1dbc95a377facd76cc6e1ef6
6
+ metadata.gz: 22ea40eaf40d232ad00f92c9460a139b59792df62fa9b9ca469adb6b32a66182bc5630f7f11bc90e75e38816a5d55ebca2dd7df746f9d652ef725e56bf3f54f7
7
+ data.tar.gz: f29ec7086e81adf45ab458e388677ca07ce9c66fdf5e3779dfb94421237f39cc708653e3d6bdc16f5edf5eba149219defb39697783f17f7bbbacb5b38d79cd2b
@@ -0,0 +1,20 @@
1
+ version: 2
2
+ registries:
3
+ ruby-shopify:
4
+ type: rubygems-server
5
+ url: https://pkgs.shopify.io/basic/gems/ruby
6
+ username: ${{secrets.RUBYGEMS_SERVER_PKGS_SHOPIFY_IO_USERNAME}}
7
+ password: ${{secrets.RUBYGEMS_SERVER_PKGS_SHOPIFY_IO_PASSWORD}}
8
+ github-com:
9
+ type: git
10
+ url: https://github.com
11
+ username: ${{secrets.DEPENDENCIES_GITHUB_USER}}
12
+ password: ${{secrets.DEPENDENCIES_GITHUB_TOKEN}}
13
+ updates:
14
+ - package-ecosystem: bundler
15
+ directory: "/"
16
+ schedule:
17
+ interval: weekly
18
+ open-pull-requests-limit: 100
19
+ insecure-external-code-execution: allow
20
+ registries: "*"
@@ -0,0 +1,93 @@
1
+ name: Dependabot auto-merge
2
+ on: pull_request_target
3
+
4
+ jobs:
5
+ dependabot:
6
+ runs-on: shopify-ubuntu-latest
7
+ if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
8
+ steps:
9
+ - name: Dependabot metadata
10
+ id: metadata
11
+ uses: dependabot/fetch-metadata@v1.6.0
12
+ with:
13
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
14
+
15
+ - name: Waiting for CI to finish
16
+ id: check_ci_failure
17
+ continue-on-error: true
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
20
+ with:
21
+ script: |
22
+ function sleep(ms) {
23
+ return new Promise(resolve => setTimeout(resolve, ms))
24
+ }
25
+ const query = `query ($org: String!, $repo: String!, $pullRequestNumber: Int!) {
26
+ organization(login: $org) {
27
+ repository(name: $repo) {
28
+ pullRequest(number: $pullRequestNumber) {
29
+ commits(last: 1) {
30
+ nodes {
31
+ commit {
32
+ status {
33
+ state
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }`;
42
+ const variables = {
43
+ org: context.repo.owner,
44
+ repo: context.repo.repo,
45
+ pullRequestNumber: context.issue.number
46
+ }
47
+ // Try for 30 minutes
48
+ let attempts = 30
49
+ let ci_state = false
50
+ for (let i = 1; i <= attempts; i++) {
51
+ console.log(`Sleeping for 60 seconds`)
52
+ await sleep(60000)
53
+ const result = await github.graphql(query, variables)
54
+ const state = result["organization"]["repository"]["pullRequest"]["commits"]["nodes"][0]["commit"]["status"]["state"]
55
+ console.log(`Status is ${state} after ${i} attempts`)
56
+ if (state === "SUCCESS") {
57
+ ci_state = true
58
+ console.log("Proceeding with workflow as CI succeed")
59
+ break
60
+ }
61
+ }
62
+ core.setOutput("ci_state", ci_state)
63
+ - name: Send Slack notification if auto-merge failed
64
+ if: ${{ steps.check_ci_failure.outputs.ci_state == 'false' }}
65
+ uses: ruby/action-slack@v3.0.0
66
+ with:
67
+ payload: |
68
+ {
69
+ "attachments": [{
70
+ "text": "Auto-merge failed for pull request <${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}> in repository ${{ github.repository }}",
71
+ "color": "danger"
72
+ }
73
+ ]
74
+ }
75
+ env:
76
+ SLACK_WEBHOOK_URL: ${{ secrets.METRICS_SLACK_WEBHOOK_URL }}
77
+
78
+ - name: Approve and merge
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
81
+ with:
82
+ script: |
83
+ await github.rest.pulls.createReview({
84
+ pull_number: context.issue.number,
85
+ owner: context.repo.owner,
86
+ repo: context.repo.repo,
87
+ event: 'APPROVE',
88
+ })
89
+ await github.rest.pulls.merge({
90
+ owner: context.repo.owner,
91
+ repo: context.repo.repo,
92
+ issue_number: context.issue.number,
93
+ })
@@ -0,0 +1,24 @@
1
+ name: CI
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - '**'
6
+ push:
7
+ branches:
8
+ - main
9
+ jobs:
10
+ build:
11
+ name: Ruby ${{ matrix.version }}
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ version: [ '2.7', '3.0', '3.1', '3.2', '3.3' ]
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Set up Ruby ${{ matrix.version }}
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.version }}
22
+ bundler-cache: true
23
+ - name: Test
24
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -2,4 +2,3 @@ pkg/*
2
2
  *.gem
3
3
  .bundle
4
4
  .DS_Store
5
- Gemfile.lock
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # ActiveUtils changelog
2
2
 
3
+ ### Version 3.4.2 (January 15, 2025)
4
+ - Remove numeric as a required param for `ActiveUtils::Country`
5
+
3
6
  ### Version 3.4.1 (APril 04, 2023)
4
7
  - Fix depracated deprecated calling of `=~` on Object which is removed by ruby 3.2.0 as described here: https://bugs.ruby-lang.org/issues/15231
5
8
 
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ active_utils (3.4.2)
5
+ activesupport (>= 4.2)
6
+ i18n
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (7.1.5.1)
12
+ base64
13
+ benchmark (>= 0.3)
14
+ bigdecimal
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ connection_pool (>= 2.2.5)
17
+ drb
18
+ i18n (>= 1.6, < 2)
19
+ logger (>= 1.4.2)
20
+ minitest (>= 5.1)
21
+ mutex_m
22
+ securerandom (>= 0.3)
23
+ tzinfo (~> 2.0)
24
+ base64 (0.2.0)
25
+ benchmark (0.4.0)
26
+ bigdecimal (3.1.9)
27
+ concurrent-ruby (1.3.4)
28
+ connection_pool (2.5.0)
29
+ drb (2.2.1)
30
+ i18n (1.14.6)
31
+ concurrent-ruby (~> 1.0)
32
+ logger (1.6.5)
33
+ minitest (5.22.3)
34
+ mocha (2.1.0)
35
+ ruby2_keywords (>= 0.0.5)
36
+ mutex_m (0.3.0)
37
+ rake (13.2.0)
38
+ ruby2_keywords (0.0.5)
39
+ securerandom (0.3.2)
40
+ tzinfo (2.0.6)
41
+ concurrent-ruby (~> 1.0)
42
+
43
+ PLATFORMS
44
+ arm64-darwin-21
45
+ arm64-darwin-23
46
+ x86_64-linux
47
+
48
+ DEPENDENCIES
49
+ active_utils!
50
+ minitest
51
+ mocha
52
+ rake
53
+
54
+ BUNDLED WITH
55
+ 2.4.18
data/Rakefile CHANGED
@@ -5,7 +5,6 @@ require 'rake/testtask'
5
5
 
6
6
  Rake::TestTask.new(:test) do |t|
7
7
  t.pattern = 'test/unit/**/*_test.rb'
8
- t.ruby_opts << '-rubygems'
9
8
  t.libs << 'test'
10
9
  t.verbose = true
11
10
  end
data/active_utils.gemspec CHANGED
@@ -12,6 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.summary = %q{Common utils used by active_merchant, active_fulfillment, and active_shipping}
13
13
  s.license = 'MIT'
14
14
 
15
+ s.required_ruby_version = ">= 2.7"
16
+
15
17
  s.rubyforge_project = "active_utils"
16
18
 
17
19
  s.add_dependency('activesupport', '>= 4.2')
@@ -40,7 +40,7 @@ module ActiveUtils #:nodoc:
40
40
  attr_reader :name
41
41
 
42
42
  def initialize(options = {})
43
- requires!(options, :name, :alpha2, :alpha3, :numeric)
43
+ requires!(options, :name, :alpha2, :alpha3)
44
44
  @name = options.delete(:name)
45
45
  @codes = options.collect{|k,v| CountryCode.new(v)}
46
46
  end
@@ -66,7 +66,6 @@ module ActiveUtils #:nodoc:
66
66
  { :alpha2 => 'AF', :name => 'Afghanistan', :alpha3 => 'AFG', :numeric => '004' },
67
67
  { :alpha2 => 'AX', :name => 'Aland Islands', :alpha3 => 'ALA', :numeric => '248' },
68
68
  { :alpha2 => 'AL', :name => 'Albania', :alpha3 => 'ALB', :numeric => '008' },
69
- { :alpha2 => 'AC', :name => 'Ascension Island', :alpha3 => 'ASC' },
70
69
  { :alpha2 => 'DZ', :name => 'Algeria', :alpha3 => 'DZA', :numeric => '012' },
71
70
  { :alpha2 => 'AS', :name => 'American Samoa', :alpha3 => 'ASM', :numeric => '016' },
72
71
  { :alpha2 => 'AD', :name => 'Andorra', :alpha3 => 'AND', :numeric => '020' },
@@ -77,6 +76,7 @@ module ActiveUtils #:nodoc:
77
76
  { :alpha2 => 'AR', :name => 'Argentina', :alpha3 => 'ARG', :numeric => '032' },
78
77
  { :alpha2 => 'AM', :name => 'Armenia', :alpha3 => 'ARM', :numeric => '051' },
79
78
  { :alpha2 => 'AW', :name => 'Aruba', :alpha3 => 'ABW', :numeric => '533' },
79
+ { :alpha2 => 'AC', :name => 'Ascension Island', :alpha3 => 'ASC' },
80
80
  { :alpha2 => 'AU', :name => 'Australia', :alpha3 => 'AUS', :numeric => '036' },
81
81
  { :alpha2 => 'AT', :name => 'Austria', :alpha3 => 'AUT', :numeric => '040' },
82
82
  { :alpha2 => 'AZ', :name => 'Azerbaijan', :alpha3 => 'AZE', :numeric => '031' },
@@ -1,3 +1,3 @@
1
1
  module ActiveUtils
2
- VERSION = "3.4.1"
2
+ VERSION = "3.4.2"
3
3
  end
@@ -11,7 +11,7 @@ class ConnectionTest < Minitest::Test
11
11
  end
12
12
 
13
13
  def test_path_to_cert_is_correct
14
- assert File.exists?(ActiveUtils::Connection::CA_FILE)
14
+ assert File.file?(ActiveUtils::Connection::CA_FILE)
15
15
  end
16
16
 
17
17
  def test_connection_endpoint_parses_string_to_uri
@@ -130,8 +130,8 @@ class ConnectionTest < Minitest::Test
130
130
  assert_equal "/bogus", @connection.send(:http).ca_path
131
131
  end
132
132
 
133
- def test_default_proxy_address_is_nil
134
- assert_equal nil, @connection.proxy_address
133
+ def test_default_proxy_address_is_env
134
+ assert_equal :ENV, @connection.proxy_address
135
135
  end
136
136
 
137
137
  def test_default_proxy_port_is_nil
@@ -84,4 +84,10 @@ class CountryTest < Minitest::Test
84
84
  qatar = Country.find('Qatar')
85
85
  refute qatar.uses_postal_codes?
86
86
  end
87
+
88
+ def test_find_country_without_numeric_code
89
+ country = Country.find('ASC')
90
+ assert_equal 'Ascension Island', country.to_s
91
+ assert_nil country.code(:numeric)
92
+ end
87
93
  end
@@ -2,7 +2,6 @@ require 'test_helper'
2
2
  require 'active_support/core_ext/class'
3
3
 
4
4
  class PostsDataTest < Minitest::Test
5
-
6
5
  class SSLPoster
7
6
  include PostsData
8
7
 
@@ -44,6 +43,8 @@ class PostsDataTest < Minitest::Test
44
43
 
45
44
  SSLPoster.ssl_strict = false
46
45
  @poster.raw_ssl_request(:post, "https://shopify.com", "", {})
46
+ ensure
47
+ SSLPoster.ssl_strict = true
47
48
  end
48
49
 
49
50
  def test_logger_warns_can_handle_non_string_endpoints
@@ -65,10 +66,15 @@ class PostsDataTest < Minitest::Test
65
66
  end
66
67
 
67
68
  def test_set_proxy_address_and_port
69
+ original_proxy_address = SSLPoster.proxy_address
70
+ original_proxy_port = SSLPoster.proxy_port
68
71
  SSLPoster.proxy_address = 'http://proxy.example.com'
69
72
  SSLPoster.proxy_port = '8888'
70
73
  assert_equal @poster.proxy_address, 'http://proxy.example.com'
71
74
  assert_equal @poster.proxy_port, '8888'
75
+ ensure
76
+ SSLPoster.proxy_address = original_proxy_address
77
+ SSLPoster.proxy_port = original_proxy_port
72
78
  end
73
79
 
74
80
  class HttpConnectionAbort < StandardError; end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
10
+ date: 2025-01-22 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -80,19 +79,23 @@ dependencies:
80
79
  - - ">="
81
80
  - !ruby/object:Gem::Version
82
81
  version: '0'
83
- description:
84
82
  email:
85
83
  - developers@jadedpixel.com
86
84
  executables: []
87
85
  extensions: []
88
86
  extra_rdoc_files: []
89
87
  files:
88
+ - ".github/dependabot.yml"
89
+ - ".github/workflows/.github/workflows/dependabot_auto_merge.yml"
90
+ - ".github/workflows/ci.yml"
90
91
  - ".github/workflows/cla.yml"
91
92
  - ".gitignore"
93
+ - ".ruby-version"
92
94
  - ".travis.yml"
93
95
  - CHANGELOG.md
94
96
  - CONTRIBUTING.md
95
97
  - Gemfile
98
+ - Gemfile.lock
96
99
  - MIT-LICENSE
97
100
  - README.md
98
101
  - Rakefile
@@ -128,7 +131,6 @@ licenses:
128
131
  - MIT
129
132
  metadata:
130
133
  allowed_push_host: https://rubygems.org
131
- post_install_message:
132
134
  rdoc_options: []
133
135
  require_paths:
134
136
  - lib
@@ -136,15 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
138
  requirements:
137
139
  - - ">="
138
140
  - !ruby/object:Gem::Version
139
- version: '0'
141
+ version: '2.7'
140
142
  required_rubygems_version: !ruby/object:Gem::Requirement
141
143
  requirements:
142
144
  - - ">="
143
145
  - !ruby/object:Gem::Version
144
146
  version: '0'
145
147
  requirements: []
146
- rubygems_version: 3.4.10
147
- signing_key:
148
+ rubygems_version: 3.6.2
148
149
  specification_version: 4
149
150
  summary: Common utils used by active_merchant, active_fulfillment, and active_shipping
150
151
  test_files: []