Class: Pinspec::Runner::Sandbox
- Inherits:
-
Object
- Object
- Pinspec::Runner::Sandbox
- Defined in:
- lib/pinspec/runner/sandbox.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- PROBE_DIR =
"tmp/pinspec"- PROBE_FILE =
"probe.rb"- DEFAULT_TIMEOUT =
600- FORCED_ENV =
{ "DISABLE_SPRING" => "1", "TZ" => "UTC", "RAILS_ENV" => "test" }.freeze
- SCRUBBED_ENV =
{ "BUNDLE_GEMFILE" => nil, "BUNDLE_PATH" => nil, "BUNDLE_BIN_PATH" => nil, "BUNDLE_APP_CONFIG" => nil, "BUNDLER_VERSION" => nil, "BUNDLER_SETUP" => nil, "RUBYOPT" => nil, "RUBYLIB" => nil, "GEM_HOME" => nil, "GEM_PATH" => nil }.freeze
Instance Method Summary collapse
- #capture(boots: 2) ⇒ Object
-
#initialize(app_root:, probe_source:, timeout: DEFAULT_TIMEOUT, runner: nil, env: {}) ⇒ Sandbox
constructor
A new instance of Sandbox.
- #probe_path ⇒ Object
- #write_probe! ⇒ Object
Constructor Details
#initialize(app_root:, probe_source:, timeout: DEFAULT_TIMEOUT, runner: nil, env: {}) ⇒ Sandbox
Returns a new instance of Sandbox.
40 41 42 43 44 45 46 |
# File 'lib/pinspec/runner/sandbox.rb', line 40 def initialize(app_root:, probe_source:, timeout: DEFAULT_TIMEOUT, runner: nil, env: {}) @app_root = app_root @probe_source = probe_source @timeout = timeout @runner = runner @env = env end |
Instance Method Details
#capture(boots: 2) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/pinspec/runner/sandbox.rb', line 58 def capture(boots: 2) write_probe! (1..boots).map do |run| execute(run: run, seed: 40 + run) end end |
#probe_path ⇒ Object
48 49 50 |
# File 'lib/pinspec/runner/sandbox.rb', line 48 def probe_path File.join(@app_root, PROBE_DIR, PROBE_FILE) end |
#write_probe! ⇒ Object
52 53 54 55 56 |
# File 'lib/pinspec/runner/sandbox.rb', line 52 def write_probe! FileUtils.mkdir_p(File.dirname(probe_path)) File.write(probe_path, @probe_source) probe_path end |