Sha256: 7778ae0260e047c3b42b884056c4577261b4970c326ed984eb59335fca477bae

Contents?: true

Size: 1.38 KB

Versions: 45

Compression:

Stored size: 1.38 KB

Contents

# This is not a normal module/class.  It contains code to be run by bin/fig and
# bin/fig-debug when doing coverage.

# Depends upon setup done by spec/spec_helper.rb.
if ! ENV['FIG_COVERAGE_RUN_COUNT'] || ! ENV['FIG_COVERAGE_ROOT_DIRECTORY']
  $stderr.puts \
    'FIG_COVERAGE_RUN_COUNT or FIG_COVERAGE_ROOT_DIRECTORY not set. Cannot do coverage correctly.'
  exit 1
end

require 'simplecov'

# Normal load of .simplecov does not work because SimpleCov assumes that
# everything is relative to the current directory.  The manipulation of
# SimpleCov.root below takes care of most things, but that doesn't affect
# .simplecov handling done in the "require 'simplecov'" above.
load File.expand_path(
  File.join(ENV['FIG_COVERAGE_ROOT_DIRECTORY'], '.simplecov')
)

# We may run the identical fig command-line multiple times, so we need to give
# additional value to make the run name unique.
SimpleCov.command_name(
  "fig run #{ENV['FIG_COVERAGE_RUN_COUNT']} (#{ARGV.join(' ')})"
)
SimpleCov.root ENV['FIG_COVERAGE_ROOT_DIRECTORY']

SimpleCov.at_exit do
  # Have to invoke result() in order to get coverage data saved.
  #
  # Default at_exit() further invokes format():
  #
  #    1) We save time by not doing it on each fig run and let the rspec run
  #       handle that.
  #    2) The formatter emits a message to stdout, which screws up tests of
  #       the fig output.
  SimpleCov.result
end

SimpleCov.start

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
fig-1.23.0 lib/fig/command/coverage_support.rb
fig-1.22.1.beta.1 lib/fig/command/coverage_support.rb
fig-1.22.0 lib/fig/command/coverage_support.rb
fig-1.21.1.beta.2 lib/fig/command/coverage_support.rb
fig-1.21.1.beta.1 lib/fig/command/coverage_support.rb
fig-1.21.0 lib/fig/command/coverage_support.rb
fig-1.20.1.beta.1 lib/fig/command/coverage_support.rb
fig-1.20.0 lib/fig/command/coverage_support.rb
fig-1.19.0 lib/fig/command/coverage_support.rb
fig-1.18.0 lib/fig/command/coverage_support.rb
fig-1.17.0 lib/fig/command/coverage_support.rb
fig-1.16.1.beta.1 lib/fig/command/coverage_support.rb
fig-1.16.0 lib/fig/command/coverage_support.rb
fig-1.15.1.beta.2 lib/fig/command/coverage_support.rb
fig-1.15.1.beta.1 lib/fig/command/coverage_support.rb
fig-1.15.0 lib/fig/command/coverage_support.rb
fig-1.14.0 lib/fig/command/coverage_support.rb
fig-1.13.0 lib/fig/command/coverage_support.rb
fig-1.12.0 lib/fig/command/coverage_support.rb
fig-1.11.0 lib/fig/command/coverage_support.rb