From 5cb39f923761d8b197631521a999fc71181bf225 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 15 Apr 2017 17:32:24 +0200 Subject: [PATCH 1/2] modulesync 0.21.0 --- .github/CONTRIBUTING.md | 4 +++ .msync.yml | 2 +- .overcommit.yml | 63 +++++++++++++++++++++++++++++++++++++++++ .rubocop.yml | 2 ++ .travis.yml | 21 ++++++++------ Gemfile | 16 +++++------ 6 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 .overcommit.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5574191a..602f324b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -98,3 +98,7 @@ If you don't want to have to recreate the virtual machine every time you can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`. + +The easiest way to debug in a docker container is to open a shell: + + docker exec -it -u root ${container_id_or_name} bash diff --git a/.msync.yml b/.msync.yml index a8e6a4ee..540f0cea 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '0.20.1' +modulesync_config_version: '0.21.0' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 00000000..31699e74 --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,63 @@ +# Managed by https://github.com/voxpupuli/modulesync_configs +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'test' + - 'rubocop' + command: [ 'bundle', 'exec', 'rake' ] diff --git a/.rubocop.yml b/.rubocop.yml index ef85ceb4..4e113f03 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,6 +9,8 @@ AllCops: - .vendor/**/* - pkg/**/* - spec/fixtures/**/* + - Gemfile + - Rakefile Lint/ConditionPosition: Enabled: True diff --git a/.travis.yml b/.travis.yml index df3c15ed..ff08653d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ sudo: false dist: trusty language: ruby cache: bundler -bundler_args: --without system_tests development before_install: - bundle -v - rm Gemfile.lock || true @@ -17,27 +16,33 @@ matrix: fast_finish: true include: - rvm: 2.1.9 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.2.6 + - rvm: 2.2.7 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.3.3 + - rvm: 2.3.4 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=test - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=rubocop - - rvm: 2.4.0 + - rvm: 2.4.1 + bundler_args: --without system_tests development env: PUPPET_VERSION="~> 4.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.4.0 + bundler_args: --without development env: BEAKER_VERSION="~> 2.51" PUPPET_VERSION="~> 4.0" CHECK=acceptance BEAKER_debug=true BEAKER_set=docker/centos-6 PUPPET_INSTALL_TYPE=agent PUPPET_INSTALL_VERSION=1.7.1 services: docker sudo: required - bundler_args: --without development - rvm: 2.4.0 + bundler_args: --without development env: BEAKER_VERSION="~> 2.51" PUPPET_VERSION="~> 4.0" CHECK=acceptance BEAKER_debug=true BEAKER_set=docker/centos-7 PUPPET_INSTALL_TYPE=agent PUPPET_INSTALL_VERSION=1.7.1 services: docker sudo: required - bundler_args: --without development branches: only: - master diff --git a/Gemfile b/Gemfile index 2270de7d..d35336cb 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.0.1', :require => false - gem 'parallel_tests', :require => false + gem 'puppetlabs_spec_helper', '~> 2.1.1', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -26,10 +25,10 @@ group :test do gem 'metadata-json-lint', :require => false gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' - gem 'puppet-strings', '~> 1.0.0', :require => false + gem 'puppet-strings', '~> 1.0', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.47.0', :require => false if RUBY_VERSION >= '2.3.0' - gem 'rubocop-rspec', '~> 1.10.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.48.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' gem 'mocha', '>= 1.2.1', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false @@ -39,9 +38,10 @@ group :test do end group :development do - gem 'travis', :require => false - gem 'travis-lint', :require => false - gem 'guard-rake', :require => false + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false + gem 'overcommit', '~> 0.39.1', :require => false end group :system_tests do From f4f1decf329230a6bb32fad3f9f1f0431909380d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 15 Apr 2017 17:32:38 +0200 Subject: [PATCH 2/2] rubocop: autofixes --- spec/defines/config_spec.rb | 1 + spec/defines/gpgkey_spec.rb | 1 + spec/defines/group_spec.rb | 1 + spec/defines/plugin_spec.rb | 3 +++ 4 files changed, 6 insertions(+) diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb index 1795c528..a179b698 100644 --- a/spec/defines/config_spec.rb +++ b/spec/defines/config_spec.rb @@ -3,6 +3,7 @@ describe 'yum::config' do context 'with no parameters' do let(:title) { 'assumeyes' } + it { is_expected.to raise_error(Puppet::PreformattedError, %r{expects a value for parameter 'ensure'}) } end diff --git a/spec/defines/gpgkey_spec.rb b/spec/defines/gpgkey_spec.rb index 246005bc..3e3e1f62 100644 --- a/spec/defines/gpgkey_spec.rb +++ b/spec/defines/gpgkey_spec.rb @@ -3,6 +3,7 @@ describe 'yum::gpgkey' do context 'with no parameters' do let(:title) { '/test-key' } + it { is_expected.to raise_error(Puppet::PreformattedError, %r{Missing params: \$content or \$source must be specified}) } end diff --git a/spec/defines/group_spec.rb b/spec/defines/group_spec.rb index 6d2512f2..ea435259 100644 --- a/spec/defines/group_spec.rb +++ b/spec/defines/group_spec.rb @@ -3,6 +3,7 @@ describe 'yum::group' do context 'with no parameters' do let(:title) { 'Core' } + it { is_expected.to compile.with_all_deps } it { is_expected.to contain_exec("yum-groupinstall-#{title}").with_command("yum -y groupinstall 'Core'") } end diff --git a/spec/defines/plugin_spec.rb b/spec/defines/plugin_spec.rb index fdf64d15..bb2e6f71 100644 --- a/spec/defines/plugin_spec.rb +++ b/spec/defines/plugin_spec.rb @@ -8,6 +8,7 @@ context 'with no parameters' do let(:title) { 'fastestmirror' } + it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package("#{prefix}-#{title}").with_ensure('present') } end @@ -15,6 +16,7 @@ context 'when explicitly set to install' do let(:title) { 'fastestmirror' } let(:params) { { ensure: 'present' } } + it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package("#{prefix}-#{title}").with_ensure('present') } end @@ -22,6 +24,7 @@ context 'when explicitly set to remove' do let(:title) { 'fastestmirror' } let(:params) { { ensure: 'absent' } } + it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package("#{prefix}-#{title}").with_ensure('absent') } end