Showing with 3,996 additions and 1 deletion.
  1. +6 −0 .fixtures.yml
  2. +4 −0 .gitattributes
  3. +24 −0 .gitignore
  4. +24 −0 .pdkignore
  5. +2 −0 .rspec
  6. +120 −0 .rubocop.yml
  7. +41 −0 .sync.yml
  8. +41 −0 .travis.yml
  9. +1 −0 .yardopts
  10. +12 −0 CHANGELOG.md
  11. +88 −0 Gemfile
  12. +42 −1 README.md
  13. +180 −0 REFERENCE.md
  14. +75 −0 Rakefile
  15. +298 −0 lib/puppet/provider/cron/crontab.rb
  16. +469 −0 lib/puppet/type/cron.rb
  17. +24 −0 locales/config.yaml
  18. +43 −0 locales/puppetlabs-cron_core.pot
  19. +83 −0 metadata.json
  20. +19 −0 spec/acceptance/nodesets/default.yml
  21. +63 −0 spec/acceptance/tests/resource/cron/should_allow_changing_parameters_spec.rb
  22. +32 −0 spec/acceptance/tests/resource/cron/should_be_idempotent_spec.rb
  23. +31 −0 spec/acceptance/tests/resource/cron/should_create_cron_spec.rb
  24. +33 −0 spec/acceptance/tests/resource/cron/should_match_existing_spec.rb
  25. +35 −0 spec/acceptance/tests/resource/cron/should_remove_cron_spec.rb
  26. +41 −0 spec/acceptance/tests/resource/cron/should_remove_leading_and_trailing_whitespace_spec.rb
  27. +34 −0 spec/acceptance/tests/resource/cron/should_remove_matching_spec.rb
  28. +39 −0 spec/acceptance/tests/resource/cron/should_update_existing_spec.rb
  29. +8 −0 spec/default_facts.yml
  30. +19 −0 spec/fixtures/integration/provider/cron/crontab/create_normal_entry
  31. +18 −0 spec/fixtures/integration/provider/cron/crontab/create_special_entry
  32. +15 −0 spec/fixtures/integration/provider/cron/crontab/crontab_user1
  33. +4 −0 spec/fixtures/integration/provider/cron/crontab/crontab_user2
  34. +17 −0 spec/fixtures/integration/provider/cron/crontab/crontab_user3
  35. +13 −0 spec/fixtures/integration/provider/cron/crontab/modify_entry
  36. +15 −0 spec/fixtures/integration/provider/cron/crontab/moved_cronjob_input1
  37. +6 −0 spec/fixtures/integration/provider/cron/crontab/moved_cronjob_input2
  38. +8 −0 spec/fixtures/integration/provider/cron/crontab/purged
  39. +12 −0 spec/fixtures/integration/provider/cron/crontab/remove_named_resource
  40. +14 −0 spec/fixtures/integration/provider/cron/crontab/remove_unnamed_resource
  41. +15 −0 spec/fixtures/integration/provider/cron/crontab/unspecialized
  42. +272 −0 spec/fixtures/unit/provider/cron/crontab/single_line.yaml
  43. +3 −0 spec/fixtures/unit/provider/cron/crontab/vixie_header.txt
  44. +6 −0 spec/fixtures/unit/provider/cron/parsed/managed
  45. +9 −0 spec/fixtures/unit/provider/cron/parsed/simple
  46. +237 −0 spec/integration/provider/cron/crontab_spec.rb
  47. +112 −0 spec/lib/puppet_spec/compiler.rb
  48. +112 −0 spec/lib/puppet_spec/files.rb
  49. +44 −0 spec/spec_helper.rb
  50. +40 −0 spec/spec_helper_acceptance.rb
  51. +17 −0 spec/spec_helper_local.rb
  52. +205 −0 spec/unit/provider/cron/crontab_spec.rb
  53. +335 −0 spec/unit/provider/cron/parsed_spec.rb
  54. +536 −0 spec/unit/type/cron_spec.rb
6 changes: 6 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file can be used to install module dependencies for unit testing
# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details
---
fixtures:
forge_modules:
# stdlib: "puppetlabs/stdlib"
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.git/
.*.sw[op]
.metadata
.yardoc
.yardwarns
*.iml
/.bundle/
/.idea/
/.vagrant/
/coverage/
/bin/
/doc/
/Gemfile.local
/Gemfile.lock
/junit/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/tmp/
/vendor/
/convert_report.txt
/update_report.txt
.DS_Store
24 changes: 24 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.git/
.*.sw[op]
.metadata
.yardoc
.yardwarns
*.iml
/.bundle/
/.idea/
/.vagrant/
/coverage/
/bin/
/doc/
/Gemfile.local
/Gemfile.lock
/junit/
/log/
/pkg/
/spec/fixtures/manifests/
/spec/fixtures/modules/
/tmp/
/vendor/
/convert_report.txt
/update_report.txt
.DS_Store
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format documentation
120 changes: 120 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
require: rubocop-rspec
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Include:
- "./**/*.rb"
Exclude:
- bin/*
- ".vendor/**/*"
- "**/Gemfile"
- "**/Rakefile"
- pkg/**/*
- spec/fixtures/**/*
- vendor/**/*
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Exclude:
- spec/acceptance/**/*.rb
RSpec/HookArgument:
Description: Prefer explicit :each argument, matching existing module's style
EnforcedStyle: each
Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
be consistent then.
EnforcedStyle: braces_for_chaining
Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact
Style/EmptyElse:
Description: Enforce against empty else clauses, but allow `nil` for clarity.
EnforcedStyle: empty
Style/FormatString:
Description: Following the main puppet project's style, prefer the % format format.
EnforcedStyle: percent
Style/FormatStringToken:
Description: Following the main puppet project's style, prefer the simpler template
tokens over annotated ones.
EnforcedStyle: template
Style/Lambda:
Description: Prefer the keyword for easier discoverability.
EnforcedStyle: literal
Style/RegexpLiteral:
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
EnforcedStyle: percent_r
Style/TernaryParentheses:
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
on complex expressions for better readability, but seriously consider breaking
it up.
EnforcedStyle: require_parentheses_when_complex
Style/TrailingCommaInArguments:
Description: Prefer always trailing comma on multiline argument lists. This makes
diffs, and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/TrailingCommaInLiteral:
Description: Prefer always trailing comma on multiline literals. This makes diffs,
and re-ordering nicer.
EnforcedStyleForMultiline: comma
Style/SymbolArray:
Description: Using percent style obscures symbolic intent of array's contents.
EnforcedStyle: brackets
RSpec/NamedSubject:
Enabled: false
RSpec/MessageSpies:
EnforcedStyle: receive
Style/Documentation:
Exclude:
- lib/puppet/parser/functions/**/*
- spec/**/*
Style/WordArray:
EnforcedStyle: brackets
Style/CollectionMethods:
Enabled: true
Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
RSpec/DescribeClass:
Enabled: false
RSpec/ExampleLength:
Enabled: false
RSpec/MessageExpectation:
Enabled: false
RSpec/MultipleExpectations:
Enabled: false
RSpec/NestedGroups:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/SymbolProc:
Enabled: false
41 changes: 41 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
.rubocop.yml:
default_configs:
RSpec/NamedSubject:
Enabled: false

Gemfile:
required:
':system_tests':
- gem: 'puppet-module-posix-system-r#{minor_version}'
platforms: ruby
- gem: 'puppet-module-win-system-r#{minor_version}'
platforms:
- mswin
- mingw
- x64_mingw
- gem: beaker
version: '~> 3.34'
from_env: BEAKER_VERSION
- gem: beaker-abs
from_env: BEAKER_ABS_VERSION
version: '~> 0.5'
- gem: beaker-pe
- gem: beaker-hostgenerator
from_env: BEAKER_HOSTGENERATOR_VERSION
- gem: beaker-rspec
from_env: BEAKER_RSPEC_VERSION
- gem: beaker-puppet
from_env: BEAKER_PUPPET_VERSION
version: '~> 0.14'

.gitlab-ci.yml:
delete: true

appveyor.yml:
delete: true

.travis.yml:
remove_includes:
- env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
rvm: 2.1.9
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
sudo: false
dist: trusty
language: ruby
cache: bundler
before_install:
- bundle -v
- rm -f Gemfile.lock
- gem update --system
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.4.4
env:
global:
- BEAKER_PUPPET_COLLECTION=puppet5 PUPPET_GEM_VERSION="~> 5.0"
matrix:
fast_finish: true
include:
-
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: CHECK=parallel_spec
branches:
only:
- master
- /^v\d/
notifications:
email: false
deploy:
provider: puppetforge
user: puppet
password:
secure: ""
on:
tags: true
all_branches: true
condition: "$DEPLOY_TO_FORGE = yes"
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--markup markdown
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## Release [1.0.0] 2018-08-30

**Summary**
This is the initial release of the extracted cron module.

[1.0.0]: https://github.com/puppetlabs/puppetlabs-cron_core/releases/tag/1.0.0
88 changes: 88 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

def location_for(place_or_version, fake_version = nil)
if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
elsif place_or_version =~ %r{\Afile:\/\/(.*)}
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
else
[place_or_version, { require: false }]
end
end

def gem_type(place_or_version)
if place_or_version =~ %r{\Agit[:@]}
:git
elsif !place_or_version.nil? && place_or_version.start_with?('file:')
:file
else
:gem
end
end

ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '<= 2.0.4', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.4.4')
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.34')
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.5')
gem "beaker-pe", require: false
gem "beaker-hostgenerator"
gem "beaker-rspec"
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || '~> 0.14')
end

puppet_version = ENV['PUPPET_GEM_VERSION']
puppet_type = gem_type(puppet_version)
facter_version = ENV['FACTER_GEM_VERSION']
hiera_version = ENV['HIERA_GEM_VERSION']

gems = {}

gems['puppet'] = location_for(puppet_version)

# If facter or hiera versions have been specified via the environment
# variables

gems['facter'] = location_for(facter_version) if facter_version
gems['hiera'] = location_for(hiera_version) if hiera_version

if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
# If we're using a Puppet gem on Windows which handles its own win32-xxx gem
# dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
gems['win32-dir'] = ['<= 0.4.9', require: false]
gems['win32-eventlog'] = ['<= 0.6.5', require: false]
gems['win32-process'] = ['<= 0.7.5', require: false]
gems['win32-security'] = ['<= 0.2.5', require: false]
gems['win32-service'] = ['0.8.8', require: false]
end

gems.each do |gem_name, gem_params|
gem gem_name, *gem_params
end

# Evaluate Gemfile.local and ~/.gemfile if they exist
extra_gemfiles = [
"#{__FILE__}.local",
File.join(Dir.home, '.gemfile'),
]

extra_gemfiles.each do |gemfile|
if File.file?(gemfile) && File.readable?(gemfile)
eval(File.read(gemfile), binding)
end
end
# vim: syntax=ruby
Loading