Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Setting ownership to the modules team
* @puppetlabs/modules
* @puppetlabs/modules @puppetlabs/pdk
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Gemfile.local

# rspec failure tracking
.rspec_status

Gemfile.lock
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
os: linux
language: ruby
cache: bundler
rvm:
- 2.5.3
before_install: gem install bundler -v 2.1.4
jobs:
include:
- rvm: 2.5.7
env:
- SIMPLECOV=yes
before_install: gem install bundler -v 2.1.4
- rvm: 2.4.9
before_install: gem install bundler -v 2.1.4
- rvm: 2.1.9
script: "bundle exec rake spec # don't try to run rubocop on ancient ruby"
10 changes: 8 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ gemspec

gem 'rake', '~> 12.0'
gem 'rspec', '~> 3.0'
gem 'rubocop'
gem 'rubocop-rspec'
if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')
gem 'rubocop', '~> 0.68'
gem 'rubocop-rspec', '~> 1.38'

gem 'codecov', '~> 0.1'
gem 'simplecov', '~> 0.18'
gem 'simplecov-console', '~> 0.6'
end

# Evaluate Gemfile.local and ~/.gemfile if they exist
extra_gemfiles = [
Expand Down
17 changes: 12 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
begin
# make rubocop optional to deal with ruby 2.1
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:rubocop) do |task|
task.options = %w[-D -S -E]
end

RuboCop::RakeTask.new(:rubocop) do |task|
task.options = %w[-D -S -E]
task default: [:rubocop]
rescue LoadError => e
puts "Can't load 'rubocop/rake_task': #{e.inspect}"
end

task default: [:rubocop, :spec]
RSpec::Core::RakeTask.new(:spec)

task default: [:spec]
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
install:
- set PATH=C:\Ruby25-x64\bin;%PATH%
- set SIMPLECOV=yes
- gem install bundler -v 2.1.4
- bundle -v
- bundle install --retry 2
Expand Down
2 changes: 1 addition & 1 deletion puppet-modulebuilder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.email = ['sheena@puppet.com', 'https://puppetlabs.github.io/iac/']
spec.summary = 'A gem to set up puppet-modulebuilder'
spec.homepage = 'https://github.com/puppetlabs/puppet-modulebuilder'
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
spec.required_ruby_version = Gem::Requirement.new('>= 2.1.0')

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/puppetlabs/puppet-modulebuilder'
Expand Down
35 changes: 35 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# frozen_string_literal: true

if ENV['SIMPLECOV'] == 'yes'
begin
require 'simplecov'
require 'simplecov-console'
require 'codecov'

SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console,
SimpleCov::Formatter::Codecov,
]
SimpleCov.start do
track_files 'lib/**/*.rb'
add_filter '/spec'

# do not track vendored files
add_filter '/vendor'
add_filter '/.vendor'

# do not track version file, as it is loaded before simplecov initialises and therefore is never gonna be tracked correctly
add_filter 'lib/puppet/modulebuilder/version.rb'

# do not track gitignored files
# this adds about 4 seconds to the coverage check
# this could definitely be optimized
add_filter do |f|
# system returns true if exit status is 0, which with git-check-ignore means file is ignored
system("git check-ignore --quiet #{f.filename}")
end
end
rescue LoadError
raise 'Add the simplecov, simplecov-console, codecov gems to Gemfile to enable this task'
end
end

require 'puppet/modulebuilder'

RSpec.configure do |config|
Expand Down