busser 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +8 -0
- data/features/plugin_create_command.feature +7 -9
- data/lib/busser/command/plugin_create.rb +17 -3
- data/lib/busser/command/setup.rb +17 -3
- data/lib/busser/ui.rb +8 -0
- data/lib/busser/version.rb +1 -1
- data/spec/busser/command/plugin_create_spec.rb +175 -0
- data/spec/busser/command/setup_spec.rb +121 -0
- data/spec/busser/ui_spec.rb +49 -3
- data/templates/plugin/Rakefile.erb +4 -24
- data/templates/plugin/features_env.rb.erb +4 -4
- data/templates/plugin/gemspec.erb +7 -8
- data/templates/plugin/github_workflow.yml.erb +26 -0
- metadata +4 -3
- data/templates/plugin/tailor.erb +0 -4
- data/templates/plugin/travis.yml.erb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8c0be7ee63d2b1d111438e2039187a5283308daae897a27d6028c08d9cefa13d
|
|
4
|
+
data.tar.gz: 49e9d09408a9cc284cfb9b43f8daeac1f55eda961ad66697dbefe8741ce2976a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71b525573141abe2bf35be2559189a811328e608eaef9a1ead8390595b7d500e76344ef7d29c624028c42d3e7a288a23c41e2e4a09d288734101ee9de2975d35
|
|
7
|
+
data.tar.gz: 4d769038c5032cfefdc0b50217f77e6950d2121162c4a07bdbd7d3a7a4b1b794d35a7d501b94ad5621c7628e942cd8d4f56c90d87fa01d0e7aab722e0961fd54
|
data/CHANGELOG.md
CHANGED
|
@@ -33,6 +33,14 @@ main reason to take this version.
|
|
|
33
33
|
* Rewritten README, and development documentation moved to
|
|
34
34
|
CONTRIBUTING.md ([#63](https://github.com/test-kitchen/busser/pull/63))
|
|
35
35
|
|
|
36
|
+
## [0.9.1](https://github.com/test-kitchen/busser/compare/v0.9.0...v0.9.1) (2026-08-28)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* generate a plugin project that resolves and builds ([#68](https://github.com/test-kitchen/busser/issues/68)) ([0c9a450](https://github.com/test-kitchen/busser/commit/0c9a450af83f086ac3627be938db856c9657208b))
|
|
42
|
+
* report signals and keep bundler out of the busser binstub ([#66](https://github.com/test-kitchen/busser/issues/66)) ([4fc9b35](https://github.com/test-kitchen/busser/commit/4fc9b350c7e3990c82ce4e229927be60a6431ee7))
|
|
43
|
+
|
|
36
44
|
## 0.8.0 / 2020-08-20
|
|
37
45
|
|
|
38
46
|
- Add http_proxy support to `busser plugin install`
|
|
@@ -11,7 +11,7 @@ Feature: Plugin create command
|
|
|
11
11
|
## 0.1.0 / Unreleased
|
|
12
12
|
"""
|
|
13
13
|
And the file "busser-junit/Gemfile" should contain "gemspec"
|
|
14
|
-
And the file "busser-junit/Rakefile" should contain "
|
|
14
|
+
And the file "busser-junit/Rakefile" should contain "Cucumber::Rake::Task"
|
|
15
15
|
And the file "busser-junit/README.md" should contain:
|
|
16
16
|
"""
|
|
17
17
|
Busser::RunnerPlugin::Junit
|
|
@@ -28,15 +28,13 @@ Feature: Plugin create command
|
|
|
28
28
|
"""
|
|
29
29
|
Gemfile.lock
|
|
30
30
|
"""
|
|
31
|
-
And the file "busser-junit/.
|
|
31
|
+
And the file "busser-junit/.github/workflows/test.yml" should contain:
|
|
32
32
|
"""
|
|
33
|
-
|
|
33
|
+
bundle exec rake test
|
|
34
34
|
"""
|
|
35
|
-
And
|
|
36
|
-
""
|
|
37
|
-
|
|
38
|
-
"""
|
|
39
|
-
And a file named "busser-junit/.cane" should exist
|
|
35
|
+
And a file named "busser-junit/.travis.yml" should not exist
|
|
36
|
+
And a file named "busser-junit/.tailor" should not exist
|
|
37
|
+
And a file named "busser-junit/.cane" should not exist
|
|
40
38
|
And the file "busser-junit/lib/busser/junit/version.rb" should contain:
|
|
41
39
|
"""
|
|
42
40
|
module Busser
|
|
@@ -49,7 +47,7 @@ Feature: Plugin create command
|
|
|
49
47
|
"""
|
|
50
48
|
And the file "busser-junit/features/support/env.rb" should contain:
|
|
51
49
|
"""
|
|
52
|
-
require
|
|
50
|
+
require "busser/cucumber"
|
|
53
51
|
"""
|
|
54
52
|
And the file "busser-junit/features/plugin_install_command.feature" should contain:
|
|
55
53
|
"""
|
|
@@ -57,9 +57,7 @@ module Busser
|
|
|
57
57
|
create_template("gemspec.erb", "#{config[:gem_name]}.gemspec")
|
|
58
58
|
create_template("license_#{config[:license]}.erb", license_filename)
|
|
59
59
|
create_template("gitignore.erb", ".gitignore")
|
|
60
|
-
create_template("
|
|
61
|
-
create_template("travis.yml.erb", ".travis.yml")
|
|
62
|
-
create_file(File.join(target_dir, ".cane"))
|
|
60
|
+
create_template("github_workflow.yml.erb", ".github/workflows/test.yml")
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
def create_source_files
|
|
@@ -128,6 +126,7 @@ module Busser
|
|
|
128
126
|
email: email,
|
|
129
127
|
license: options[:license],
|
|
130
128
|
license_string: license_string,
|
|
129
|
+
license_spdx: license_spdx,
|
|
131
130
|
year: Time.now.year,
|
|
132
131
|
}
|
|
133
132
|
end
|
|
@@ -154,6 +153,21 @@ module Busser
|
|
|
154
153
|
end
|
|
155
154
|
end
|
|
156
155
|
|
|
156
|
+
# RubyGems validates spec.license against the SPDX list and warns on
|
|
157
|
+
# anything else, so the gemspec cannot reuse the human readable name
|
|
158
|
+
# that the README wants. "All rights reserved" has no SPDX identifier,
|
|
159
|
+
# so those gemspecs declare no license at all.
|
|
160
|
+
def license_spdx
|
|
161
|
+
case options[:license]
|
|
162
|
+
when "mit" then "MIT"
|
|
163
|
+
when "apachev2" then "Apache-2.0"
|
|
164
|
+
when "lgplv3" then "LGPL-3.0-only"
|
|
165
|
+
when "reserved" then nil
|
|
166
|
+
else
|
|
167
|
+
raise ArgumentError, "No such license #{options[:license]}"
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
157
171
|
def license_filename
|
|
158
172
|
case options[:license]
|
|
159
173
|
when "mit" then "LICENSE.txt"
|
data/lib/busser/command/setup.rb
CHANGED
|
@@ -79,9 +79,19 @@ module Busser
|
|
|
79
79
|
SET "GEM_PATH=#{gem_path}"
|
|
80
80
|
SET "GEM_CACHE=#{gem_home}\\cache"
|
|
81
81
|
|
|
82
|
-
REM
|
|
82
|
+
REM Keep the calling Ruby environment out of this one. Clearing
|
|
83
|
+
REM RUBYOPT is no longer enough: RubyGems requires bundler/setup
|
|
84
|
+
REM whenever BUNDLER_SETUP is set, and bundler then points GEM_HOME
|
|
85
|
+
REM at the calling project's bundle, undoing the isolation above.
|
|
83
86
|
SET RUBYOPT=
|
|
84
87
|
SET GEMRC=
|
|
88
|
+
SET RUBYLIB=
|
|
89
|
+
SET BUNDLER_SETUP=
|
|
90
|
+
SET BUNDLER_VERSION=
|
|
91
|
+
SET BUNDLE_BIN_PATH=
|
|
92
|
+
SET BUNDLE_GEMFILE=
|
|
93
|
+
SET BUNDLE_LOCKFILE=
|
|
94
|
+
SET BUNDLE_PATH=
|
|
85
95
|
|
|
86
96
|
REM Call the actual Busser bin with our arguments
|
|
87
97
|
"#{ruby_bin}" "#{gem_bindir}\\busser" %*
|
|
@@ -120,8 +130,12 @@ module Busser
|
|
|
120
130
|
GEM_PATH="#{gem_path}"; export GEM_PATH
|
|
121
131
|
GEM_CACHE="#{gem_home}/cache"; export GEM_CACHE
|
|
122
132
|
|
|
123
|
-
#
|
|
124
|
-
|
|
133
|
+
# Keep the calling Ruby environment out of this one. Unsetting
|
|
134
|
+
# RUBYOPT is no longer enough: RubyGems requires bundler/setup
|
|
135
|
+
# whenever BUNDLER_SETUP is set, and bundler then points GEM_HOME
|
|
136
|
+
# at the calling project's bundle, undoing the isolation above.
|
|
137
|
+
unset RUBYOPT GEMRC RUBYLIB BUNDLER_SETUP BUNDLER_VERSION
|
|
138
|
+
unset BUNDLE_BIN_PATH BUNDLE_GEMFILE BUNDLE_LOCKFILE BUNDLE_PATH
|
|
125
139
|
|
|
126
140
|
# Call the actual Busser bin with our arguments
|
|
127
141
|
exec "#{ruby_bin}" "#{gem_bindir}/busser" "$@"
|
data/lib/busser/ui.rb
CHANGED
|
@@ -96,6 +96,14 @@ module Busser
|
|
|
96
96
|
)
|
|
97
97
|
elsif status.success?
|
|
98
98
|
true
|
|
99
|
+
elsif status.exitstatus.nil?
|
|
100
|
+
# A process killed by a signal has no exit status, and Kernel#exit
|
|
101
|
+
# rejects nil, so reporting it as an exit code raised a TypeError and
|
|
102
|
+
# took Busser down with a stack trace rather than a diagnosis. Signals
|
|
103
|
+
# are how the out of memory killer stops a test run, which is the same
|
|
104
|
+
# situation the nil status branch above was written for.
|
|
105
|
+
signal = status.termsig
|
|
106
|
+
die("#{type} [#{cmd}] was terminated by signal #{signal}", 128 + signal)
|
|
99
107
|
else
|
|
100
108
|
code = status.exitstatus
|
|
101
109
|
die("#{type} [#{cmd}] exit code was #{code}", code)
|
data/lib/busser/version.rb
CHANGED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative "../../spec_helper"
|
|
16
|
+
|
|
17
|
+
require "tmpdir"
|
|
18
|
+
|
|
19
|
+
require "busser/command/plugin_create"
|
|
20
|
+
|
|
21
|
+
# The generated project is what a plugin author starts from, so the checks
|
|
22
|
+
# worth having are the ones a new project would trip over on day one.
|
|
23
|
+
describe Busser::Command::PluginCreate do
|
|
24
|
+
|
|
25
|
+
before do
|
|
26
|
+
@tmpdir = Dir.mktmpdir("busser-plugin-create")
|
|
27
|
+
@pwd = Dir.pwd
|
|
28
|
+
Dir.chdir(@tmpdir)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
after do
|
|
32
|
+
Dir.chdir(@pwd)
|
|
33
|
+
FileUtils.rm_rf(@tmpdir)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe "the generated gemspec" do
|
|
37
|
+
|
|
38
|
+
it "loads" do
|
|
39
|
+
generate
|
|
40
|
+
|
|
41
|
+
_(gemspec.name).must_equal "busser-demo"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# RubyGems validates spec.license against the SPDX list and warns on
|
|
45
|
+
# anything else. The generator used to emit "Apache 2.0", the human
|
|
46
|
+
# readable name rather than the identifier.
|
|
47
|
+
it "declares a license RubyGems recognises" do
|
|
48
|
+
generate
|
|
49
|
+
|
|
50
|
+
_(Gem::Licenses.match?(gemspec.license)).must_equal true
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
"apachev2" => "Apache-2.0",
|
|
55
|
+
"mit" => "MIT",
|
|
56
|
+
"lgplv3" => "LGPL-3.0-only",
|
|
57
|
+
}.each do |option, identifier|
|
|
58
|
+
it "maps --license #{option} to #{identifier}" do
|
|
59
|
+
generate(license: option)
|
|
60
|
+
|
|
61
|
+
_(gemspec.license).must_equal identifier
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# "All rights reserved" has no SPDX identifier, so declaring nothing is
|
|
66
|
+
# the only correct option.
|
|
67
|
+
it "declares no license for an all rights reserved plugin" do
|
|
68
|
+
generate(license: "reserved")
|
|
69
|
+
|
|
70
|
+
_(gemspec.license).must_be_nil
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# bundler ~> 1.3 cannot be satisfied by any bundler in use today, so a
|
|
74
|
+
# freshly generated plugin failed to resolve before running anything.
|
|
75
|
+
it "does not constrain bundler" do
|
|
76
|
+
generate
|
|
77
|
+
|
|
78
|
+
_(dev_dependencies).wont_include "bundler"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# cane, tailor and countloc have been unmaintained for about a decade.
|
|
82
|
+
%w{cane tailor countloc}.each do |gem_name|
|
|
83
|
+
it "does not depend on #{gem_name}" do
|
|
84
|
+
generate
|
|
85
|
+
|
|
86
|
+
_(dev_dependencies).wont_include gem_name
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "depends on what the generated Rakefile needs" do
|
|
91
|
+
generate
|
|
92
|
+
|
|
93
|
+
_(dev_dependencies).must_include "rake"
|
|
94
|
+
_(dev_dependencies).must_include "cucumber"
|
|
95
|
+
_(dev_dependencies).must_include "aruba"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "states a supported Ruby version" do
|
|
99
|
+
generate
|
|
100
|
+
|
|
101
|
+
requirement = gemspec.required_ruby_version
|
|
102
|
+
|
|
103
|
+
_(requirement.satisfied_by?(Gem::Version.new("3.2.0"))).must_equal true
|
|
104
|
+
_(requirement.satisfied_by?(Gem::Version.new("2.7.0"))).must_equal false
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def gemspec
|
|
108
|
+
Gem::Specification.load(File.join(plugin_dir, "busser-demo.gemspec"))
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def dev_dependencies
|
|
112
|
+
gemspec.development_dependencies.map(&:name)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
describe "the generated project" do
|
|
117
|
+
|
|
118
|
+
it "ships a CI workflow rather than a Travis config" do
|
|
119
|
+
generate
|
|
120
|
+
|
|
121
|
+
_(File.exist?(File.join(plugin_dir, ".github/workflows/test.yml")))
|
|
122
|
+
.must_equal true
|
|
123
|
+
_(File.exist?(File.join(plugin_dir, ".travis.yml"))).must_equal false
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Both linters are long dead, and the Rakefile's default task depended on
|
|
127
|
+
# them, so `rake` failed on a freshly generated plugin.
|
|
128
|
+
it "ships no dead linter configuration" do
|
|
129
|
+
generate
|
|
130
|
+
|
|
131
|
+
_(File.exist?(File.join(plugin_dir, ".tailor"))).must_equal false
|
|
132
|
+
_(File.exist?(File.join(plugin_dir, ".cane"))).must_equal false
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
it "has a Rakefile that only references tasks it defines" do
|
|
136
|
+
generate
|
|
137
|
+
|
|
138
|
+
rakefile = File.read(File.join(plugin_dir, "Rakefile"))
|
|
139
|
+
|
|
140
|
+
_(rakefile).wont_match(/cane|tailor|countloc/)
|
|
141
|
+
_(rakefile).must_match(/Cucumber::Rake::Task/)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# aruba 1.0 dropped @aruba_timeout_seconds, and setting it on aruba 2 is
|
|
145
|
+
# silently ignored, so the generated timeout did nothing at all.
|
|
146
|
+
it "configures aruba through the supported API" do
|
|
147
|
+
generate
|
|
148
|
+
|
|
149
|
+
env = File.read(File.join(plugin_dir, "features/support/env.rb"))
|
|
150
|
+
|
|
151
|
+
_(env).wont_match(/@aruba_timeout_seconds/)
|
|
152
|
+
_(env).must_match(/Aruba\.configure/)
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def generate(license: "apachev2")
|
|
157
|
+
command = Busser::Command::PluginCreate.new(
|
|
158
|
+
["demo"], { "type" => "runner", "license" => license }
|
|
159
|
+
)
|
|
160
|
+
command.stubs(:initialize_git)
|
|
161
|
+
capture_stdout { command.create }
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def plugin_dir
|
|
165
|
+
File.join(@tmpdir, "busser-demo")
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def capture_stdout
|
|
169
|
+
original = $stdout
|
|
170
|
+
$stdout = StringIO.new
|
|
171
|
+
yield
|
|
172
|
+
ensure
|
|
173
|
+
$stdout = original
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
require_relative "../../spec_helper"
|
|
16
|
+
|
|
17
|
+
require "tmpdir"
|
|
18
|
+
|
|
19
|
+
require "busser/command/setup"
|
|
20
|
+
|
|
21
|
+
# The binstub exists to give Busser an isolated gem environment on the machine
|
|
22
|
+
# under test, so what it does to the environment before exec is the contract
|
|
23
|
+
# worth pinning down.
|
|
24
|
+
describe Busser::Command::Setup do
|
|
25
|
+
|
|
26
|
+
# Anything left set here lets the calling Ruby environment reach into
|
|
27
|
+
# Busser's. RUBYOPT was once the only way in; RubyGems now requires
|
|
28
|
+
# bundler/setup whenever BUNDLER_SETUP is present, and bundler then resets
|
|
29
|
+
# GEM_HOME to the calling project's bundle.
|
|
30
|
+
LEAKY_VARIABLES = %w{
|
|
31
|
+
RUBYOPT GEMRC RUBYLIB
|
|
32
|
+
BUNDLER_SETUP BUNDLER_VERSION
|
|
33
|
+
BUNDLE_BIN_PATH BUNDLE_GEMFILE BUNDLE_LOCKFILE BUNDLE_PATH
|
|
34
|
+
}.freeze
|
|
35
|
+
|
|
36
|
+
before do
|
|
37
|
+
@tmpdir = Dir.mktmpdir("busser-setup")
|
|
38
|
+
@original_root = ENV["BUSSER_ROOT"]
|
|
39
|
+
ENV["BUSSER_ROOT"] = @tmpdir
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
after do
|
|
43
|
+
ENV["BUSSER_ROOT"] = @original_root
|
|
44
|
+
FileUtils.rm_rf(@tmpdir)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe "the bourne binstub" do
|
|
48
|
+
|
|
49
|
+
it "is created and executable" do
|
|
50
|
+
run_setup
|
|
51
|
+
|
|
52
|
+
_(File.exist?(binstub)).must_equal true
|
|
53
|
+
_(File.stat(binstub).mode & 0o111).wont_equal 0
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "pins BUSSER_ROOT and the gem paths" do
|
|
57
|
+
run_setup
|
|
58
|
+
|
|
59
|
+
_(binstub_body).must_match(/BUSSER_ROOT="#{Regexp.escape(@tmpdir)}"/)
|
|
60
|
+
_(binstub_body).must_match(/^GEM_HOME=/)
|
|
61
|
+
_(binstub_body).must_match(/^GEM_PATH=/)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
LEAKY_VARIABLES.each do |name|
|
|
65
|
+
it "unsets #{name} before exec" do
|
|
66
|
+
run_setup
|
|
67
|
+
|
|
68
|
+
_(unset_variables).must_include name
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "unsets everything before handing off to ruby" do
|
|
73
|
+
run_setup
|
|
74
|
+
|
|
75
|
+
unset_line = binstub_body.index("unset ")
|
|
76
|
+
exec_line = binstub_body.index("exec ")
|
|
77
|
+
|
|
78
|
+
_(unset_line).must_be :<, exec_line
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def binstub
|
|
82
|
+
File.join(@tmpdir, "bin", "busser")
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def unset_variables
|
|
86
|
+
binstub_body.scan(/^unset (.+)$/).flatten.join(" ").split(/\s+/)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
describe "the bat binstub" do
|
|
91
|
+
|
|
92
|
+
LEAKY_VARIABLES.each do |name|
|
|
93
|
+
it "clears #{name} before exec" do
|
|
94
|
+
run_setup(type: "bat")
|
|
95
|
+
|
|
96
|
+
_(binstub_body).must_match(/^SET #{name}=\s*$/)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def binstub
|
|
101
|
+
File.join(@tmpdir, "bin", "busser.bat")
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def run_setup(type: "bourne")
|
|
106
|
+
command = Busser::Command::Setup.new([], { "type" => type })
|
|
107
|
+
capture_stdout { command.perform }
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def binstub_body
|
|
111
|
+
File.read(binstub)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def capture_stdout
|
|
115
|
+
original = $stdout
|
|
116
|
+
$stdout = StringIO.new
|
|
117
|
+
yield
|
|
118
|
+
ensure
|
|
119
|
+
$stdout = original
|
|
120
|
+
end
|
|
121
|
+
end
|
data/spec/busser/ui_spec.rb
CHANGED
|
@@ -45,10 +45,16 @@ end
|
|
|
45
45
|
# Stub that mimics a Process::Status object
|
|
46
46
|
class FakeStatus
|
|
47
47
|
|
|
48
|
-
attr_reader :exitstatus
|
|
48
|
+
attr_reader :exitstatus, :termsig
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
# A process stopped by a signal reports success? as nil rather than false,
|
|
51
|
+
# carries no exitstatus, and sets termsig instead.
|
|
52
|
+
def self.signalled(termsig)
|
|
53
|
+
new(nil, nil, termsig)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def initialize(success = true, exitstatus = 0, termsig = nil)
|
|
57
|
+
@success, @exitstatus, @termsig = success, exitstatus, termsig
|
|
52
58
|
end
|
|
53
59
|
|
|
54
60
|
def success?
|
|
@@ -138,6 +144,26 @@ describe Busser::UI do
|
|
|
138
144
|
end
|
|
139
145
|
end
|
|
140
146
|
|
|
147
|
+
# The out of memory killer stops a run with SIGKILL. exitstatus is nil
|
|
148
|
+
# there, and reporting it as an exit code used to raise a TypeError from
|
|
149
|
+
# Kernel#exit, so Busser died with a stack trace instead of saying what
|
|
150
|
+
# happened.
|
|
151
|
+
it "reports the signal when the command was killed" do
|
|
152
|
+
ui.status = FakeStatus.signalled(9)
|
|
153
|
+
output = capture_stderr { ui.invoke_run!("failwhale") }
|
|
154
|
+
|
|
155
|
+
_(output).must_match(/terminated by signal 9/)
|
|
156
|
+
_(ui.died?).must_equal true
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it "terminates with 128 plus the signal when the command was killed" do
|
|
160
|
+
ui.status = FakeStatus.signalled(9)
|
|
161
|
+
|
|
162
|
+
capture_stderr do
|
|
163
|
+
_(ui.invoke_run!("failwhale")).must_equal 137
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
141
167
|
it "terminates the program if status is nil" do
|
|
142
168
|
ui.status = nil
|
|
143
169
|
output = capture_stderr { ui.invoke_run!("failwhale") }
|
|
@@ -197,6 +223,26 @@ describe Busser::UI do
|
|
|
197
223
|
end
|
|
198
224
|
end
|
|
199
225
|
|
|
226
|
+
# The out of memory killer stops a run with SIGKILL. exitstatus is nil
|
|
227
|
+
# there, and reporting it as an exit code used to raise a TypeError from
|
|
228
|
+
# Kernel#exit, so Busser died with a stack trace instead of saying what
|
|
229
|
+
# happened.
|
|
230
|
+
it "reports the signal when the command was killed" do
|
|
231
|
+
ui.status = FakeStatus.signalled(9)
|
|
232
|
+
output = capture_stderr { ui.invoke_run_ruby_script!("nope.rb") }
|
|
233
|
+
|
|
234
|
+
_(output).must_match(/terminated by signal 9/)
|
|
235
|
+
_(ui.died?).must_equal true
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
it "terminates with 128 plus the signal when the command was killed" do
|
|
239
|
+
ui.status = FakeStatus.signalled(9)
|
|
240
|
+
|
|
241
|
+
capture_stderr do
|
|
242
|
+
_(ui.invoke_run_ruby_script!("nope.rb")).must_equal 137
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
200
246
|
it "terminates the program if status is nil" do
|
|
201
247
|
ui.status = nil
|
|
202
248
|
output = capture_stderr { ui.invoke_run_ruby_script!("nope.rb") }
|
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
|
-
require
|
|
3
|
-
require 'cane/rake_task'
|
|
4
|
-
require 'tailor/rake_task'
|
|
2
|
+
require "cucumber/rake/task"
|
|
5
3
|
|
|
6
4
|
Cucumber::Rake::Task.new(:features) do |t|
|
|
7
|
-
t.cucumber_opts = [
|
|
5
|
+
t.cucumber_opts = ["features", "-x", "--format progress", "--no-color"]
|
|
8
6
|
end
|
|
9
7
|
|
|
10
8
|
desc "Run all test suites"
|
|
11
|
-
task :
|
|
9
|
+
task test: [:features]
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
Cane::RakeTask.new do |cane|
|
|
15
|
-
cane.canefile = './.cane'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Tailor::RakeTask.new
|
|
19
|
-
|
|
20
|
-
desc "Display LOC stats"
|
|
21
|
-
task :stats do
|
|
22
|
-
puts "\n## Production Code Stats"
|
|
23
|
-
sh "countloc -r lib"
|
|
24
|
-
puts "\n## Test Code Stats"
|
|
25
|
-
sh "countloc -r features"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
desc "Run all quality tasks"
|
|
29
|
-
task :quality => [:cane, :tailor, :stats]
|
|
30
|
-
|
|
31
|
-
task :default => [:test, :quality]
|
|
11
|
+
task default: [:test]
|
|
@@ -11,20 +11,19 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
spec.description = %q{A Busser <%= config[:type] %> plugin for <%= config[:klass_name] %>}
|
|
12
12
|
spec.summary = spec.description
|
|
13
13
|
spec.homepage = ''
|
|
14
|
-
|
|
14
|
+
<% if config[:license_spdx] -%>
|
|
15
|
+
spec.license = '<%= config[:license_spdx] %>'
|
|
16
|
+
<% end -%>
|
|
15
17
|
|
|
16
18
|
spec.files = `git ls-files`.split($/)
|
|
17
19
|
spec.executables = []
|
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
20
|
spec.require_paths = ['lib']
|
|
20
21
|
|
|
22
|
+
spec.required_ruby_version = '>= 3.2'
|
|
23
|
+
|
|
21
24
|
spec.add_dependency 'busser'
|
|
22
25
|
|
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.3'
|
|
24
26
|
spec.add_development_dependency 'rake'
|
|
25
|
-
spec.add_development_dependency 'aruba'
|
|
26
|
-
|
|
27
|
-
spec.add_development_dependency 'cane'
|
|
28
|
-
spec.add_development_dependency 'tailor'
|
|
29
|
-
spec.add_development_dependency 'countloc'
|
|
27
|
+
spec.add_development_dependency 'aruba', '>= 2.0'
|
|
28
|
+
spec.add_development_dependency 'cucumber', '>= 9.0'
|
|
30
29
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Test"
|
|
3
|
+
|
|
4
|
+
"on":
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: "Ruby ${{ matrix.ruby }}"
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
ruby: ["3.2", "3.3", "3.4"]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v5
|
|
22
|
+
- uses: ruby/setup-ruby@v1
|
|
23
|
+
with:
|
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
|
25
|
+
bundler-cache: true
|
|
26
|
+
- run: bundle exec rake test
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: busser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fletcher Nichol
|
|
@@ -151,6 +151,8 @@ files:
|
|
|
151
151
|
- release-please-config.json
|
|
152
152
|
- renovate.json
|
|
153
153
|
- spec/busser/command/deserialize_spec.rb
|
|
154
|
+
- spec/busser/command/plugin_create_spec.rb
|
|
155
|
+
- spec/busser/command/setup_spec.rb
|
|
154
156
|
- spec/busser/helpers_spec.rb
|
|
155
157
|
- spec/busser/plugin_spec.rb
|
|
156
158
|
- spec/busser/ui_spec.rb
|
|
@@ -164,14 +166,13 @@ files:
|
|
|
164
166
|
- templates/plugin/features_plugin_list_command.feature.erb
|
|
165
167
|
- templates/plugin/features_test_command.feature.erb
|
|
166
168
|
- templates/plugin/gemspec.erb
|
|
169
|
+
- templates/plugin/github_workflow.yml.erb
|
|
167
170
|
- templates/plugin/gitignore.erb
|
|
168
171
|
- templates/plugin/license_apachev2.erb
|
|
169
172
|
- templates/plugin/license_lgplv3.erb
|
|
170
173
|
- templates/plugin/license_mit.erb
|
|
171
174
|
- templates/plugin/license_reserved.erb
|
|
172
175
|
- templates/plugin/runner_plugin.rb.erb
|
|
173
|
-
- templates/plugin/tailor.erb
|
|
174
|
-
- templates/plugin/travis.yml.erb
|
|
175
176
|
- templates/plugin/version.rb.erb
|
|
176
177
|
homepage: https://github.com/test-kitchen/busser
|
|
177
178
|
licenses:
|
data/templates/plugin/tailor.erb
DELETED