Skip to content

Commit

Permalink
Require the jpm ruby gem to be installed in order for our custom prov…
Browse files Browse the repository at this point in the history
…ider to work

jpm is located: <https://github.com/rtyler/jpm>

References #10, #11, #12
  • Loading branch information
R. Tyler Croy committed Apr 24, 2014
1 parent 1290d22 commit 1437e2e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
6 changes: 6 additions & 0 deletions lib/puppet/features/jpm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The 'jpm' feature will help confine our custom jpm provider to only exist if
# we have the `jpm` rubygem installed
#
# Based on: <http://alcy.github.io/2012/11/21/handling-gem-dependencies-in-custom-puppet-providers/>

Puppet.features.add(:jpm, :libs => ['jpm'])
5 changes: 0 additions & 5 deletions lib/puppet/features/json.rb

This file was deleted.

18 changes: 0 additions & 18 deletions lib/puppet/provider/package/jenkins.rb

This file was deleted.

22 changes: 22 additions & 0 deletions lib/puppet/provider/package/jpm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'puppet/provider/package'

################################################################################
# This comes from: <http://alcy.github.io/2012/11/21/handling-gem-dependencies-in-custom-puppet-providers/>
################################################################################
require 'rubygems' if Puppet.features.rubygems?
require 'jpm' if Puppet.features.jpm?
################################################################################

Puppet::Type.type(:package).provide :jpm, :parent => Puppet::Provider::Package do
confine :feature => :jpm
desc "Provider for managing Jenkins plugins"

has_feature :installable
has_feature :uninstallable

# These two features are pending the following issues being resolved for jpm:
# <https://github.com/rtyler/jpm/issues/8>
#has_feature :upgradeable
# <https://github.com/rtyler/jpm/issues/7>
#has_feature :versionable
end
4 changes: 2 additions & 2 deletions spec/unit/jenkins_provider_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'puppet/provider/package/jenkins'
require 'puppet/provider/package/jpm'

provider_type = Puppet::Type.type(:package).provider(:jenkins)
provider_type = Puppet::Type.type(:package).provider(:jpm)

describe provider_type do
end

0 comments on commit 1437e2e

Please sign in to comment.