]> git.madduck.net Git - puppet/sudo.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

add metadata to module
authormartin f. krafft <madduck@madduck.net>
Tue, 24 Mar 2020 00:47:31 +0000 (01:47 +0100)
committermartin f. krafft <madduck@madduck.net>
Tue, 24 Mar 2020 00:47:31 +0000 (01:47 +0100)
Gemfile [new file with mode: 0644]
Rakefile [new file with mode: 0644]
examples/init.pp [new file with mode: 0644]
metadata.json [new file with mode: 0644]
spec/classes/init_spec.rb [new file with mode: 0644]
spec/spec_helper.rb [new file with mode: 0644]

diff --git a/Gemfile b/Gemfile
new file mode 100644 (file)
index 0000000..4333d23
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,18 @@
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
+
+puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']
+gem 'metadata-json-lint'
+gem 'puppet', puppetversion
+gem 'puppetlabs_spec_helper', '>= 1.2.0'
+gem 'puppet-lint', '>= 1.0.0'
+gem 'facter', '>= 1.7.0'
+gem 'rspec-puppet'
+
+# rspec must be v2 for ruby 1.8.7
+if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
+  gem 'rspec', '~> 2.0'
+  gem 'rake', '~> 10.0'
+else
+  # rubocop requires ruby >= 1.9
+  gem 'rubocop'
+end
diff --git a/Rakefile b/Rakefile
new file mode 100644 (file)
index 0000000..df59df7
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,32 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
+require 'metadata-json-lint/rake_task'
+
+if RUBY_VERSION >= '1.9'
+  require 'rubocop/rake_task'
+  RuboCop::RakeTask.new
+end
+
+PuppetLint.configuration.send('disable_80chars')
+PuppetLint.configuration.relative = true
+PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp']
+
+desc 'Validate manifests, templates, and ruby files'
+task :validate do
+  Dir['manifests/**/*.pp'].each do |manifest|
+    sh "puppet parser validate --noop #{manifest}"
+  end
+  Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
+    sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures}
+  end
+  Dir['templates/**/*.erb'].each do |template|
+    sh "erb -P -x -T '-' #{template} | ruby -c"
+  end
+end
+
+desc 'Run lint, validate, and spec tests.'
+task :test do
+  [:lint, :validate, :spec].each do |test|
+    Rake::Task[test].invoke
+  end
+end
diff --git a/examples/init.pp b/examples/init.pp
new file mode 100644 (file)
index 0000000..23f3236
--- /dev/null
@@ -0,0 +1,12 @@
+# The baseline for module testing used by Puppet Inc. is that each manifest
+# should have a corresponding test manifest that declares that class or defined
+# type.
+#
+# Tests are then run by using puppet apply --noop (to check for compilation
+# errors and view a log of events) or by fully applying the test in a virtual
+# environment (to compare the resulting system state to the desired state).
+#
+# Learn more about module testing here:
+# https://puppet.com/docs/puppet/latest/bgtm.html#testing-your-module
+#
+include ::sudo
diff --git a/metadata.json b/metadata.json
new file mode 100644 (file)
index 0000000..412fd93
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "name": "madduck-sudo",
+  "version": "0.1.0",
+  "author": "madduck",
+  "summary": "Manage sudo settings/aliases/rules in sudoers.d files",
+  "license": "Apache-2.0",
+  "source": "https://git.madduck.net/puppet/sudo.git",
+  "project_page": "https://git.madduck.net/puppet/sudo.git/blob/HEAD:/README.md",
+  "issues_url": "mailto:patches@git.madduck.net",
+  "dependencies": [
+    {
+      "name": "puppetlabs-stdlib",
+      "version_requirement": ">= 1.0.0"
+    }
+  ],
+  "data_provider": null
+}
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb
new file mode 100644 (file)
index 0000000..b911e76
--- /dev/null
@@ -0,0 +1,6 @@
+require 'spec_helper'
+describe 'sudo' do
+  context 'with default values for all parameters' do
+    it { should contain_class('sudo') }
+  end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644 (file)
index 0000000..2c6f566
--- /dev/null
@@ -0,0 +1 @@
+require 'puppetlabs_spec_helper/module_spec_helper'