Skip to content

Commit

Permalink
Add support for Puppet 4
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossg committed May 23, 2015
1 parent 0f7999e commit 8d48431
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ notifications:
- [email protected]
- [email protected]
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"
Expand Down
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
7 changes: 7 additions & 0 deletions lib/librarian/puppet/source/local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ def evaluate_modulefile(modulefile)
@@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
Expand Down
2 changes: 1 addition & 1 deletion lib/librarian/puppet/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Librarian
module Puppet
VERSION = "2.1.1"
VERSION = "2.2.0"
end
end

0 comments on commit 8d48431

Please sign in to comment.