From f24cca2ac8d138aae71c019a9bf6f311395f562d Mon Sep 17 00:00:00 2001 From: James Shubin Date: Fri, 10 Oct 2014 14:49:44 -0400 Subject: Infra update for puppet-gluster... w00t, c-i, and automatic pushing. --- .gitignore | 2 +- .travis.yml | 16 ++++++++++++++++ Gemfile | 11 +++++++++++ Makefile | 13 +++++++++++-- Modulefile | 12 ------------ README | 34 +--------------------------------- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++++- Rakefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ VERSION | 1 - metadata.json | 15 +++++++++++++++ spec/spec_helper.rb | 18 ++++++++++++++++++ 11 files changed, 164 insertions(+), 50 deletions(-) create mode 100644 .travis.yml create mode 100644 Gemfile delete mode 100644 Modulefile mode change 120000 => 100644 README.md create mode 100644 Rakefile delete mode 100644 VERSION create mode 100644 metadata.json create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore index 729179b..336fb58 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ pkg/ docs/ hacking/ rpmbuild/ -screencasts/ +.pmtignore diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..354f4ef --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: ruby +rvm: 1.8.7 +notifications: + email: + - travis-ci@shubin.ca +# TODO: do a full rake test once warnings are all gone! +#script: 'bundle exec rake test' +script: 'bundle exec rake syntax' +env: +# - PUPPET_VERSION=2.7.26 + - PUPPET_VERSION=3.0.2 + - PUPPET_VERSION=3.1.1 + - PUPPET_VERSION=3.2.4 + - PUPPET_VERSION=3.3.2 + - PUPPET_VERSION=3.4.3 + diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..07dd7f4 --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +source 'https://rubygems.org' + +puppet_version = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.0'] + +gem 'rake' +gem 'puppet', puppet_version +gem 'puppet-lint' # style things, eg: tabs vs. spaces +gem 'rspec-puppet', :git => 'https://github.com/rodjek/rspec-puppet.git' +gem 'puppet-syntax' # syntax checking +gem 'puppetlabs_spec_helper' + diff --git a/Makefile b/Makefile index bb98acf..7c2c651 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -.PHONY: all docs rpm srpm spec tar upload upload-sources upload-srpms upload-rpms +.PHONY: all push docs test rpm srpm spec tar upload upload-sources upload-srpms upload-rpms .SILENT: # version of the program -VERSION := $(shell cat VERSION) +VERSION := $(shell gjs -c "print(`cat metadata.json`['version'])") RELEASE = 1 SPEC = rpmbuild/SPECS/puppet-gluster.spec SOURCE = rpmbuild/SOURCES/puppet-gluster-$(VERSION).tar.bz2 @@ -30,11 +30,20 @@ REMOTE_PATH = 'purpleidea/puppet-gluster' all: docs rpm +push: + # use blacksmith to push module to forge + git checkout master && rake module:push + docs: puppet-gluster-documentation.pdf puppet-gluster-documentation.pdf: DOCUMENTATION.md pandoc DOCUMENTATION.md -o 'puppet-gluster-documentation.pdf' +test: + # TODO: avoid exiting with non-zero when there are only warnings? + #rake syntax + rake test + # # aliases # diff --git a/Modulefile b/Modulefile deleted file mode 100644 index 2eaa0ab..0000000 --- a/Modulefile +++ /dev/null @@ -1,12 +0,0 @@ -name 'purpleidea-gluster' -author 'James Shubin' -license 'GNU Affero General Public License, Version 3.0+' -summary 'GlusterFS module by James' -description 'A Puppet module for GlusterFS' -project_page 'https://github.com/purpleidea/puppet-gluster/' -source 'https://ttboj.wordpress.com/' -version '0.0.4' - -## Add dependencies, if any: -# dependency 'username/name', '>= 1.2.0' - diff --git a/README b/README index c9482dd..91bb599 100644 --- a/README +++ b/README @@ -1,34 +1,2 @@ -This is puppet-gluster a puppet module for gluster. - -Please read the INSTALL file for instructions on getting this installed. -Look in the examples/ folder for usage. If none exist, please contribute one! -This code may be a work in progress. The interfaces may change without notice. -Patches are welcome, but please be patient. They are best received by email. -Please ping me if you have big changes in mind, before you write a giant patch. - -Module specific notes: -* This is _the_ puppet module for gluster. Accept no imitations! -* All the participating nodes, need to have an identical puppet-gluster config. -* Using gluster::simple is probably the best way to try this out. -* This is easily deployed with vagrant. See the vagrant/ directory! -* You can use less of the available resources, if you only want to manage some. -* You can get CentOS and RHEL rpms from: - * http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/ or: - * http://repos.fedorapeople.org/repos/kkeithle/glusterfs/epel-6/x86_64/ -* Documentation is now available! Please report grammar and spelling bugs. - -Dependencies: -* puppetlabs-stdlib (required) -* puppet-module-data (optional, puppet >= 3.0.0) -* my puppet-common module (optional) -* my puppet-shorewall module (optional) -* my puppet-keepalived module (optional) -* my puppet-puppet module (optional) -* my puppet-yum module (optional) -* gluster packages (see above notes) -* pandoc (for building a pdf of the documentation) - - -Happy hacking, -James Shubin , https://ttboj.wordpress.com/ +Please see README.md diff --git a/README.md b/README.md deleted file mode 120000 index fc84f4f..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -DOCUMENTATION.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b4a0e3c --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# *puppet-gluster*: a puppet module for GlusterFS + +[![Build Status](https://secure.travis-ci.org/purpleidea/puppet-gluster.png)](http://travis-ci.org/purpleidea/puppet-gluster) + +## Documentation: +Please see: [DOCUMENTATION.md](DOCUMENTATION.md) or [puppet-gluster-documentation.pdf](puppet-gluster-documentation.pdf). + +## Installation: +Please read the [INSTALL](INSTALL) file for instructions on getting this installed. + +## Examples: +Please look in the [examples/](examples/) folder for usage. If none exist, please contribute one! + +## Module specific notes: +* This is _the_ puppet module for gluster. Accept no imitations! +* All the participating nodes, need to have an identical puppet-gluster config. +* Using gluster::simple is probably the best way to try this out. +* This is easily deployed with vagrant. See the [vagrant/](vagrant/) directory! +* You can use less of the available resources, if you only want to manage some. +* You can get CentOS and RHEL rpms from: +** http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/ or: +** http://repos.fedorapeople.org/repos/kkeithle/glusterfs/epel-6/x86_64/ +* Documentation is now available! Please report grammar and spelling bugs. + +## Dependencies: +* [puppetlabs-stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) (required) +* [puppet-module-data](https://github.com/ripienaar/puppet-module-data/) (optional, puppet >= 3.0.0) +* my [puppet-common](https://github.com/purpleidea/puppet-common) module (optional) +* my [puppet-shorewall](https://github.com/purpleidea/puppet-shorewall) module (optional) +* my [puppet-keepalived](https://github.com/purpleidea/puppet-keepalived) module (optional) +* my [puppet-puppet](https://github.com/purpleidea/puppet-puppet) module (optional) +* my [puppet-yum](https://github.com/purpleidea/puppet-yum) module (optional) +* gluster packages (see above notes) +* pandoc (for building a pdf of the documentation) + +## Patches: +This code may be a work in progress. The interfaces may change without notice. +Patches are welcome, but please be patient. They are best received by email. +Please ping me if you have big changes in mind, before you write a giant patch. + +## + +Happy hacking! + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..68a36ca --- /dev/null +++ b/Rakefile @@ -0,0 +1,47 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' + +# These two gems aren't always present, for instance +# on Travis with --without development +begin + require 'puppet_blacksmith/rake_tasks' +rescue LoadError +end + +PuppetLint.configuration.relative = true +PuppetLint.configuration.send('disable_2sp_soft_tabs') +PuppetLint.configuration.send('disable_hard_tabs') +PuppetLint.configuration.send('disable_arrow_alignment') +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" +PuppetLint.configuration.fail_on_warnings = true + +# Forsake support for Puppet 2.6.2 for the benefit of cleaner code. +# http://puppet-lint.com/checks/class_parameter_defaults/ +PuppetLint.configuration.send('disable_class_parameter_defaults') +# http://puppet-lint.com/checks/class_inherits_from_params_class/ +PuppetLint.configuration.send('disable_class_inherits_from_params_class') + +exclude_paths = [ + "pkg/**/*", + "vendor/**/*", + "spec/**/*", + "tmp/**/*", + "vagrant/**/*", # TODO: remove this, once we update vagrant/ to puppet4 +] +PuppetLint.configuration.ignore_paths = exclude_paths +PuppetSyntax.exclude_paths = exclude_paths + +desc 'Run acceptance tests' +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end + +desc 'Run syntax, lint, and spec tests.' +task :test => [ + :syntax, + :lint, + :spec, +] + diff --git a/VERSION b/VERSION deleted file mode 100644 index 81340c7..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.4 diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..f19b743 --- /dev/null +++ b/metadata.json @@ -0,0 +1,15 @@ +{ + "name": "purpleidea-gluster", + "version": "0.0.5", + "author": "James Shubin", + "summary": "A Puppet module for GlusterFS", + "license": "GNU Affero General Public License, Version 3.0+", + "source": "https://github.com/purpleidea/puppet-gluster/", + "project_page": "https://github.com/purpleidea/puppet-gluster/", + "issues_url": null, + "description": "UNKNOWN", + "dependencies": [ + { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.0.0" } + ] +} + diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..b51de3a --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,18 @@ +dir = File.expand_path(File.dirname(__FILE__)) +$LOAD_PATH.unshift File.join(dir, 'lib') + +require 'mocha' +require 'puppet' +require 'rspec' +require 'spec/autorun' + +Spec::Runner.configure do |config| + config.mock_with :mocha +end + +# We need this because the RAL uses 'should' as a method. This +# allows us the same behaviour but with a different method name. +class Object + alias :must :should +end + -- cgit