From cf9ea1857746d1af373e28f5f0ae6c5d28b2d845 Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Sat, 8 Jun 2013 19:33:16 +0200 Subject: [PATCH] Use puppetlabs_spec_helper. Add Modulefile to push to the forge --- .fixtures.yml | 3 + .gitignore | 10 +++- Gemfile | 12 ++-- Gemfile.lock | 66 ++++++++++++++------- Modulefile | 9 +++ README.md | 5 +- Rakefile | 23 +++---- spec/classes/init_spec.rb | 4 +- spec/fixtures/manifests/site.pp | 9 --- spec/fixtures/modules/artifactory/manifests | 1 - spec/spec_helper.rb | 9 +-- 11 files changed, 89 insertions(+), 62 deletions(-) create mode 100644 .fixtures.yml create mode 100644 Modulefile delete mode 100644 spec/fixtures/manifests/site.pp delete mode 120000 spec/fixtures/modules/artifactory/manifests diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..21be801 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,3 @@ +fixtures: + symlinks: + artifactory: "#{source_dir}" diff --git a/.gitignore b/.gitignore index 1176b37..d77616b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ -/.rvmrc +.idea +.rvmrc +.project +.librarian/ +.tmp/ +pkg/ +doc/ +spec/fixtures/ +.vagrant/ diff --git a/Gemfile b/Gemfile index eca2e69..30db2d3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,10 @@ -source :rubygems +source 'https://rubygems.org' group :rake do - gem 'puppet', '2.7.12' - gem 'rspec-puppet', '0.1.2' - gem 'rake', '0.9.2.2' - gem 'puppet-lint', '0.1.12' + gem 'puppet', '>=2.7.20' + gem 'rspec-puppet', '>=0.1.3' + gem 'rake', '>=0.9.2.2' + gem 'puppet-lint', '>=0.1.12' + gem 'puppetlabs_spec_helper' + gem 'puppet-blacksmith', '>=1.0.5' end diff --git a/Gemfile.lock b/Gemfile.lock index ec7c1e6..cd5e8c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,28 +1,54 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: - diff-lcs (1.1.3) - facter (1.6.8) - puppet (2.7.12) - facter (>= 1.5.1) - puppet-lint (0.1.12) - rake (0.9.2.2) - rspec (2.10.0) - rspec-core (~> 2.10.0) - rspec-expectations (~> 2.10.0) - rspec-mocks (~> 2.10.0) - rspec-core (2.10.0) - rspec-expectations (2.10.0) - diff-lcs (~> 1.1.3) - rspec-mocks (2.10.1) - rspec-puppet (0.1.2) + diff-lcs (1.2.4) + facter (1.7.1) + hiera (1.2.1) + json_pure + json_pure (1.8.0) + metaclass (0.0.1) + mime-types (1.23) + mocha (0.14.0) + metaclass (~> 0.0.1) + nokogiri (1.5.10) + puppet (3.2.1) + facter (~> 1.6) + hiera (~> 1.0) + rgen (~> 0.6) + puppet-blacksmith (1.0.5) + nokogiri + puppet (>= 2.7.16) + puppetlabs_spec_helper (>= 0.3.0) + rake + rest-client + puppet-lint (0.3.2) + puppetlabs_spec_helper (0.4.1) + mocha (>= 0.10.5) + rake + rspec (>= 2.9.0) + rspec-puppet (>= 0.1.1) + rake (10.0.4) + rest-client (1.6.7) + mime-types (>= 1.16) + rgen (0.6.2) + rspec (2.13.0) + rspec-core (~> 2.13.0) + rspec-expectations (~> 2.13.0) + rspec-mocks (~> 2.13.0) + rspec-core (2.13.1) + rspec-expectations (2.13.0) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.13.1) + rspec-puppet (0.1.6) rspec PLATFORMS ruby DEPENDENCIES - puppet (= 2.7.12) - puppet-lint (= 0.1.12) - rake (= 0.9.2.2) - rspec-puppet (= 0.1.2) + puppet (>= 2.7.20) + puppet-blacksmith (>= 1.0.5) + puppet-lint (>= 0.1.12) + puppetlabs_spec_helper + rake (>= 0.9.2.2) + rspec-puppet (>= 0.1.3) diff --git a/Modulefile b/Modulefile new file mode 100644 index 0000000..535b418 --- /dev/null +++ b/Modulefile @@ -0,0 +1,9 @@ +name 'maestrodev-artifactory' +version '1.0.0' + +author 'maestrodev' +license 'Apache License, Version 2.0' +project_page 'http://github.com/maestrodev/puppet-artifactory' +source 'http://github.com/maestrodev/puppet-artifactory' +summary 'A really simple module to install Artifactory' +description 'Installs Artifactory package and service' diff --git a/README.md b/README.md index 736d1e3..cb8de2d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ##Artifactory Puppet Module -This is a simple Puppet module used to provision Artifactory. Currently this only supports RPM-based environments. -`class { "artifactory": }` is all you need in your manifest. \ No newline at end of file +This is a really simple Puppet module used to provision Artifactory. Currently this only supports RPM-based environments. + +`class { "artifactory": }` is all you need in your manifest. diff --git a/Rakefile b/Rakefile index 2e85faf..9159082 100644 --- a/Rakefile +++ b/Rakefile @@ -1,20 +1,13 @@ +require 'bundler' +Bundler.require(:rake) require 'rake/clean' -require 'puppet-lint/tasks/puppet-lint' -require 'rspec/core/rake_task' -CLEAN.include('pkg') +CLEAN.include('spec/fixtures/', 'doc', 'pkg') +CLOBBER.include('.tmp', '.librarian') -PuppetLint.configuration.send("disable_80chars") - -desc "Run module RSpec tests." -RSpec::Core::RakeTask.new(:spec) do |t| - t.rspec_opts = ["--format", "doc", "--color"] - t.pattern = 'spec/*/*_spec.rb' -end +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet_blacksmith/rake_tasks' -desc "Create a Puppet module." -task :build => [:clean, :spec] do - sh 'puppet-module build' -end +PuppetLint.configuration.send("disable_80chars") -task :default => :build +task :default => [:clean, :spec] diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index bb033ac..836d4b8 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -1,4 +1,6 @@ -require "#{File.join(File.dirname(__FILE__),'..','spec_helper')}" +require 'spec_helper' describe 'artifactory' do + it { should contain_package('artifactory') } + it { should contain_service('artifactory') } end diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp deleted file mode 100644 index 864b0bc..0000000 --- a/spec/fixtures/manifests/site.pp +++ /dev/null @@ -1,9 +0,0 @@ -node default { - notify { 'test': } -} - -node /testhost/ { -} - -node 'user.example.com' { -} diff --git a/spec/fixtures/modules/artifactory/manifests b/spec/fixtures/modules/artifactory/manifests deleted file mode 120000 index 373b992..0000000 --- a/spec/fixtures/modules/artifactory/manifests +++ /dev/null @@ -1 +0,0 @@ -../../../../manifests \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6cdf7e4..2c6f566 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1 @@ -require 'rspec-puppet' - -fixture_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) - -RSpec.configure do |c| - c.module_path = File.join(fixture_path, 'modules') - c.manifest_dir = File.join(fixture_path, 'manifests') -end +require 'puppetlabs_spec_helper/module_spec_helper'