Please review pull request #40: (#14124) Load rake tasks directly to fix tests for Ruby 1.9.x opened by (kbarber)

Description:

The way we loaded rake tasks was not compatible with Ruby 1.9.x, as it relied
on the fact that Ruby 1.8.x included . in its load path. This patch loads our
rake tasks directly instead.

  • Opened: Sat Apr 21 23:50:05 UTC 2012
  • Based on: puppetlabs:master (05ac83eca3137ba183dc43ce4ead855ba18bc075)
  • Requested merge: kbarber:ticket/master/14124_ruby19_broken_rake (f6c9f5d9ab5986c537a1a6db92bbab3af92c6509)

Diff follows:

diff --git a/Rakefile b/Rakefile
index 400a4aa..a583165 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,7 +1,8 @@
 require 'rubygems'
 require 'rubygems/package_task'
 require 'rspec/core/rake_task'
-require 'tasks/release.rb'
+
+Dir['tasks/**/*.rake'].each { |t| load t }
 
 spec = Gem::Specification.new do |s|
   s.name = "hiera"
diff --git a/tasks/release.rake b/tasks/release.rake
new file mode 100644
index 0000000..07f1e1b
--- /dev/null
+++ b/tasks/release.rake
@@ -0,0 +1,34 @@
+
+VERSION_FILE = 'lib/hiera.rb'
+
+def get_current_version
+  File.open( VERSION_FILE ) {|io| io.grep(/VERSION = /)}[0].split()[-1]
+end
+
+def described_version
+  # This ugly bit removes the gSHA1 portion of the describe as that causes failing tests
+  %x{git describe}.gsub('-', '.').split('.')[0..3].join('.').to_s.gsub('v', '')
+end
+
+namespace :pkg do
+
+  desc "Bump version prior to release (internal task)"
+  task :versionbump  do
+    old_version =  get_current_version
+    contents = IO.read(VERSION_FILE)
+    new_version = '"' + described_version.to_s.strip + '"'
+    contents.gsub!("VERSION = #{old_version}", "VERSION = #{new_version}")
+    file = File.open(VERSION_FILE, 'w')
+    file.write contents
+    file.close
+  end
+
+  desc "Build Package"
+  task :release => [ :versionbump, :default ] do
+    Rake::Task[:package].invoke
+  end
+
+end # namespace
+
+task :clean => [ :clobber_package ] do
+end
diff --git a/tasks/release.rb b/tasks/release.rb
deleted file mode 100644
index 07f1e1b..0000000
--- a/tasks/release.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-
-VERSION_FILE = 'lib/hiera.rb'
-
-def get_current_version
-  File.open( VERSION_FILE ) {|io| io.grep(/VERSION = /)}[0].split()[-1]
-end
-
-def described_version
-  # This ugly bit removes the gSHA1 portion of the describe as that causes failing tests
-  %x{git describe}.gsub('-', '.').split('.')[0..3].join('.').to_s.gsub('v', '')
-end
-
-namespace :pkg do
-
-  desc "Bump version prior to release (internal task)"
-  task :versionbump  do
-    old_version =  get_current_version
-    contents = IO.read(VERSION_FILE)
-    new_version = '"' + described_version.to_s.strip + '"'
-    contents.gsub!("VERSION = #{old_version}", "VERSION = #{new_version}")
-    file = File.open(VERSION_FILE, 'w')
-    file.write contents
-    file.close
-  end
-
-  desc "Build Package"
-  task :release => [ :versionbump, :default ] do
-    Rake::Task[:package].invoke
-  end
-
-end # namespace
-
-task :clean => [ :clobber_package ] do
-end

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to