From 8fe0a33f151a13687ce18222a7f3b45f6539d2e7 Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Mon, 20 Jun 2016 20:23:30 -0700 Subject: [PATCH] Initial commit This code came from http://git.openstack.org/cgit/openstack/puppet-openstack_spec_helper/ and was modified for infra's use. The gems specified in gemspec are current with what infra is currently using. Change-Id: I06e47d4af32f30e4504ee67257923a4596725d0f --- .gitignore | 1 + CHANGELOG.md | 6 +++ LICENSE | 14 +++++++ README.md | 16 +++++++ .../version.rb | 5 +++ puppet-openstack_infra_spec_helper.gemspec | 42 +++++++++++++++++++ run_unit_tests.sh | 40 ++++++++++++++++++ 7 files changed, 124 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 lib/puppet-openstack_infra_spec_helper/version.rb create mode 100644 puppet-openstack_infra_spec_helper.gemspec create mode 100755 run_unit_tests.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c111b33 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.gem diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..847ac64 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +Mon Jun 20 2016 + +Copied from puppet-openstack_spec_helper + +Release notes are published on +[docs.openstack.org](http://docs.openstack.org/releasenotes/puppet-openstack_spec_helper/). diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e8ecb1e --- /dev/null +++ b/LICENSE @@ -0,0 +1,14 @@ +Copyright 2016 IBM +Copyright 2012 OpenStack Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6d47b50 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +Puppet-OpenStack-Infra Spec Helper +================================== + +This gem provides transitive dependencies for the OpenStack Puppet Modules +[OpenStack Infra Modules](http://docs.openstack.org/infra/system-config/sysadmin.html). + +Usage +----- + +Include this gem in your Gemfile: + +``` +gem 'puppet-openstack_infra_spec_helper', + :git => 'https://git.openstack.org/openstack-infra/puppet-openstack_infra_spec_helper', + :require => false +``` diff --git a/lib/puppet-openstack_infra_spec_helper/version.rb b/lib/puppet-openstack_infra_spec_helper/version.rb new file mode 100644 index 0000000..624bb12 --- /dev/null +++ b/lib/puppet-openstack_infra_spec_helper/version.rb @@ -0,0 +1,5 @@ +module PuppetOpenstackInfraSpecHelper + module Version + STRING = '0.0.1' + end +end diff --git a/puppet-openstack_infra_spec_helper.gemspec b/puppet-openstack_infra_spec_helper.gemspec new file mode 100644 index 0000000..92bb07a --- /dev/null +++ b/puppet-openstack_infra_spec_helper.gemspec @@ -0,0 +1,42 @@ +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'puppet-openstack_infra_spec_helper/version' + +Gem::Specification.new do |spec| + spec.name = "puppet-openstack_infra_spec_helper" + spec.version = PuppetOpenstackInfraSpecHelper::Version::STRING + spec.authors = ["OpenStack Infrastructure Team"] + spec.description = %q{Helpers for module testing} + spec.summary = %q{Puppet-OpenStack-Infra spec helper} + spec.homepage = "" + spec.license = "Apache-2.0" + + spec.files = `git ls-files`.split($/) + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] + + # dependencies that are needed to run puppet-lint + spec.add_dependency 'puppetlabs_spec_helper' + spec.add_dependency 'metadata-json-lint' + spec.add_dependency 'puppet-lint-absolute_classname-check' + spec.add_dependency 'puppet-lint-absolute_template_path' + spec.add_dependency 'puppet-lint-trailing_newline-check' + + spec.add_dependency 'puppet-lint-unquoted_string-check' + spec.add_dependency 'puppet-lint-leading_zero-check' + spec.add_dependency 'puppet-lint-variable_contains_upcase' + spec.add_dependency 'puppet-lint-spaceship_operator_without_tag-check' + spec.add_dependency 'puppet-lint-undef_in_function-check' + spec.add_dependency 'json' + spec.add_dependency 'netaddr' + spec.add_dependency 'webmock' + # google-api-client requires Ruby version ~> 2.0 + spec.add_dependency 'google-api-client', ['0.9.4'] + # latest specinfra broke us, we pin it until we figure what's wrong. + spec.add_dependency 'specinfra', ['2.59.0'] + + # dependencies that are needed to run beaker-rspec + spec.add_dependency 'beaker-rspec' + spec.add_dependency 'beaker-puppet_install_helper' +end diff --git a/run_unit_tests.sh b/run_unit_tests.sh new file mode 100755 index 0000000..4f76a2e --- /dev/null +++ b/run_unit_tests.sh @@ -0,0 +1,40 @@ +#!/bin/bash -ex +# Copyright 2015 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +export SCRIPT_DIR=$(cd `dirname $0` && pwd -P) + +mkdir .bundled_gems +export GEM_HOME=`pwd`/.bundled_gems + +# Prove that gem build works +gem build puppet-openstack_infra_spec_helper.gemspec + +# use puppet-openstackci to test the gem +if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then + /usr/zuul-env/bin/zuul-cloner --cache-dir /opt/git \ + git://git.openstack.org openstack-infra/puppet-openstackci +else + git clone git://git.openstack.org/openstack-infra/puppet-openstackci openstack-infra/puppet-openstackci +fi +cd openstack-infra/puppet-openstackci + +# Modify Gemfile to use local library and not the one on git +# so we can actually test the current state of the gem. +sed -i "s/.*git => 'https:\/\/git.openstack.org\/openstack-infra\/puppet-openstack_infra_spec_helper.*/ :path => '..\/..',/" Gemfile + +# Install dependencies +gem install bundler --no-rdoc --no-ri --verbose + +$GEM_HOME/bin/bundle install