Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rework requiring to try and defer some loading

WITHOUT USING AUTOLOAD!
  • Loading branch information...
commit e000e55e6b97f9c6449e82ffb48d911e274b6db1 1 parent e94887a
@ferrous26 authored
View
8 lib/rubygems-compile/commands.rb
@@ -1,8 +0,0 @@
-require 'rubygems-compile/commands/compile_command'
-Gem::CommandManager.instance.register_command :compile
-
-require 'rubygems-compile/commands/uncompile_command'
-Gem::CommandManager.instance.register_command :uncompile
-
-require 'rubygems-compile/commands/autocompile_command'
-Gem::CommandManager.instance.register_command :auto_compile
View
4 lib/rubygems-compile/commands/compile_command.rb
@@ -1,4 +1,7 @@
require 'rubygems/dependency_list'
+require 'rubygems/version_option'
+require 'rubygems-compile/common_methods'
+
##
# Use the MacRuby compiler to compile installed gems.
@@ -44,6 +47,7 @@ def execute
alert 'This could take a while; you might want to take a coffee break'
end
+ require 'rubygems-compile/compiler'
compiler = Gem::Compiler.new
gems.each { |gem| compiler.compile(gem) }
end
View
4 lib/rubygems-compile/commands/uncompile_command.rb
@@ -1,3 +1,6 @@
+require 'rubygems/version_option'
+require 'rubygems-compile/common_methods'
+
class Gem::Commands::UncompileCommand < Gem::Command
include Gem::VersionOption
include Gem::CompileMethods
@@ -32,6 +35,7 @@ def usage # :nodoc:
# an uncompiler object for each of them.
def execute
+ require 'rubygems-compile/uncompiler'
uncompiler = Gem::Uncompiler.new
execution_list.each { |gem| uncompiler.uncompile(gem) }
end
View
6 lib/rubygems-compile/compiler.rb
@@ -2,6 +2,12 @@ class Gem::Compiler
include Gem::UserInteraction
def initialize
+ require 'rbconfig'
+ unless MacRuby.const_defined?(:Compiler)
+ load File.join(RbConfig::CONFIG['bindir'], 'macrubyc')
+ end
+ require 'rubygems-compile/analyzer'
+
@current_directory = []
@config = Gem.configuration
end
View
1  lib/rubygems-compile/post_install_hook.rb
@@ -3,6 +3,7 @@
# command.
if Gem.configuration[:compile]
+ require 'rubygems-compile/compiler'
module Gem
@post_install_hooks << ::Gem::Compiler.new
end
View
20 lib/rubygems_plugin.rb
@@ -6,19 +6,13 @@
else
- require 'rbconfig'
- require 'fileutils'
- require 'rubygems/version_option'
-
- unless MacRuby.const_defined?(:Compiler)
- load File.join(RbConfig::CONFIG['bindir'], 'macrubyc')
- end
-
- require 'rubygems-compile/common_methods'
- require 'rubygems-compile/analyzer'
- require 'rubygems-compile/compiler'
- require 'rubygems-compile/uncompiler'
- require 'rubygems-compile/commands'
require 'rubygems-compile/post_install_hook'
+ require 'rubygems-compile/commands/compile_command'
+ require 'rubygems-compile/commands/uncompile_command'
+ require 'rubygems-compile/commands/autocompile_command'
+
+ Gem::CommandManager.instance.register_command :compile
+ Gem::CommandManager.instance.register_command :uncompile
+ Gem::CommandManager.instance.register_command :auto_compile
end
Please sign in to comment.
Something went wrong with that request. Please try again.