Please review pull request #748: Move rubygems require to executable entry points to Puppet opened by (pcarlisle)

Description:

We were trying to load rubygems in lib/puppet.rb so that we could load other
libraries installed as gems, but this isn't anywhere near the first file
loaded. By moving this into bin/puppet and other executable entry points, we
ensure that rubygems is loaded as early as possible.

  • Opened: Wed May 09 20:26:38 UTC 2012
  • Based on: puppetlabs:master (134bb1fb46dca7a0100b59007accc8c4d196bf8d)
  • Requested merge: pcarlisle:maint/master/rubygems-i-hate-you (0c6d54f7957edc48b8d5fd388632887a4e0db2ae)

Diff follows:

diff --git a/bin/puppet b/bin/puppet
index c030702..4574932 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -1,4 +1,10 @@
 #!/usr/bin/env ruby
 
+# Try to load rubygems.  Hey rubygems, I hate you.
+begin
+  require 'rubygems'
+rescue LoadError
+end
+
 require 'puppet/util/command_line'
 Puppet::Util::CommandLine.new.execute
diff --git a/lib/puppet.rb b/lib/puppet.rb
index 6720115..e4d52d9 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -1,9 +1,3 @@
-# Try to load rubygems.  Hey rubygems, I hate you.
-begin
-  require 'rubygems'
-rescue LoadError
-end
-
 # see the bottom of the file for further inclusions
 require 'singleton'
 require 'facter'
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 18f9a936..8f0f3bd 100755
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -8,6 +8,11 @@
 # Don't want puppet getting the command line arguments for rake or autotest
 ARGV.clear
 
+begin
+  require 'rubygems'
+rescue LoadError
+end
+
 require 'puppet'
 require 'mocha'
 gem 'rspec', '>=2.0.0'

    

--
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