bake-test-external 0.3.2 → 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: 436b2f2def2f96fc9bcb105b293e068bf78b7a1343d4cece9d1c82601260eece
4
- data.tar.gz: 2311ade76f8454a7cc535e8c7717e21b56ebbe92b4a419072def38c750bd1907
3
+ metadata.gz: 47a071dbbd5823bf15e24a29988176668f249f0a5449e527ae7ea6353e1e8a93
4
+ data.tar.gz: d4fc771066257b210e74233c5456cacea65707f4fe5708685400065cd09bc67f
5
5
  SHA512:
6
- metadata.gz: 3619f8a89b6a4b7aab0e0962519f0ab28176314e70189d5917ef6008afceeb34dd960bcad22be6cc0569d6f850fe772cee491586d9190439ead1fcdbf6452932
7
- data.tar.gz: fa462ccd174b03d27d06f368a91048ab50b2e5b0d8f3139598fb53b2dff4f32ebdae880031b89994ce8a495b245c828181f3327ab6b801af43cad8732a9d3e98
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.2"
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
@@ -30,3 +30,11 @@ We welcome contributions to this project.
30
30
  3. Commit your changes (`git commit -am 'Add some feature'`).
31
31
  4. Push to the branch (`git push origin my-new-feature`).
32
32
  5. Create new Pull Request.
33
+
34
+ ### Developer Certificate of Origin
35
+
36
+ This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
37
+
38
+ ### Contributor Covenant
39
+
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.2
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: 2022-10-13 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
@@ -55,20 +55,6 @@ dependencies:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
- - !ruby/object:Gem::Dependency
59
- name: rspec
60
- requirement: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: '0'
65
- type: :development
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: '0'
72
58
  description:
73
59
  email:
74
60
  executables: []
@@ -84,6 +70,7 @@ licenses:
84
70
  - MIT
85
71
  metadata:
86
72
  funding_uri: https://github.com/sponsors/ioquatix/
73
+ source_code_uri: https://github.com/ioquatix/bake-test-external.git
87
74
  post_install_message:
88
75
  rdoc_options: []
89
76
  require_paths:
@@ -92,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
79
  requirements:
93
80
  - - ">="
94
81
  - !ruby/object:Gem::Version
95
- version: '0'
82
+ version: '3.1'
96
83
  required_rubygems_version: !ruby/object:Gem::Requirement
97
84
  requirements:
98
85
  - - ">="
99
86
  - !ruby/object:Gem::Version
100
87
  version: '0'
101
88
  requirements: []
102
- rubygems_version: 3.3.7
89
+ rubygems_version: 3.5.9
103
90
  signing_key:
104
91
  specification_version: 4
105
92
  summary: Run external test suites to check for breakage.
metadata.gz.sig CHANGED
Binary file