mini_portile2 2.8.6 → 2.8.7.rc1

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: 8e05baa930606f2d6523ea99ac9e8eedebd895c7ce4d54cfeb66ec18cd765929
4
- data.tar.gz: 4176f83bb1d2bba075e03e3e97d3205198cf595d6462da3c3004cae98421c341
3
+ metadata.gz: db1b5288cce56e46ea555c45f30afa8ddb05af1af39cd42930c9eae504b05aad
4
+ data.tar.gz: 3ffdba1730e7b7303326192ed4f90249a4b9badc6497df6bf15714b52b6ffbc4
5
5
  SHA512:
6
- metadata.gz: 9d665ab774d8f71ed02c2f0fc1fb79cea7dfaf4b989093afe58f666f9b71d731d95981e261e21d49c2d8ccbea759929ad3dce0420885daf1251a834e6c060f6f
7
- data.tar.gz: d225acb7e38adff4ad72f54a5dfa786791a45c61cff83c8cf8e85aef749446632da5d23dbf133ff6617304b47ded60b617fd2a0582b759216390add7d69b1565
6
+ metadata.gz: 6eea1f14d4a60104b044090197f4b0ce7d7ec54e322350387100f2bffe4e0674b2343b914e09729773da4067cb616584f54ee0eb95c56b57c1bd1d013106a47d
7
+ data.tar.gz: 44a55718e44399e5154049ee5416d0889fe3dd1fc0d17fa0486f5bbf3c05bc0dd150cb2e1db49f9d3c0f39d8505fe91e66cf4ebc724cb51e0fef2c6b5f9c46a8
@@ -25,7 +25,15 @@ jobs:
25
25
  fail-fast: false
26
26
  matrix:
27
27
  platform: [ubuntu-latest, windows-latest, macos-latest]
28
- ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "head"]
28
+ ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "head"]
29
+ exclude:
30
+ # I can't figure out how to install these on macos through setup-ruby
31
+ - ruby: "2.3"
32
+ platform: "macos-latest"
33
+ - ruby: "2.4"
34
+ platform: "macos-latest"
35
+ - ruby: "2.5"
36
+ platform: "macos-latest"
29
37
  runs-on: ${{ matrix.platform }}
30
38
  steps:
31
39
  - name: configure git crlf on windows
@@ -48,7 +56,8 @@ jobs:
48
56
  strategy:
49
57
  fail-fast: false
50
58
  matrix:
51
- platform: [ubuntu-latest, windows-latest, macos-latest]
59
+ # use macos-13 (not 14) because libyaml 0.2.5 doesn't have up-to-date config.guess and config.sub
60
+ platform: [ubuntu-latest, windows-latest, macos-13]
52
61
  ruby: ["3.1"]
53
62
  runs-on: ${{ matrix.platform }}
54
63
  steps:
@@ -115,3 +124,40 @@ jobs:
115
124
  gem install bundler
116
125
  bundle install
117
126
  bundle exec rake ${{ matrix.task }}
127
+
128
+ openbsd:
129
+ strategy:
130
+ fail-fast: false
131
+ matrix:
132
+ task: ["test:unit", "test:examples"]
133
+ runs-on: ubuntu-latest
134
+ env:
135
+ MAKE: gmake
136
+ steps:
137
+ - uses: actions/checkout@v4
138
+ - uses: vmactions/openbsd-vm@v1
139
+ with:
140
+ envs: MAKE
141
+ usesh: true
142
+ copyback: false
143
+ prepare: |
144
+ pkg_add ruby%3.1 gmake cmake git pkgconf security/gnupg
145
+ ln -sf /usr/local/bin/ruby31 /usr/local/bin/ruby
146
+ ln -sf /usr/local/bin/bundle31 /usr/local/bin/bundle
147
+ ln -sf /usr/local/bin/bundler31 /usr/local/bin/bundler
148
+ ln -sf /usr/local/bin/erb31 /usr/local/bin/erb
149
+ ln -sf /usr/local/bin/gem31 /usr/local/bin/gem
150
+ ln -sf /usr/local/bin/irb31 /usr/local/bin/irb
151
+ ln -sf /usr/local/bin/racc31 /usr/local/bin/racc
152
+ ln -sf /usr/local/bin/rake31 /usr/local/bin/rake
153
+ ln -sf /usr/local/bin/rbs31 /usr/local/bin/rbs
154
+ ln -sf /usr/local/bin/rdbg31 /usr/local/bin/rdbg
155
+ ln -sf /usr/local/bin/rdoc31 /usr/local/bin/rdoc
156
+ ln -sf /usr/local/bin/ri31 /usr/local/bin/ri
157
+ ln -sf /usr/local/bin/syntax_suggest31 /usr/local/bin/syntax_suggest
158
+ ln -sf /usr/local/bin/typeprof31 /usr/local/bin/typeprof
159
+ run: |
160
+ git config --global --add safe.directory /home/runner/work/mini_portile/mini_portile
161
+ gem install bundler
162
+ bundle install
163
+ bundle exec rake ${{ matrix.task }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## mini_portile changelog
2
2
 
3
+ ### 2.8.7.rc1 / unreleased
4
+
5
+ #### Added
6
+
7
+ - When setting the C compiler through the `MiniPortile` constructor, the preferred keyword argument is now `:cc_command`. The original `:gcc_command` is still supported. (#144 by @flavorjones)
8
+ - Add support for extracting xz-compressed tarballs on OpenBSD. (#141 by @postmodern)
9
+ - Add OpenBSD support to the experimental method `MakeMakefile#mkmf_config`. (#141 by @flavorjones)
10
+
11
+
12
+ #### Changed
13
+
14
+ - `MiniPortileCMake` now detects the C and C++ compiler the same way `MiniPortile` does: by examining environment variables, then using kwargs, then looking in RbConfig (in that order). (#144 by @flavorjones)
15
+ - GPG file verification error messages are captured in the raised exception. Previously these errors went to `stderr`. (#145 by @flavorjones)
16
+
17
+
3
18
  ### 2.8.6 / 2024-04-14
4
19
 
5
20
  #### Added
data/README.md CHANGED
@@ -85,21 +85,30 @@ system-wide installation.
85
85
 
86
86
  Some keyword arguments can be passed to the constructor to configure the commands used:
87
87
 
88
- #### `gcc_command`
88
+ #### `cc_command` and `cxx_command`
89
89
 
90
- The compiler command that is used is configurable, and in order of preference will use:
90
+ The C compiler command that is used is configurable, and in order of preference will use:
91
91
 
92
92
  - the `CC` environment variable (if present)
93
- - the `gcc_command` value passed in to the constructor
93
+ - the `:cc_command` keyword argument passed in to the constructor
94
94
  - `RbConfig::CONFIG["CC"]`
95
95
  - `"gcc"`
96
96
 
97
- You can pass it in like so:
97
+ The C++ compiler is similarly configuratble, and in order of preference will use:
98
+
99
+ - the `CXX` environment variable (if present)
100
+ - the `:cxx_command` keyword argument passed in to the constructor
101
+ - `RbConfig::CONFIG["CXX"]`
102
+ - `"g++"`
103
+
104
+ You can pass your compiler commands to the MiniPortile constructor:
98
105
 
99
106
  ``` ruby
100
- MiniPortile.new("libiconv", "1.13.1", gcc_command: "cc")
107
+ MiniPortile.new("libiconv", "1.13.1", cc_command: "clang", cxx_command: "clang++")
101
108
  ```
102
109
 
110
+ (For backwards compatibility, the constructor also supports a keyword argument `:gcc_command` for the C compiler.)
111
+
103
112
  #### `make_command`
104
113
 
105
114
  The configuration/make command that is used is configurable, and in order of preference will use:
data/Rakefile CHANGED
@@ -1,12 +1,10 @@
1
1
  require "rake/clean"
2
2
  require "bundler/gem_tasks"
3
+ require "rake/testtask"
3
4
 
4
- namespace :test do
5
- desc "Test MiniPortile by running unit tests"
6
- task :unit do
7
- sh "ruby -w -W2 -I. -Ilib -e \"#{Dir["test/test_*.rb"].map { |f| "require '#{f}';" }.join}\" -- #{ENV["TESTOPTS"]} -v"
8
- end
5
+ Rake::TestTask.new("test:unit")
9
6
 
7
+ namespace :test do
10
8
  desc "Test MiniPortile by compiling examples"
11
9
  task :examples do
12
10
  Dir.chdir("examples") do
@@ -8,6 +8,7 @@ require 'open-uri'
8
8
  require 'cgi'
9
9
  require 'rbconfig'
10
10
  require 'shellwords'
11
+ require 'open3'
11
12
 
12
13
  # Monkey patch for Net::HTTP by ruby open-uri fix:
13
14
  # https://github.com/ruby/ruby/commit/58835a9
@@ -103,10 +104,11 @@ class MiniPortile
103
104
  @files = []
104
105
  @patch_files = []
105
106
  @log_files = {}
106
- @logger = STDOUT
107
+ @logger = kwargs[:logger] || STDOUT
107
108
  @source_directory = nil
108
109
 
109
- @gcc_command = kwargs[:gcc_command]
110
+ @cc_command = kwargs[:cc_command] || kwargs[:gcc_command]
111
+ @cxx_command = kwargs[:cxx_command]
110
112
  @make_command = kwargs[:make_command]
111
113
  @open_timeout = kwargs[:open_timeout] || DEFAULT_TIMEOUT
112
114
  @read_timeout = kwargs[:read_timeout] || DEFAULT_TIMEOUT
@@ -318,10 +320,8 @@ class MiniPortile
318
320
  if static
319
321
  libdir = lib_path
320
322
  if pcfile
321
- variables = minimal_pkg_config(pcfile, "print-variables").split("\n").map(&:strip)
322
- if variables.include?("libdir")
323
- libdir = minimal_pkg_config(pcfile, "variable=libdir")
324
- end
323
+ pcfile_libdir = minimal_pkg_config(pcfile, "variable=libdir").strip
324
+ libdir = pcfile_libdir unless pcfile_libdir.empty?
325
325
  end
326
326
 
327
327
  #
@@ -372,8 +372,13 @@ class MiniPortile
372
372
  File.join(path, "lib")
373
373
  end
374
374
 
375
- def gcc_cmd
376
- (ENV["CC"] || @gcc_command || RbConfig::CONFIG["CC"] || "gcc").dup
375
+ def cc_cmd
376
+ (ENV["CC"] || @cc_command || RbConfig::CONFIG["CC"] || "gcc").dup
377
+ end
378
+ alias :gcc_cmd :cc_cmd
379
+
380
+ def cxx_cmd
381
+ (ENV["CXX"] || @cxx_command || RbConfig::CONFIG["CXX"] || "g++").dup
377
382
  end
378
383
 
379
384
  def make_cmd
@@ -457,24 +462,29 @@ class MiniPortile
457
462
  gpg_exe = which('gpg2') || which('gpg') || raise("Neither GPG nor GPG2 is installed")
458
463
 
459
464
  # import the key into our own keyring
460
- gpg_status = IO.popen([gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--import"], "w+") do |io|
461
- io.write gpg[:key]
462
- io.close_write
463
- io.read
465
+ gpg_error = nil
466
+ gpg_status = Open3.popen3(gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--import") do |gpg_in, gpg_out, gpg_err, _thread|
467
+ gpg_in.write gpg[:key]
468
+ gpg_in.close
469
+ gpg_error = gpg_err.read
470
+ gpg_out.read
464
471
  end
465
472
  key_ids = gpg_status.scan(/\[GNUPG:\] IMPORT_OK \d+ (?<key_id>[0-9a-f]+)/i).map(&:first)
466
- raise "invalid gpg key provided" if key_ids.empty?
473
+ raise "invalid gpg key provided:\n#{gpg_error}" if key_ids.empty?
467
474
 
468
- # verify the signature against our keyring
469
- gpg_status = IO.popen([gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--verify", signature_file, file[:local_path]], &:read)
470
-
471
- # remove the key from our keyring
472
- key_ids.each do |key_id|
473
- IO.popen([gpg_exe, "--batch", "--yes", "--no-default-keyring", "--keyring", KEYRING_NAME, "--delete-keys", key_id], &:read)
474
- raise "unable to delete the imported key" unless $?.exitstatus==0
475
+ begin
476
+ # verify the signature against our keyring
477
+ gpg_status, gpg_error, _status = Open3.capture3(gpg_exe, "--status-fd", "1", "--no-default-keyring", "--keyring", KEYRING_NAME, "--verify", signature_file, file[:local_path])
478
+
479
+ raise "signature mismatch:\n#{gpg_error}" unless gpg_status.match(/^\[GNUPG:\] VALIDSIG/)
480
+ ensure
481
+ # remove the key from our keyring
482
+ key_ids.each do |key_id|
483
+ IO.popen([gpg_exe, "--batch", "--yes", "--no-default-keyring", "--keyring", KEYRING_NAME, "--delete-keys", key_id], &:read)
484
+ raise "unable to delete the imported key" unless $?.exitstatus==0
485
+ end
475
486
  end
476
487
 
477
- raise "signature mismatch" unless gpg_status.match(/^\[GNUPG:\] VALIDSIG/)
478
488
 
479
489
  else
480
490
  digest = case
@@ -498,30 +508,6 @@ class MiniPortile
498
508
  }
499
509
  end
500
510
 
501
- TAR_EXECUTABLES = %w[gtar bsdtar tar basic-bsdtar]
502
- def tar_exe
503
- @@tar_exe ||= begin
504
- TAR_EXECUTABLES.find { |c|
505
- which(c)
506
- } or raise("tar not found - please make sure that one of the following commands is in the PATH: #{TAR_EXECUTABLES.join(", ")}")
507
- end
508
- end
509
-
510
- def tar_compression_switch(filename)
511
- case File.extname(filename)
512
- when '.gz', '.tgz'
513
- 'z'
514
- when '.bz2', '.tbz2'
515
- 'j'
516
- when '.xz'
517
- 'J'
518
- when '.Z'
519
- 'Z'
520
- else
521
- ''
522
- end
523
- end
524
-
525
511
  # From: http://stackoverflow.com/a/5471032/7672
526
512
  # Thanks, Mislav!
527
513
  #
@@ -548,6 +534,8 @@ class MiniPortile
548
534
  output = `#{gcc_cmd} -v 2>&1`
549
535
  if m = output.match(/^Target\: (.*)$/)
550
536
  @detect_host = m[1]
537
+ else
538
+ @detect_host = nil
551
539
  end
552
540
 
553
541
  @detect_host
@@ -556,12 +544,35 @@ class MiniPortile
556
544
  end
557
545
  end
558
546
 
547
+ TAR_EXECUTABLES = %w[gtar bsdtar tar basic-bsdtar]
548
+ def tar_exe
549
+ @@tar_exe ||= begin
550
+ TAR_EXECUTABLES.find { |c|
551
+ which(c)
552
+ } or raise("tar not found - please make sure that one of the following commands is in the PATH: #{TAR_EXECUTABLES.join(", ")}")
553
+ end
554
+ end
555
+
556
+ def tar_command(file, target)
557
+ case File.extname(file)
558
+ when '.gz', '.tgz'
559
+ [tar_exe, 'xzf', file, '-C', target]
560
+ when '.bz2', '.tbz2'
561
+ [tar_exe, 'xjf', file, '-C', target]
562
+ when '.xz'
563
+ # NOTE: OpenBSD's tar command does not support the -J option
564
+ "xzcat #{file.shellescape} | #{tar_exe.shellescape} xf - -C #{target.shellescape}"
565
+ else
566
+ [tar_exe, 'xf', file, '-C', target]
567
+ end
568
+ end
569
+
559
570
  def extract_file(file, target)
560
571
  filename = File.basename(file)
561
572
  FileUtils.mkdir_p target
562
573
 
563
574
  message "Extracting #{filename} into #{target}... "
564
- execute('extract', [tar_exe, "#{tar_compression_switch(filename)}xf", file, "-C", target], {:cd => Dir.pwd, :initial_message => false})
575
+ execute('extract', tar_command(file, target) , {:cd => Dir.pwd, :initial_message => false})
565
576
  end
566
577
 
567
578
  # command could be an array of args, or one string containing a command passed to the shell. See
@@ -697,7 +708,7 @@ class MiniPortile
697
708
  return download_file(redirect.url, full_path, count-1)
698
709
  rescue => e
699
710
  count = count - 1
700
- puts "#{count} retrie(s) left for #{filename} (#{e.message})"
711
+ @logger.puts "#{count} retrie(s) left for #{filename} (#{e.message})"
701
712
  if count > 0
702
713
  sleep 1
703
714
  return download_file_http(url, full_path, count)
@@ -67,49 +67,21 @@ class MiniPortileCMake < MiniPortile
67
67
  end
68
68
 
69
69
  def cmake_compile_flags
70
- c_compiler, cxx_compiler = find_c_and_cxx_compilers(host)
70
+ # RbConfig::CONFIG['CC'] and RbConfig::CONFIG['CXX'] can contain additional flags, for example
71
+ # "clang++ -std=gnu++11" or "clang -fdeclspec". CMake is just looking for the command name.
72
+ cc_compiler = cc_cmd.split.first
73
+ cxx_compiler = cxx_cmd.split.first
71
74
 
72
75
  # needed to ensure cross-compilation with CMake targets the right CPU and compilers
73
76
  [
74
77
  "-DCMAKE_SYSTEM_NAME=#{cmake_system_name}",
75
78
  "-DCMAKE_SYSTEM_PROCESSOR=#{cpu_type}",
76
- "-DCMAKE_C_COMPILER=#{c_compiler}",
79
+ "-DCMAKE_C_COMPILER=#{cc_compiler}",
77
80
  "-DCMAKE_CXX_COMPILER=#{cxx_compiler}",
78
81
  "-DCMAKE_BUILD_TYPE=#{cmake_build_type}",
79
82
  ]
80
83
  end
81
84
 
82
- def find_compiler(compilers)
83
- compilers.find { |binary| which(binary) }
84
- end
85
-
86
- # configure automatically searches for the right compiler based on the
87
- # `--host` parameter. However, CMake doesn't have an equivalent feature.
88
- # Search for the right compiler for the target architecture using
89
- # some basic heruistics.
90
- def find_c_and_cxx_compilers(host)
91
- c_compiler = ENV["CC"]
92
- cxx_compiler = ENV["CXX"]
93
-
94
- if MiniPortile.darwin?
95
- c_compiler ||= 'clang'
96
- cxx_compiler ||='clang++'
97
- elsif MiniPortile.freebsd?
98
- c_compiler ||= 'cc'
99
- cxx_compiler ||= 'c++'
100
- else
101
- c_compiler ||= 'gcc'
102
- cxx_compiler ||= 'g++'
103
- end
104
-
105
- c_platform_compiler = "#{host}-#{c_compiler}"
106
- cxx_platform_compiler = "#{host}-#{cxx_compiler}"
107
- c_compiler = find_compiler([c_platform_compiler, c_compiler])
108
- cxx_compiler = find_compiler([cxx_platform_compiler, cxx_compiler])
109
-
110
- [c_compiler, cxx_compiler]
111
- end
112
-
113
85
  # Full list: https://gitlab.kitware.com/cmake/cmake/-/blob/v3.26.4/Modules/CMakeDetermineSystem.cmake?ref_type=tags#L12-31
114
86
  def cmake_system_name
115
87
  return system_name if system_name
@@ -1,3 +1,3 @@
1
1
  class MiniPortile
2
- VERSION = "2.8.6"
2
+ VERSION = "2.8.7.rc1"
3
3
  end
data/test/helper.rb CHANGED
@@ -9,6 +9,12 @@ require 'archive/tar/minitar'
9
9
  require 'fileutils'
10
10
  require 'erb'
11
11
  require 'mini_portile2'
12
+ require 'logger'
13
+
14
+ puts "#{__FILE__}:#{__LINE__}: relevant RbConfig::CONFIG values:"
15
+ %w[target_os target_cpu CC CXX].each do |key|
16
+ puts "- #{key}: #{RbConfig::CONFIG[key].inspect}"
17
+ end
12
18
 
13
19
  class TestCase < Minitest::Test
14
20
  include Minitest::Hooks
@@ -18,7 +24,12 @@ class TestCase < Minitest::Test
18
24
  attr_accessor :webrick
19
25
 
20
26
  def start_webrick(path)
21
- @webrick = WEBrick::HTTPServer.new(:Port => HTTP_PORT, :DocumentRoot => path).tap do |w|
27
+ @webrick = WEBrick::HTTPServer.new(
28
+ :Port => HTTP_PORT,
29
+ :DocumentRoot => path,
30
+ :Logger => Logger.new(File::NULL),
31
+ :AccessLog => [],
32
+ ).tap do |w|
22
33
  Thread.new do
23
34
  w.start
24
35
  end
data/test/test_cmake.rb CHANGED
@@ -14,12 +14,16 @@ class TestCMake < TestCase
14
14
  create_tar(@tar_path, @assets_path, "test-cmake-1.0")
15
15
  start_webrick(File.dirname(@tar_path))
16
16
 
17
+ @logger = StringIO.new # IO to keep recipe logs in case we need to debug
17
18
  @recipe = init_recipe
18
19
 
19
20
  git_dir = File.join(@assets_path, "git")
20
21
  with_custom_git_dir(git_dir) do
21
22
  recipe.cook
22
23
  end
24
+ rescue => e
25
+ puts @logger.string
26
+ raise e
23
27
  end
24
28
 
25
29
  def after_all
@@ -58,6 +62,7 @@ class TestCMake < TestCase
58
62
 
59
63
  def init_recipe
60
64
  MiniPortileCMake.new("test-cmake", "1.0").tap do |recipe|
65
+ recipe.logger = @logger
61
66
  recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}"
62
67
  recipe.patch_files << File.join(@assets_path, "patch 1.diff")
63
68
  end
@@ -83,23 +88,20 @@ class TestCMakeConfig < TestCMake
83
88
  end
84
89
 
85
90
  def test_configure_defaults_with_macos
86
- recipe = init_recipe
87
- recipe.host = 'some-host'
88
-
89
91
  with_env({ "CC" => nil, "CXX" => nil }) do
90
92
  MiniPortile.stub(:darwin?, true) do
91
93
  with_stubbed_target(os: 'darwin22', cpu: 'arm64') do
92
- with_compilers(recipe, host_prefix: true, c_compiler: 'clang', cxx_compiler: 'clang++') do
94
+ with_compilers(c_compiler: 'clang', cxx_compiler: 'clang++') do
93
95
  Open3.stub(:capture2, cmake_help_mock('Unix')) do
94
96
  assert_equal(
95
97
  [
96
98
  "-DCMAKE_SYSTEM_NAME=Darwin",
97
99
  "-DCMAKE_SYSTEM_PROCESSOR=arm64",
98
- "-DCMAKE_C_COMPILER=some-host-clang",
99
- "-DCMAKE_CXX_COMPILER=some-host-clang++",
100
+ "-DCMAKE_C_COMPILER=clang",
101
+ "-DCMAKE_CXX_COMPILER=clang++",
100
102
  "-DCMAKE_BUILD_TYPE=Release"
101
103
  ],
102
- recipe.configure_defaults)
104
+ @recipe.configure_defaults)
103
105
  end
104
106
  end
105
107
  end
@@ -108,12 +110,9 @@ class TestCMakeConfig < TestCMake
108
110
  end
109
111
 
110
112
  def test_configure_defaults_with_freebsd
111
- recipe = init_recipe
112
- recipe.host = 'some-host'
113
-
114
113
  with_env({ "CC" => nil, "CXX" => nil }) do
115
114
  with_stubbed_target(os: 'freebsd14') do
116
- with_compilers(recipe, c_compiler: 'cc', cxx_compiler: 'c++') do
115
+ with_compilers(c_compiler: 'cc', cxx_compiler: 'c++') do
117
116
  Open3.stub(:capture2, cmake_help_mock('Unix')) do
118
117
  assert_equal(
119
118
  [
@@ -123,7 +122,7 @@ class TestCMakeConfig < TestCMake
123
122
  "-DCMAKE_CXX_COMPILER=c++",
124
123
  "-DCMAKE_BUILD_TYPE=Release"
125
124
  ],
126
- recipe.configure_defaults)
125
+ @recipe.configure_defaults)
127
126
  end
128
127
  end
129
128
  end
@@ -131,22 +130,21 @@ class TestCMakeConfig < TestCMake
131
130
  end
132
131
 
133
132
  def test_configure_defaults_with_manual_system_name
134
- recipe = init_recipe
135
- recipe.system_name = 'Custom'
136
-
137
133
  MiniPortile.stub(:darwin?, false) do
138
134
  with_stubbed_target do
139
- with_compilers(recipe) do
135
+ with_compilers do
140
136
  Open3.stub(:capture2, cmake_help_mock('Unix')) do
141
- assert_equal(
142
- [
143
- "-DCMAKE_SYSTEM_NAME=Custom",
144
- "-DCMAKE_SYSTEM_PROCESSOR=x86_64",
145
- "-DCMAKE_C_COMPILER=gcc",
146
- "-DCMAKE_CXX_COMPILER=g++",
147
- "-DCMAKE_BUILD_TYPE=Release"
148
- ],
149
- recipe.configure_defaults)
137
+ @recipe.stub(:system_name, 'Custom') do
138
+ assert_equal(
139
+ [
140
+ "-DCMAKE_SYSTEM_NAME=Custom",
141
+ "-DCMAKE_SYSTEM_PROCESSOR=x86_64",
142
+ "-DCMAKE_C_COMPILER=gcc",
143
+ "-DCMAKE_CXX_COMPILER=g++",
144
+ "-DCMAKE_BUILD_TYPE=Release"
145
+ ],
146
+ @recipe.configure_defaults)
147
+ end
150
148
  end
151
149
  end
152
150
  end
@@ -154,16 +152,14 @@ class TestCMakeConfig < TestCMake
154
152
  end
155
153
 
156
154
  def test_configure_defaults_with_unix_makefiles
157
- recipe = init_recipe
158
-
159
155
  MiniPortile.stub(:linux?, true) do
160
156
  MiniPortile.stub(:darwin?, false) do
161
157
  with_stubbed_target do
162
- with_compilers(recipe) do
158
+ with_compilers do
163
159
  Open3.stub(:capture2, cmake_help_mock('Unix')) do
164
160
  MiniPortile.stub(:mingw?, true) do
165
161
  assert_equal(default_x86_compile_flags,
166
- recipe.configure_defaults)
162
+ @recipe.configure_defaults)
167
163
  end
168
164
  end
169
165
  end
@@ -173,15 +169,13 @@ class TestCMakeConfig < TestCMake
173
169
  end
174
170
 
175
171
  def test_configure_defaults_with_msys_makefiles
176
- recipe = init_recipe
177
-
178
172
  MiniPortile.stub(:linux?, true) do
179
173
  MiniPortile.stub(:darwin?, false) do
180
174
  with_stubbed_target do
181
- with_compilers(recipe) do
175
+ with_compilers do
182
176
  Open3.stub(:capture2, cmake_help_mock('MSYS')) do
183
177
  MiniPortile.stub(:mingw?, true) do
184
- assert_equal(['-G', 'MSYS Makefiles'] + default_x86_compile_flags, recipe.configure_defaults)
178
+ assert_equal(['-G', 'MSYS Makefiles'] + default_x86_compile_flags, @recipe.configure_defaults)
185
179
  end
186
180
  end
187
181
  end
@@ -191,15 +185,13 @@ class TestCMakeConfig < TestCMake
191
185
  end
192
186
 
193
187
  def test_configure_defaults_with_nmake_makefiles
194
- recipe = init_recipe
195
-
196
188
  MiniPortile.stub(:linux?, true) do
197
189
  MiniPortile.stub(:darwin?, false) do
198
190
  with_stubbed_target do
199
- with_compilers(recipe) do
191
+ with_compilers do
200
192
  Open3.stub(:capture2, cmake_help_mock('NMake')) do
201
193
  MiniPortile.stub(:mswin?, true) do
202
- assert_equal(['-G', 'NMake Makefiles'] + default_x86_compile_flags, recipe.configure_defaults)
194
+ assert_equal(['-G', 'NMake Makefiles'] + default_x86_compile_flags, @recipe.configure_defaults)
203
195
  end
204
196
  end
205
197
  end
@@ -240,21 +232,11 @@ class TestCMakeConfig < TestCMake
240
232
  end
241
233
  end
242
234
 
243
- def with_compilers(recipe, host_prefix: false, c_compiler: 'gcc', cxx_compiler: 'g++')
244
- mock = MiniTest::Mock.new
245
-
246
- if host_prefix
247
- mock.expect(:call, true, ["#{recipe.host}-#{c_compiler}"])
248
- mock.expect(:call, true, ["#{recipe.host}-#{cxx_compiler}"])
249
- else
250
- mock.expect(:call, false, ["#{recipe.host}-#{c_compiler}"])
251
- mock.expect(:call, true, [c_compiler])
252
- mock.expect(:call, false, ["#{recipe.host}-#{cxx_compiler}"])
253
- mock.expect(:call, true, [cxx_compiler])
254
- end
255
-
256
- recipe.stub(:which, mock) do
257
- yield
235
+ def with_compilers(c_compiler: 'gcc', cxx_compiler: 'g++')
236
+ @recipe.stub(:cc_cmd, c_compiler) do
237
+ @recipe.stub(:cxx_cmd, cxx_compiler) do
238
+ yield
239
+ end
258
240
  end
259
241
  end
260
242
 
data/test/test_cook.rb CHANGED
@@ -13,7 +13,9 @@ class TestCook < TestCase
13
13
  create_tar(@tar_path, @assets_path, "test mini portile-1.0.0")
14
14
  start_webrick(File.dirname(@tar_path))
15
15
 
16
+ @logger = StringIO.new # IO to keep recipe logs in case we need to debug
16
17
  @recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
18
+ recipe.logger = @logger
17
19
  recipe.files << "http://localhost:#{HTTP_PORT}/#{ERB::Util.url_encode(File.basename(@tar_path))}"
18
20
  recipe.patch_files << File.join(@assets_path, "patch 1.diff")
19
21
  recipe.configure_options << "--option=\"path with 'space'\""
@@ -22,6 +24,9 @@ class TestCook < TestCase
22
24
  recipe.cook
23
25
  end
24
26
  end
27
+ rescue => e
28
+ puts @logger.string
29
+ raise e
25
30
  end
26
31
 
27
32
  def after_all
@@ -79,17 +84,37 @@ class TestCookConfiguration < TestCase
79
84
  end
80
85
  end
81
86
 
82
- def test_gcc_command_configuration
87
+ def test_cc_command_configuration
83
88
  without_env("CC") do
84
89
  expected_compiler = RbConfig::CONFIG["CC"] || "gcc"
90
+ assert_equal(expected_compiler, MiniPortile.new("test", "1.0.0").cc_cmd)
85
91
  assert_equal(expected_compiler, MiniPortile.new("test", "1.0.0").gcc_cmd)
92
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", cc_command: "xyzzy").cc_cmd)
93
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").cc_cmd)
94
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", cc_command: "xyzzy").gcc_cmd)
86
95
  assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").gcc_cmd)
87
96
  end
88
97
  with_env("CC"=>"asdf") do
98
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0").cc_cmd)
89
99
  assert_equal("asdf", MiniPortile.new("test", "1.0.0").gcc_cmd)
100
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", cc_command: "xyzzy").cc_cmd)
101
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").cc_cmd)
102
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", cc_command: "xyzzy").gcc_cmd)
90
103
  assert_equal("asdf", MiniPortile.new("test", "1.0.0", gcc_command: "xyzzy").gcc_cmd)
91
104
  end
92
105
  end
106
+
107
+ def test_cxx_command_configuration
108
+ without_env("CXX") do
109
+ expected_compiler = RbConfig::CONFIG["CXX"] || "g++"
110
+ assert_equal(expected_compiler, MiniPortile.new("test", "1.0.0").cxx_cmd)
111
+ assert_equal("xyzzy", MiniPortile.new("test", "1.0.0", cxx_command: "xyzzy").cxx_cmd)
112
+ end
113
+ with_env("CXX"=>"asdf") do
114
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0").cxx_cmd)
115
+ assert_equal("asdf", MiniPortile.new("test", "1.0.0", cxx_command: "xyzzy").cxx_cmd)
116
+ end
117
+ end
93
118
  end
94
119
 
95
120
 
@@ -116,7 +141,9 @@ class TestCookWithBrokenGitDir < TestCase
116
141
 
117
142
  create_tar(@tar_path, @assets_path, "test mini portile-1.0.0")
118
143
 
144
+ @logger = StringIO.new # IO to keep recipe logs in case we need to debug
119
145
  @recipe = MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
146
+ recipe.logger = @logger
120
147
  recipe.files << "file://#{@tar_path}"
121
148
  recipe.patch_files << File.join(@assets_path, "patch 1.diff")
122
149
  recipe.configure_options << "--option=\"path with 'space'\""
@@ -146,7 +173,9 @@ class TestCookAgainstSourceDirectory < TestCase
146
173
  def setup
147
174
  super
148
175
 
176
+ @logger = StringIO.new # IO to keep recipe logs in case we need to debug
149
177
  @recipe ||= MiniPortile.new("test mini portile", "1.0.0").tap do |recipe|
178
+ recipe.logger = @logger
150
179
  recipe.source_directory = File.expand_path("../assets/test mini portile-1.0.0", __FILE__)
151
180
  end
152
181
  end
data/test/test_digest.rb CHANGED
@@ -24,7 +24,8 @@ class TestDigest < TestCase
24
24
  def setup
25
25
  super
26
26
  FileUtils.rm_rf("ports/archives")
27
- @recipe = MiniPortile.new("test-digest", "1.0.0")
27
+ @logger = StringIO.new # IO to keep recipe logs in case we need to debug
28
+ @recipe = MiniPortile.new("test-digest", "1.0.0", logger: @logger)
28
29
  end
29
30
 
30
31
  def download_with_digest(key, klass)
@@ -68,28 +69,28 @@ class TestDigest < TestCase
68
69
  end
69
70
 
70
71
  def public_key
71
- <<-KEY
72
- -----BEGIN PGP PUBLIC KEY BLOCK-----
73
- Version: GnuPG v1
74
-
75
- mI0EVwUhJQEEAMYxFhgaAdM2Ul5r+XfpqAaI7SOxB14eRjhFjhchy4ylgVxetyLq
76
- di3zeANXBIHsLBl7quYTlnmhJr/+GQRkCnXWiUp0tJsBVzGM3puK7c534gakEUH6
77
- AlDtj5p3IeygzSyn8u7KORv+ainXfhwkvTO04mJmxAb2uT8ngKYFdPa1ABEBAAG0
78
- J1Rlc3QgTWluaXBvcnRpbGUgPHRlc3RAbWluaXBvcnRpbGUub3JnPoi4BBMBAgAi
79
- BQJXBSElAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRBl6D5JZMNwswAK
80
- A/90Cdb+PX21weBR2Q6uR06M/alPexuXXyJL8ZcwbQMJ/pBBgcS5/h1+rQkBI/CN
81
- qpXdDlw2Xys2k0sNwdjIw3hmYRzBrddXlCSW3Sifq/hS+kfPZ1snQmIjCgy1Xky5
82
- QGCcPUxBUxzmra88LakkDO+euKK3hcrfeFIi611lTum1NLiNBFcFISUBBADoyY6z
83
- 2PwH3RWUbqv0VX1s3/JO3v3xMjCRK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/JO3v3xMjCRKPlFwsNwLTBtZoWfR6Ao1ajeCuZKfzNKIQ2I
85
+ rn86Rcqyrq4hTj+7BTWjkIPOBthjiL1YqbEBtX7jcYRkYvdQz/IG2F4zVV6X4AAR
86
+ Twx7qaXNt67ArzbHCe5gLNRUK6e6OArkahMv7QARAQABiJ8EGAECAAkFAlcFISUC
87
+ GwwACgkQZeg+SWTDcLNFiwP/TR33ClqWOz0mpjt0xPEoZ0ORmV6fo4sjjzgQoHH/
88
+ KTdsabJbGp8oLQGW/mx3OxgbsAkyZymb5H5cjaF4HtSd4cxI5t1C9ZS/ytN8pqfR
89
+ e29SBje8DAAJn2l57s2OddXLPQ0DUwCcdNEaqgHwSk/Swxc7K+IpfvjLKHKUZZBP
90
+ 4Ko=
91
+ =SVWi
92
+ -----END PGP PUBLIC KEY BLOCK-----
93
+ KEY
93
94
  end
94
95
 
95
96
  def test_with_valid_gpg_signature
@@ -130,7 +131,7 @@ KEY
130
131
  exception = assert_raises(RuntimeError){
131
132
  @recipe.download
132
133
  }
133
- assert_equal("signature mismatch", exception.message)
134
+ assert_includes(exception.message, "signature mismatch")
134
135
  end
135
136
 
136
137
  def test_with_invalid_key
@@ -144,60 +145,58 @@ KEY
144
145
  }
145
146
  }
146
147
  exception = assert_raises(RuntimeError){ @recipe.download }
147
- assert_equal("invalid gpg key provided", exception.message)
148
+ assert_includes(exception.message, "invalid gpg key provided")
148
149
  end
149
150
 
150
151
  def test_with_different_key_than_one_used_to_sign
151
- puts "################"
152
-
153
- key = <<-KEY
154
- -----BEGIN PGP PUBLIC KEY BLOCK-----
155
- Version: GnuPG v1
156
-
157
- mQENBE7SKu8BCADQo6x4ZQfAcPlJMLmL8zBEBUS6GyKMMMDtrTh3Yaq481HB54oR
158
- 0cpKL05Ff9upjrIzLD5TJUCzYYM9GQOhguDUP8+ZU9JpSz3yO2TvH7WBbUZ8FADf
159
- hblmmUBLNgOWgLo3W+FYhl3mz1GFS2Fvid6Tfn02L8CBAj7jxbjL1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qD7oiRVzmstX1YoxEzC0yXfaefC7SgM0nMnaTvYEOYJ9CH3wARAQABiQEf
192
- BBgBAgAJBQJO0irvAhsMAAoJEFIKmZOhwFL4844H/jo8icCcS6eOWvnen7lg0FcC
193
- o1fIm4wW3tEmkQdchSHECJDq7pgTloN65pwB5tBoT47cyYNZA9eTfJVgRc74q5ce
194
- xKOYrMC3KuAqWbwqXhkVs0nkWxnOIidTHSXvBZfDFA4Idwte94Thrzf8Pn8UESud
195
- TiqrWoCBXk2UyVsl03gJblSJAeJGYPPeo+Yj6m63OWe2+/S2VTgmbPS/RObn0Aeg
196
- 7yuff0n5+ytEt2KL51gOQE2uIxTCawHr12PsllPkbqPk/PagIttfEJqn9b0CrqPC
197
- 3HREePb2aMJ/Ctw/76COwn0mtXeIXLCTvBmznXfaMKllsqbsy2nCJ2P2uJjOntw=
198
- =4JAR
199
- -----END PGP PUBLIC KEY BLOCK-----
200
- KEY
152
+ key = <<~KEY
153
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
154
+ Version: GnuPG v1
155
+
156
+ mQENBE7SKu8BCADQo6x4ZQfAcPlJMLmL8zBEBUS6GyKMMMDtrTh3Yaq481HB54oR
157
+ 0cpKL05Ff9upjrIzLD5TJUCzYYM9GQOhguDUP8+ZU9JpSz3yO2TvH7WBbUZ8FADf
158
+ hblmmUBLNgOWgLo3W+FYhl3mz1GFS2Fvid6Tfn02L8CBAj7jxbjL1Qj/OA/WmLLc
159
+ m6BMTqI7IBlYW2vyIOIHasISGiAwZfp0ucMeXXvTtt14LGa8qXVcFnJTdwbf03AS
160
+ ljhYrQnKnpl3VpDAoQt8C68YCwjaNJW59hKqWB+XeIJ9CW98+EOAxLAFszSyGanp
161
+ rCqPd0numj9TIddjcRkTA/ZbmCWK+xjpVBGXABEBAAG0IU1heGltIERvdW5pbiA8
162
+ bWRvdW5pbkBtZG91bmluLnJ1PohGBBARAgAGBQJO01Y/AAoJEOzw6QssFyCDVyQA
163
+ n3qwTZlcZgyyzWu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oCBXk2UyVsl03gJblSJAeJGYPPeo+Yj6m63OWe2+/S2VTgmbPS/RObn0Aeg
195
+ 7yuff0n5+ytEt2KL51gOQE2uIxTCawHr12PsllPkbqPk/PagIttfEJqn9b0CrqPC
196
+ 3HREePb2aMJ/Ctw/76COwn0mtXeIXLCTvBmznXfaMKllsqbsy2nCJ2P2uJjOntw=
197
+ =4JAR
198
+ -----END PGP PUBLIC KEY BLOCK-----
199
+ KEY
201
200
 
202
201
  data_file = File.expand_path(File.join(File.dirname(__FILE__), 'assets', 'gpg-fixtures', 'data'))
203
202
 
@@ -209,7 +208,6 @@ KEY
209
208
  }
210
209
  }
211
210
  exception = assert_raises(RuntimeError){ @recipe.download }
212
- assert_equal("signature mismatch", exception.message)
211
+ assert_includes(exception.message, "signature mismatch")
213
212
  end
214
213
  end
215
-
@@ -25,12 +25,13 @@ describe "recipe download" do
25
25
  server.close
26
26
  end
27
27
 
28
- request_count.must_be :>, 0
28
+ assert_operator(request_count, :>, 0)
29
29
  end
30
30
 
31
31
  before do
32
32
  @request_count = 0
33
- @recipe = MiniPortile.new("test-download", "1.1.1")
33
+ @logger = StringIO.new
34
+ @recipe = MiniPortile.new("test-download", "1.1.1", logger: @logger)
34
35
  end
35
36
 
36
37
  describe "urls" do
@@ -62,12 +63,12 @@ describe "recipe download" do
62
63
  @recipe.files << "file://#{path}"
63
64
  @recipe.download
64
65
  assert File.exist?(dest)
65
- Digest::MD5.file(dest).hexdigest.must_equal "ee0e9f44e72213015ef976d5ac23931d"
66
+ assert_equal("ee0e9f44e72213015ef976d5ac23931d", Digest::MD5.file(dest).hexdigest)
66
67
  end
67
68
 
68
69
  it "other" do
69
70
  @recipe.files << "foo://foo"
70
- proc { @recipe.download }.must_raise ArgumentError
71
+ assert_raises(ArgumentError) { @recipe.download }
71
72
  end
72
73
  end
73
74
  end
data/test/test_execute.rb CHANGED
@@ -4,7 +4,8 @@ class TestExecute < TestCase
4
4
  def setup
5
5
  super
6
6
  @env = {"TEST_ENV_VAR1" => "VAR1_VALUE", "TEST_ENV_VAR2" => "VAR2_VALUE"}
7
- @recipe = MiniPortile.new("test_execute", "1.0.0")
7
+ @logger = StringIO.new
8
+ @recipe = MiniPortile.new("test_execute", "1.0.0", logger: @logger)
8
9
  @log_path = @recipe.send(:tmp_path)
9
10
  FileUtils.mkdir_p File.join(@log_path, "subdir") # normally created by `download`
10
11
  end
@@ -14,7 +15,7 @@ class TestExecute < TestCase
14
15
  def execute_with_env(env)
15
16
  execute("testenv1",
16
17
  %Q(ruby -e "puts ENV['TEST_ENV_VAR1'].inspect ; exit 0"),
17
- {:env => env, :initial_message => false, :debug => true})
18
+ {:env => env, :initial_message => false})
18
19
  end
19
20
  end
20
21
 
@@ -28,7 +29,7 @@ class TestExecute < TestCase
28
29
  def execute_with_env(env)
29
30
  execute("testenv2",
30
31
  ["ruby", "-e", "puts ENV['TEST_ENV_VAR2'].inspect"],
31
- {:env => env, :initial_message => false, :debug => true})
32
+ {:env => env, :initial_message => false})
32
33
  end
33
34
  end
34
35
 
data/test/test_proxy.rb CHANGED
@@ -37,6 +37,7 @@ class TestProxy < TestCase
37
37
  def setup
38
38
  # remove any download files
39
39
  FileUtils.rm_rf("port/archives")
40
+ @logger = StringIO.new
40
41
  end
41
42
 
42
43
  def assert_proxy_auth(expected, request)
@@ -48,7 +49,7 @@ class TestProxy < TestCase
48
49
  end
49
50
 
50
51
  def test_http_proxy
51
- recipe = MiniPortile.new("test http_proxy", "1.0.0")
52
+ recipe = MiniPortile.new("test http_proxy", "1.0.0", logger: @logger)
52
53
  recipe.files << "http://myserver/path/to/tar.gz"
53
54
  request = with_dummy_proxy do |url, thread|
54
55
  ENV['http_proxy'] = url
@@ -59,7 +60,7 @@ class TestProxy < TestCase
59
60
  end
60
61
 
61
62
  def test_http_proxy_with_basic_auth
62
- recipe = MiniPortile.new("test http_proxy", "1.0.0")
63
+ recipe = MiniPortile.new("test http_proxy", "1.0.0", logger: @logger)
63
64
  recipe.files << "http://myserver/path/to/tar.gz"
64
65
  request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread|
65
66
  ENV['http_proxy'] = url
@@ -72,7 +73,7 @@ class TestProxy < TestCase
72
73
  end
73
74
 
74
75
  def test_https_proxy
75
- recipe = MiniPortile.new("test https_proxy", "1.0.0")
76
+ recipe = MiniPortile.new("test https_proxy", "1.0.0", logger: @logger)
76
77
  recipe.files << "https://myserver/path/to/tar.gz"
77
78
  request = with_dummy_proxy do |url, thread|
78
79
  ENV['https_proxy'] = url
@@ -83,7 +84,7 @@ class TestProxy < TestCase
83
84
  end
84
85
 
85
86
  def test_https_proxy_with_basic_auth
86
- recipe = MiniPortile.new("test https_proxy", "1.0.0")
87
+ recipe = MiniPortile.new("test https_proxy", "1.0.0", logger: @logger)
87
88
  recipe.files << "https://myserver/path/to/tar.gz"
88
89
  request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread|
89
90
  ENV['https_proxy'] = url
@@ -96,7 +97,7 @@ class TestProxy < TestCase
96
97
  end
97
98
 
98
99
  def test_ftp_proxy
99
- recipe = MiniPortile.new("test ftp_proxy", "1.0.0")
100
+ recipe = MiniPortile.new("test ftp_proxy", "1.0.0", logger: @logger)
100
101
  recipe.files << "ftp://myserver/path/to/tar.gz"
101
102
  request = with_dummy_proxy do |url, thread|
102
103
  ENV['ftp_proxy'] = url
@@ -107,7 +108,7 @@ class TestProxy < TestCase
107
108
  end
108
109
 
109
110
  def test_ftp_proxy_with_basic_auth
110
- recipe = MiniPortile.new("test ftp_proxy", "1.0.0")
111
+ recipe = MiniPortile.new("test ftp_proxy", "1.0.0", logger: @logger)
111
112
  recipe.files << "ftp://myserver/path/to/tar.gz"
112
113
  request = with_dummy_proxy('user: @name', '@12: üMp') do |url, thread|
113
114
  ENV['ftp_proxy'] = url
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_portile2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.6
4
+ version: 2.8.7.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Lavena
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-04-14 00:00:00.000000000 Z
13
+ date: 2024-05-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.5.3
163
+ rubygems_version: 3.5.10
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Simple autoconf and cmake builder for developers