[DRE-commits] [librarian-puppet] 124/153: Add support for Puppet 4

Stig Sandbeck Mathisen ssm at debian.org
Wed Jun 1 20:30:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository librarian-puppet.

commit 8d484314deded0c95af783b51898d687c28b42c9
Author: Carlos Sanchez <carlos at apache.org>
Date:   Wed May 6 21:11:36 2015 +0200

    Add support for Puppet 4
---
 .travis.yml                          | 2 ++
 Changelog.md                         | 4 ++++
 Rakefile                             | 6 +++++-
 lib/librarian/puppet/source/local.rb | 7 +++++++
 lib/librarian/puppet/version.rb      | 2 +-
 5 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index f259758..cd4ae92 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,6 +9,8 @@ notifications:
     - carlos at apache.org
     - tim at github.com
 env:
+  - PUPPET_VERSION="~> 4.1.0"
+  - PUPPET_VERSION="~> 4.0.0"
   - PUPPET_VERSION="~> 3.7.0"
   - PUPPET_VERSION="~> 3.6.0"
   - PUPPET_VERSION="~> 3.5.0"
diff --git a/Changelog.md b/Changelog.md
index 9ce9a5c..707b302 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,6 +2,10 @@
 
 ## From 2.x Librarian-Puppet requires Ruby >= 1.9, uses Puppet Forge API v3. For Ruby 1.8 use 1.x
 
+### 2.2.0
+
+ * [Issue #296](https://github.com/rodjek/librarian-puppet/issues/296) Uninitialized constant Puppet::ModuleTool::ModulefileReader using Modulefiles in Puppet 4. Ignore those dependencies
+
 ### 2.1.1
 
  * [Issue #302](https://github.com/rodjek/librarian-puppet/issues/302) Ensure path is not lost when default specfile is used
diff --git a/Rakefile b/Rakefile
index 7819d9b..e2a9bbe 100644
--- a/Rakefile
+++ b/Rakefile
@@ -10,8 +10,12 @@ CLOBBER.include('Gemfile.lock')
 
 RSpec::Core::RakeTask.new
 Cucumber::Rake::Task.new(:features) do |t|
+  require 'puppet'
+  puppet_version = Puppet::version.gsub("~>","").split(".").first.to_i
+  tags = (2..4).select {|i| i != puppet_version}.map{|i| "--tags @puppet#{puppet_version},~@puppet#{i}"}
   # don't run githubtarball scenarios in Travis, they easily fail with rate limit exceeded
-  t.cucumber_opts = "--tags ~@github" if ENV['TRAVIS']=='true'
+  tags << "--tags ~@github" if ENV['TRAVIS']=='true'
+  t.cucumber_opts = tags.join(" ")
 end
 
 Rake::TestTask.new do |test|
diff --git a/lib/librarian/puppet/source/local.rb b/lib/librarian/puppet/source/local.rb
index 6bff7bd..4a3744c 100644
--- a/lib/librarian/puppet/source/local.rb
+++ b/lib/librarian/puppet/source/local.rb
@@ -85,6 +85,13 @@ module Librarian
           @@require_puppet ||= require_puppet
 
           metadata = ::Puppet::ModuleTool::Metadata.new
+
+          # Puppet 4 does not have the class
+          unless defined? ::Puppet::ModuleTool::ModulefileReader
+            warn { "Can't parse Modulefile in Puppet >= 4.0 and you are using #{Librarian::Puppet::puppet_version}. Ignoring dependencies in #{modulefile}" }
+            return metadata
+          end
+
           begin
             ::Puppet::ModuleTool::ModulefileReader.evaluate(metadata, modulefile)
             raise SyntaxError, "Missing version" unless metadata.version
diff --git a/lib/librarian/puppet/version.rb b/lib/librarian/puppet/version.rb
index cc7ebaa..341143a 100644
--- a/lib/librarian/puppet/version.rb
+++ b/lib/librarian/puppet/version.rb
@@ -1,5 +1,5 @@
 module Librarian
   module Puppet
-    VERSION = "2.1.1"
+    VERSION = "2.2.0"
   end
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git



More information about the Pkg-ruby-extras-commits mailing list