]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(maint) Make stdlib usable as a Ruby GEM
authorJeff McCune <jeff@puppetlabs.com>
Wed, 10 Apr 2013 21:35:42 +0000 (14:35 -0700)
committerJeff McCune <jeff@puppetlabs.com>
Wed, 10 Apr 2013 21:35:42 +0000 (14:35 -0700)
Without this patch it is inconvenient to use the functions included in
stdlib in a development setting.  The Puppet modulepath must be
explicitly set for the functions to be automatically loaded.

This patch addresses the problem by adding a gem specification and
dependency Gemfile.  This makes it possible to directly use stdlib and
all of the components it depends upon, like so:

    $ bundle install --path .bundle/gems/
    $ bundle exec puppet apply -e 'notice count([1, 2, 3])'

The first command will install all of the dependencies, including Puppet
and Facter, into the local project directory.  The second command will
make stdlib avaialable as a Gem, which will be picked up by Puppet since
(#7788) was merged into Puppet in the 3.0 release.

.gemspec [new file with mode: 0644]
Gemfile

diff --git a/.gemspec b/.gemspec
new file mode 100644 (file)
index 0000000..805e170
--- /dev/null
+++ b/.gemspec
@@ -0,0 +1,31 @@
+#
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+  s.name = "puppetmodule-stdlib"
+
+  s.version = "3.2.0"
+
+  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+  s.authors = ["Puppet Labs"]
+  s.date = "2013-04-10"
+  s.description = "Puppet Labs Standard Library module"
+  s.email = "support@puppetlabs.com"
+  s.executables = []
+  s.files = []
+  s.homepage = "https://github.com/puppetlabs/puppetlabs-stdlib"
+  s.rdoc_options = ["--title", "Puppet Standard Library Module", "--main", "README.markdown", "--line-numbers"]
+  s.require_paths = ["lib"]
+  s.rubyforge_project = "puppetmodule_stdlib"
+  s.rubygems_version = "1.8.24"
+  s.summary = "This module provides a standard library of resources for developing Puppet Modules."
+
+  if s.respond_to? :specification_version then
+    s.specification_version = 3
+
+    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+    else
+    end
+  else
+  end
+end
diff --git a/Gemfile b/Gemfile
index 102607416b8d20a91d87edf4d812f1be83926f83..442dd9d7e2394348fb9dde882dff348888757602 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -6,6 +6,7 @@ end
 
 group :development, :test do
   gem 'rake'
+  gem 'puppetmodule-stdlib', ">= 1.0.0", :path => File.expand_path("..", __FILE__)
   gem 'rspec', "~> 2.11.0", :require => false
   gem 'mocha', "~> 0.10.5", :require => false
   gem 'puppetlabs_spec_helper', :require => false