-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathenv.rb
More file actions
48 lines (43 loc) · 1.97 KB
/
Copy pathenv.rb
File metadata and controls
48 lines (43 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require "fileutils" unless defined?(FileUtils)
require "rubygems/package"
require "aruba/cucumber"
require "busser/cucumber"
# aruba 2 dropped @aruba_timeout_seconds; setting it in a Before hook is a
# no-op, which quietly left these commands on aruba's 15 second default.
# Installing a plugin and its gems into a cold sandbox does not always fit.
Aruba.configure do |config|
config.exit_timeout = 120
end
# The sandboxed features shell out to `busser plugin install <this plugin>`, and
# two things have to hold for that to exercise this checkout:
#
# * The child has to be free of bundler. RubyGems re-requires bundler/setup
# whenever BUNDLER_SETUP is set, and bundler then resets Gem.dir to the
# bundle, so busser installs into vendor/bundle rather than the sandboxed
# GEM_HOME the features assert against. busser's "a non bundler environment"
# step clears that, and has to run before the sandbox is set up.
# * The plugin has to already be in that sandbox. Otherwise busser fetches the
# last release from RubyGems and runs *its* postinstall, which means CI
# silently tests the published gem instead of the code under review.
#
# So build the gem from the working tree and install it into the sandbox first.
Given(/^this plugin is installed from the working tree$/) do
root = File.expand_path("../..", __dir__)
package = nil
begin
Dir.chdir(root) do
spec = Gem::Specification.load(Dir["*.gemspec"].first)
package = Gem::Package.build(spec)
# --ignore-dependencies keeps this from reaching the network: busser and
# the rest are already resolvable through the GEM_PATH the sandbox step
# leaves in place.
installed = system(
Gem.ruby, "-S", "gem", "install", "--local", "--no-document",
"--ignore-dependencies", package, out: File::NULL
)
raise "could not install #{package} into #{ENV["GEM_HOME"]}" unless installed
end
ensure
FileUtils.rm_f(File.join(root, package)) if package
end
end