resolv 0.5.0 → 0.6.0

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: f3c2610a9201afa7c69fdadb89357cfe4c44e0bec4f52c430ef6328897ebda0a
4
- data.tar.gz: 06f9f301afe24165dd53683dd11c503a69cb367cc76f5885709552bab7444d61
3
+ metadata.gz: 9229d4fa9f694c44c4442d65a94ee9cf0a0516cd642c34046ea1986eb3f14e47
4
+ data.tar.gz: 8d04dbe4055ac5ab5da6a71fad40235914b7931c4ef5245599f3b1cc4075c19a
5
5
  SHA512:
6
- metadata.gz: 15dafa5ebe1d4ba98fb40a1bec5d700beee853090230b08fcfc0a8c4ebd6cebf2657e4618c6de664a17a1b0ae0c8fa183c27dd0739957389140a5d001fc2d92a
7
- data.tar.gz: e930fb5af7be91b0342d855486979f070aaf04c02ca054dd8a6dfb70313dcc2fe8037f52e0d9e61b31df21a7452c841e5c3f48889c85532155285ad7100948eb
6
+ metadata.gz: 946a361ded12633ea767ffeb339c28b93bbb29efaaab1c1d6a26b30d151dea6bb10a8246f6b9fa21233f6fb6e0437e4e6a1fbab662bfe74443d24a1b3bffa0ca
7
+ data.tar.gz: 64da659522efac0f4cb19fa34c3824e86efa966c8424a90cba358b82a94738186ce51cc3c70d7d5d1a92e0212dc8b7eb6267df1603387457ab38355eec84ee8e
@@ -23,7 +23,7 @@ jobs:
23
23
 
24
24
  steps:
25
25
  - name: Harden Runner
26
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
26
+ uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
27
27
  with:
28
28
  egress-policy: audit
29
29
 
@@ -36,7 +36,7 @@ jobs:
36
36
  ruby-version: ruby
37
37
 
38
38
  - name: Publish to RubyGems
39
- uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1
39
+ uses: rubygems/release-gem@9e85cb11501bebc2ae661c1500176316d3987059 # v1.1.0
40
40
 
41
41
  - name: Create GitHub release
42
42
  run: |
@@ -6,7 +6,7 @@ jobs:
6
6
  ruby-versions:
7
7
  uses: ruby/actions/.github/workflows/ruby_versions.yml@master
8
8
  with:
9
- engine: cruby
9
+ engine: cruby-jruby
10
10
  min_version: 2.5
11
11
 
12
12
  build:
@@ -32,3 +32,21 @@ jobs:
32
32
  bundler-cache: true
33
33
  - name: Run test
34
34
  run: bundle exec rake test
35
+ timeout-minutes: 3
36
+ continue-on-error: ${{ startsWith(matrix.ruby, 'jruby') }}
37
+ - name: Build package
38
+ id: build
39
+ shell: bash
40
+ run: |
41
+ if ruby -e 'exit RUBY_VERSION>="3.0."'; then
42
+ bundle exec rake build
43
+ set pkg/*.gem
44
+ echo pkg=$1 >> $GITHUB_OUTPUT
45
+ fi
46
+ - name: Install gem
47
+ run: |
48
+ gem install ${{ steps.build.outputs.pkg }}
49
+ ruby -rresolv -e 'puts $LOADED_FEATURES.grep(/resolv/)'
50
+ ruby -rresolv -e 'puts Resolv::VERSION'
51
+ if: ${{ steps.build.outputs.pkg }}
52
+ continue-on-error: ${{ startsWith(matrix.ruby, 'jruby') }}
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
  gem "rake"
6
6
  gem "test-unit"
7
7
  gem "test-unit-ruby-core"
8
+ gem "ruby-core-tasks", github: "ruby/ruby-core-tasks"
data/Rakefile CHANGED
@@ -1,7 +1,15 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
 
4
+ if RUBY_ENGINE == "ruby"
5
+ require "ruby-core/extensiontask"
6
+ helper = Bundler::GemHelper.instance
7
+ extask = RubyCore::ExtensionTask.new(helper.gemspec)
8
+ task :test => :compile
9
+ end
10
+
4
11
  Rake::TestTask.new(:test) do |t|
12
+ t.libs.unshift(*extask.libs) if extask
5
13
  t.libs << "test/lib"
6
14
  t.ruby_opts << "-rhelper"
7
15
  t.test_files = FileList["test/**/test_*.rb"]
@@ -1,5 +1,5 @@
1
1
  require 'mkmf'
2
- if have_library('iphlpapi', 'GetNetworkParams')
2
+ if RUBY_ENGINE == "ruby" and have_library('iphlpapi', 'GetNetworkParams')
3
3
  create_makefile('win32/resolv')
4
4
  else
5
5
  File.write('Makefile', "all clean install:\n\t@echo Done: $(@)\n")
data/lib/resolv.rb CHANGED
@@ -3,11 +3,7 @@
3
3
  require 'socket'
4
4
  require 'timeout'
5
5
  require 'io/wait'
6
-
7
- begin
8
- require 'securerandom'
9
- rescue LoadError
10
- end
6
+ require 'securerandom'
11
7
 
12
8
  # Resolv is a thread-aware DNS resolver library written in Ruby. Resolv can
13
9
  # handle multiple DNS requests concurrently without blocking the entire Ruby
@@ -37,7 +33,7 @@ end
37
33
 
38
34
  class Resolv
39
35
 
40
- VERSION = "0.5.0"
36
+ VERSION = "0.6.0"
41
37
 
42
38
  ##
43
39
  # Looks up the first IP address for +name+.
@@ -83,9 +79,22 @@ class Resolv
83
79
 
84
80
  ##
85
81
  # Creates a new Resolv using +resolvers+.
82
+ #
83
+ # If +resolvers+ is not given, a hash, or +nil+, uses a Hosts resolver and
84
+ # and a DNS resolver. If +resolvers+ is a hash, uses the hash as
85
+ # configuration for the DNS resolver.
86
86
 
87
- def initialize(resolvers=nil, use_ipv6: nil)
88
- @resolvers = resolvers || [Hosts.new, DNS.new(DNS::Config.default_config_hash.merge(use_ipv6: use_ipv6))]
87
+ def initialize(resolvers=(arg_not_set = true; nil), use_ipv6: (keyword_not_set = true; nil))
88
+ if !keyword_not_set && !arg_not_set
89
+ warn "Support for separate use_ipv6 keyword is deprecated, as it is ignored if an argument is provided. Do not provide a positional argument if using the use_ipv6 keyword argument.", uplevel: 1
90
+ end
91
+
92
+ @resolvers = case resolvers
93
+ when Hash, nil
94
+ [Hosts.new, DNS.new(DNS::Config.default_config_hash.merge(resolvers || {}))]
95
+ else
96
+ resolvers
97
+ end
89
98
  end
90
99
 
91
100
  ##
@@ -615,16 +624,10 @@ class Resolv
615
624
  }
616
625
  end
617
626
 
618
- if defined? SecureRandom
619
- def self.random(arg) # :nodoc:
620
- begin
621
- SecureRandom.random_number(arg)
622
- rescue NotImplementedError
623
- rand(arg)
624
- end
625
- end
626
- else
627
- def self.random(arg) # :nodoc:
627
+ def self.random(arg) # :nodoc:
628
+ begin
629
+ SecureRandom.random_number(arg)
630
+ rescue NotImplementedError
628
631
  rand(arg)
629
632
  end
630
633
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resolv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanaka Akira
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Thread-aware DNS resolver library in Ruby.
14
14
  email:
@@ -31,7 +31,7 @@ files:
31
31
  - bin/console
32
32
  - bin/setup
33
33
  - ext/win32/resolv/extconf.rb
34
- - ext/win32/resolv/lib/win32/resolv.rb
34
+ - ext/win32/resolv/lib/resolv.rb
35
35
  - ext/win32/resolv/resolv.c
36
36
  - lib/resolv.rb
37
37
  - resolv.gemspec
@@ -42,7 +42,7 @@ licenses:
42
42
  metadata:
43
43
  homepage_uri: https://github.com/ruby/resolv
44
44
  source_code_uri: https://github.com/ruby/resolv
45
- post_install_message:
45
+ post_install_message:
46
46
  rdoc_options: []
47
47
  require_paths:
48
48
  - lib
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  version: '0'
59
59
  requirements: []
60
60
  rubygems_version: 3.5.11
61
- signing_key:
61
+ signing_key:
62
62
  specification_version: 4
63
63
  summary: Thread-aware DNS resolver library in Ruby.
64
64
  test_files: []