bake-test-external 0.3.3 → 0.4.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: 791c0c350e3852586ef33ee7429401c2bee16dab8c3dc0d9ed0e3f2429918e49
4
- data.tar.gz: d6ac9f1a645aae0d99e8603e4e4a7de9d45254329322f75de3e9b7b36b3b2a6b
3
+ metadata.gz: 47a071dbbd5823bf15e24a29988176668f249f0a5449e527ae7ea6353e1e8a93
4
+ data.tar.gz: d4fc771066257b210e74233c5456cacea65707f4fe5708685400065cd09bc67f
5
5
  SHA512:
6
- metadata.gz: be388ba6c468398997d234b911f2a1963b1db2ade17f2939025ec1db8c112f22f12d5a819916d28c2fe29e15698686393091cdf4fa70c711781a2015e9c9e695
7
- data.tar.gz: 2526de1dc326f168acee41f7afc32dec21265ec41247f49cd21c7ca1296ed92224d1db6225a4d944888b2f1fc1f6e636f20441eba472173d5ba693f86aff2315
6
+ metadata.gz: ab045efb381fcd9e61f7d00eeb056e634cfd42292122104154908959dc39dd0dd74e27350a550032991deae542cabc7a9975eaa2083e25cf4cf8ba82b105fc14
7
+ data.tar.gz: e1d4e308a5e717dd1fd95b58b25dc60ab4606dcb399d1f2d5928f03603d22f1770711bb6c4c8d2a7fc6c7c809e091b959425068aacce6cc582e94b34de1845aa
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2024, by Samuel Williams.
5
5
  # Copyright, 2022, by Akshay Birajdar.
6
6
  # Copyright, 2022, by Hiroaki Osawa.
7
7
 
@@ -21,6 +21,7 @@ def external(input: nil, gemspec: self.find_gemspec)
21
21
 
22
22
  input&.each do |key, config|
23
23
  config = config.transform_keys(&:to_sym)
24
+ config[:env] ||= {}
24
25
 
25
26
  Bundler.with_unbundled_env do
26
27
  clone_and_test(gemspec.name, key, config)
@@ -44,6 +45,7 @@ end
44
45
 
45
46
  def clone_and_test(name, key, config)
46
47
  path = clone_repository(name, key, config)
48
+
47
49
  test_repository(path, config) or abort("External tests #{key} failed!")
48
50
  end
49
51
 
@@ -67,13 +69,12 @@ def clone_repository(name, key, config)
67
69
  end
68
70
 
69
71
  command << url << path
70
- system(*command)
72
+ system(config[:env], *command)
71
73
 
72
74
  # I tried using `bundle config --local local.async ../` but it simply doesn't work.
73
75
  # system("bundle", "config", "--local", "local.async", __dir__, chdir: path)
74
76
 
75
- gemfile_paths = ["#{path}/Gemfile", "#{path}/gems.rb"]
76
- gemfile_path = gemfile_paths.find{|path| File.exist?(path)}
77
+ gemfile_path = self.gemfile_path(path, config)
77
78
 
78
79
  File.open(gemfile_path, 'r+') do |file|
79
80
  pattern = /gem.*?['"]#{name}['"]/
@@ -90,7 +91,7 @@ def clone_repository(name, key, config)
90
91
  end
91
92
  end
92
93
 
93
- system("bundle", "install", chdir: path)
94
+ system(config[:env], "bundle", "install", chdir: path)
94
95
  end
95
96
 
96
97
  return path
@@ -99,5 +100,49 @@ end
99
100
  def test_repository(path, config)
100
101
  command = config.fetch(:command, DEFAULT_COMMAND)
101
102
 
102
- system(*command, chdir: path)
103
+ Array(command).each do |line|
104
+ system(config[:env], *line, chdir: path)
105
+ end
106
+ end
107
+
108
+ GEMFILE_NAMES = ["Gemfile", "gems.rb"]
109
+
110
+ def resolve_gemfile_path(root, config)
111
+ if config_path = config[:gemfile]
112
+ path = File.join(root, config_path)
113
+
114
+ unless File.exist?(path)
115
+ raise ArgumentError, "Specified gemfile path does not exist: #{config_path.inspect}!"
116
+ end
117
+
118
+ # We consider this to be a custom gemfile path:
119
+ return false, path
120
+ end
121
+
122
+ GEMFILE_NAMES.each do |name|
123
+ path = File.join(root, name)
124
+
125
+ if File.exist?(path)
126
+ # We consider this to be a default gemfile path:
127
+ return true, path
128
+ end
129
+ end
130
+
131
+ raise ArgumentError, "Could not find gem file in #{root.inspect}!"
132
+ end
133
+
134
+ def gemfile_path(root, config)
135
+ config.fetch(:cached_gemfile_path) do
136
+ root = File.expand_path(root, @root)
137
+ default, path = self.resolve_gemfile_path(root, config)
138
+
139
+ config[:cached_gemfile_path] = path
140
+
141
+ # Custom gemfile paths should be set explicitly:
142
+ unless default
143
+ config[:env]['BUNDLE_GEMFILE'] = path
144
+ end
145
+
146
+ return path
147
+ end
103
148
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2022, by Samuel Williams.
4
+ # Copyright, 2022-2024, by Samuel Williams.
5
5
 
6
6
  module Bake
7
7
  module Test
8
8
  module External
9
- VERSION = "0.3.3"
9
+ VERSION = "0.4.0"
10
10
  end
11
11
  end
12
12
  end
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2022, by Samuel Williams.
3
+ Copyright, 2022-2024, by Samuel Williams.
4
4
  Copyright, 2022, by Akshay Birajdar.
5
5
  Copyright, 2022, by Hiroaki Osawa.
6
6
 
data/readme.md CHANGED
@@ -37,4 +37,4 @@ This project uses the [Developer Certificate of Origin](https://developercertifi
37
37
 
38
38
  ### Contributor Covenant
39
39
 
40
- This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
40
+ This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-test-external
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -39,7 +39,7 @@ cert_chain:
39
39
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
40
40
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
41
  -----END CERTIFICATE-----
42
- date: 2023-07-15 00:00:00.000000000 Z
42
+ date: 2024-06-13 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: bake
@@ -70,6 +70,7 @@ licenses:
70
70
  - MIT
71
71
  metadata:
72
72
  funding_uri: https://github.com/sponsors/ioquatix/
73
+ source_code_uri: https://github.com/ioquatix/bake-test-external.git
73
74
  post_install_message:
74
75
  rdoc_options: []
75
76
  require_paths:
@@ -78,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
79
  requirements:
79
80
  - - ">="
80
81
  - !ruby/object:Gem::Version
81
- version: 2.7.6
82
+ version: '3.1'
82
83
  required_rubygems_version: !ruby/object:Gem::Requirement
83
84
  requirements:
84
85
  - - ">="
85
86
  - !ruby/object:Gem::Version
86
87
  version: '0'
87
88
  requirements: []
88
- rubygems_version: 3.4.10
89
+ rubygems_version: 3.5.9
89
90
  signing_key:
90
91
  specification_version: 4
91
92
  summary: Run external test suites to check for breakage.
metadata.gz.sig CHANGED
Binary file