mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Make simplecov a source development dependency only (#1418)
Remove the need for downstream packaging to either require or patch out simplecov from existing files by making it an optional development dependency.
This commit is contained in:
parent
27a541bba9
commit
380b3c2096
2
.github/workflows/unit-tests.yml
vendored
2
.github/workflows/unit-tests.yml
vendored
@ -17,6 +17,8 @@ jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VAGRANT_LIBVIRT_REQUIRE_SIMPLECOV: "true"
|
||||
continue-on-error: ${{ matrix.allow_fail }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
6
Gemfile
6
Gemfile
@ -37,11 +37,9 @@ group :development do
|
||||
gem 'rexml'
|
||||
end
|
||||
|
||||
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
|
||||
gem 'mime-types', '< 3.4.0'
|
||||
end
|
||||
|
||||
gem 'pry'
|
||||
gem 'simplecov'
|
||||
gem 'simplecov-lcov'
|
||||
end
|
||||
|
||||
group :plugins do
|
||||
|
@ -1,36 +1,45 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'simplecov'
|
||||
require 'simplecov-lcov'
|
||||
# make simplecov optional
|
||||
begin
|
||||
require 'simplecov'
|
||||
require 'simplecov-lcov'
|
||||
|
||||
# patch simplecov configuration
|
||||
if ! SimpleCov::Configuration.method_defined? :branch_coverage?
|
||||
module SimpleCov
|
||||
module Configuration
|
||||
def branch_coverage?
|
||||
return false
|
||||
# patch simplecov configuration
|
||||
if ! SimpleCov::Configuration.method_defined? :branch_coverage?
|
||||
module SimpleCov
|
||||
module Configuration
|
||||
def branch_coverage?
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SimpleCov::Formatter::LcovFormatter.config do |config|
|
||||
config.report_with_single_file = true
|
||||
config.single_report_path = 'coverage/lcov.info'
|
||||
end
|
||||
|
||||
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
|
||||
[
|
||||
SimpleCov::Formatter::HTMLFormatter,
|
||||
SimpleCov::Formatter::LcovFormatter,
|
||||
]
|
||||
)
|
||||
SimpleCov.start do
|
||||
add_filter 'spec/'
|
||||
end
|
||||
rescue LoadError
|
||||
TRUTHY_VALUES = %w(t true yes y 1).freeze
|
||||
require_simplecov = ENV.fetch('VAGRANT_LIBVIRT_REQUIRE_SIMPLECOV', 'false').to_s.downcase
|
||||
if TRUTHY_VALUES.include?(require_simplecov)
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
SimpleCov::Formatter::LcovFormatter.config do |config|
|
||||
config.report_with_single_file = true
|
||||
config.single_report_path = 'coverage/lcov.info'
|
||||
end
|
||||
|
||||
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
|
||||
[
|
||||
SimpleCov::Formatter::HTMLFormatter,
|
||||
SimpleCov::Formatter::LcovFormatter,
|
||||
]
|
||||
)
|
||||
SimpleCov.start do
|
||||
add_filter 'spec/'
|
||||
end
|
||||
|
||||
require 'vagrant-libvirt'
|
||||
require 'support/environment_helper'
|
||||
require 'vagrant-spec/unit'
|
||||
|
||||
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
|
||||
|
@ -23,8 +23,6 @@ Gem::Specification.new do |s|
|
||||
s.add_development_dependency "rspec-core", ">= 3.5"
|
||||
s.add_development_dependency "rspec-expectations", ">= 3.5"
|
||||
s.add_development_dependency "rspec-mocks", ">= 3.5"
|
||||
s.add_development_dependency "simplecov"
|
||||
s.add_development_dependency "simplecov-lcov"
|
||||
|
||||
s.add_runtime_dependency 'fog-libvirt', '>= 0.6.0'
|
||||
s.add_runtime_dependency 'fog-core', '~> 2.1'
|
||||
|
Loading…
Reference in New Issue
Block a user