From d0820469b4f7cc05e498866db57e39735f7113e0 Mon Sep 17 00:00:00 2001 From: Jeff McCune Date: Sat, 5 Jan 2013 15:01:56 -0800 Subject: (maint) Add Travis CI Support Without this patch stdlib has Travis CI configuration files, but they don't seem to completely specify the dependency versions and the build matrix. This patch addresses the problem by putting the dependency information in the conventional Gemfile location. This patch should coincide with enabling Travis CI support for pull requests. A build status image is also included in the project README. --- Gemfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Gemfile (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..791e7a5 --- /dev/null +++ b/Gemfile @@ -0,0 +1,21 @@ +source :rubygems + +group :development do + gem 'watchr' +end + +group :development, :test do + gem 'rake' + gem 'rspec', "~> 2.11.0", :require => false + gem 'mocha', "~> 0.10.5", :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'rspec-puppet', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby -- cgit v1.2.3 From 03c5c4a434c2290c021034dbfed82cb0f97e0e87 Mon Sep 17 00:00:00 2001 From: Jeff McCune Date: Mon, 25 Feb 2013 14:00:20 -0800 Subject: (maint) Add Ruby 2.0.0 to Travis build matrix Without this patch we're not testing against Ruby 2.0.0 which has recently been released. This is a problem because we'd like a way to be notified if a change set breaks compatibility with future supported versions of Ruby. This patch should not be taken as an indication that we fully support Ruby 2.0, just as an indication that we plan to in the future. This patch also tightens up the specifications of the build matrix. In addition to testing against the specific Puppet dependency versions, we're also testing against the latest 2.7.x release and the latest release. --- Gemfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Gemfile (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3ddc07e --- /dev/null +++ b/Gemfile @@ -0,0 +1,8 @@ +source "https://rubygems.org" + +if puppetversion = ENV['PUPPET_VERSION'] + gem 'puppet', puppetversion +else + gem 'puppet' +end +gem 'puppetlabs_spec_helper', '>= 0.1.0' -- cgit v1.2.3 From e81a45ee0085597dad5067cada94b05cf11c6c0c Mon Sep 17 00:00:00 2001 From: Jeff McCune Date: Wed, 10 Apr 2013 14:35:42 -0700 Subject: (maint) Make stdlib usable as a Ruby GEM 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. --- Gemfile | 1 + 1 file changed, 1 insertion(+) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 1026074..442dd9d 100644 --- 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 -- cgit v1.2.3 From 9c5805f26ac0abf8bf19cef1ac7a2fec19dec35b Mon Sep 17 00:00:00 2001 From: Jeff McCune Date: Thu, 11 Apr 2013 09:49:53 -0700 Subject: Add ability to use puppet from git via bundler Without this patch the Gemfile can only satisfy dependencies using officially release gem versions. This is a problem because we want to test stdlib against the latest HEAD of the puppet git repository. This patch addresses the problem by copying over the location_for method from the Puppet Gemfile, which will parse out git://, file:// or Gem version specifications. This, in turn, allows jobs to be configured to run with different dependency integrations. --- Gemfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 442dd9d..50df2ee 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,16 @@ source "https://rubygems.org" +def location_for(place, fake_version = nil) + mdata = /^(git:[^#]*)#(.*)/.match(place) + if mdata + [fake_version, { :git => mdata[1], :branch => mdata[2], :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path(mdata[1]), :require => false }] + else + [place, { :require => false }] + end +end + group :development do gem 'watchr' end @@ -14,7 +25,7 @@ group :development, :test do end if puppetversion = ENV['PUPPET_GEM_VERSION'] - gem 'puppet', puppetversion, :require => false + gem 'puppet', *location_for(puppetversion) else gem 'puppet', :require => false end -- cgit v1.2.3 From f44d535a0f6283d91700238b9ad86f83abe6c4e9 Mon Sep 17 00:00:00 2001 From: Jeff McCune Date: Mon, 6 May 2013 16:22:59 -0700 Subject: (maint) Update Gemfile with GEM_FACTER_VERSION Without this patch we cannot explicitly set the version of Facter to integrate using Bundler. This patch addresses the problem by adding a new environment variable, GEM_FACTER_VERSION which allows bundler to install a specific version of Facter. GEM_FACTER_VERSION is the variable name instead of FACTER_GEM_VERSION to prevent the gem_version fact from being defined. In addition, GEM_PUPPET_VERSION is defined based on PUPPET_GEM_VERSION in order to match the environment names and provide backwards compatibility with CI jobs. --- Gemfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Gemfile') diff --git a/Gemfile b/Gemfile index 50df2ee..197cc6b 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,16 @@ group :development, :test do gem 'rspec-puppet', :require => false end -if puppetversion = ENV['PUPPET_GEM_VERSION'] +facterversion = ENV['GEM_FACTER_VERSION'] +if facterversion + gem 'facter', *location_for(facterversion) +else + gem 'facter', :require => false +end + +ENV['GEM_PUPPET_VERSION'] ||= ENV['PUPPET_GEM_VERSION'] +puppetversion = ENV['GEM_PUPPET_VERSION'] +if puppetversion gem 'puppet', *location_for(puppetversion) else gem 'puppet', :require => false -- cgit v1.2.3