[macruby-changes] [3331] MacRuby/trunk/lib

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 25 12:27:08 PST 2010


Revision: 3331
          http://trac.macosforge.org/projects/ruby/changeset/3331
Author:   eloy.de.enige at gmail.com
Date:     2010-01-25 12:27:07 -0800 (Mon, 25 Jan 2010)
Log Message:
-----------
Add temporary MacRuby hacks to RubyGems back in place.

Modified Paths:
--------------
    MacRuby/trunk/lib/rubygems/commands/install_command.rb
    MacRuby/trunk/lib/rubygems/commands/update_command.rb
    MacRuby/trunk/lib/rubygems/installer.rb
    MacRuby/trunk/lib/rubygems/remote_fetcher.rb
    MacRuby/trunk/lib/rubygems.rb

Modified: MacRuby/trunk/lib/rubygems/commands/install_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/install_command.rb	2010-01-25 20:26:51 UTC (rev 3330)
+++ MacRuby/trunk/lib/rubygems/commands/install_command.rb	2010-01-25 20:27:07 UTC (rev 3331)
@@ -19,8 +19,8 @@
 
   def initialize
     defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
-      :generate_rdoc     => true,
-      :generate_ri       => true,
+      :generate_rdoc     => false,
+      :generate_ri       => false,
       :format_executable => false,
       :test              => false,
       :version           => Gem::Requirement.default,

Modified: MacRuby/trunk/lib/rubygems/commands/update_command.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/commands/update_command.rb	2010-01-25 20:26:51 UTC (rev 3330)
+++ MacRuby/trunk/lib/rubygems/commands/update_command.rb	2010-01-25 20:27:07 UTC (rev 3331)
@@ -48,6 +48,9 @@
     hig = {}
 
     if options[:system] then
+      # XXX We can't allow people to self-update RubyGems at this point.
+      raise "This MacRuby version of RubyGems cannot be self-updated."
+
       say "Updating RubyGems"
 
       unless options[:args].empty? then

Modified: MacRuby/trunk/lib/rubygems/installer.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/installer.rb	2010-01-25 20:26:51 UTC (rev 3330)
+++ MacRuby/trunk/lib/rubygems/installer.rb	2010-01-25 20:27:07 UTC (rev 3331)
@@ -459,6 +459,7 @@
 
   def build_extensions
     return if @spec.extensions.empty?
+    raise "MacRuby does not support native extensions yet. Be patient :-)"
     say "Building native extensions.  This could take a while..."
     start_dir = Dir.pwd
     dest_path = File.join @gem_dir, @spec.require_paths.first

Modified: MacRuby/trunk/lib/rubygems/remote_fetcher.rb
===================================================================
--- MacRuby/trunk/lib/rubygems/remote_fetcher.rb	2010-01-25 20:26:51 UTC (rev 3330)
+++ MacRuby/trunk/lib/rubygems/remote_fetcher.rb	2010-01-25 20:27:07 UTC (rev 3331)
@@ -253,6 +253,20 @@
   # read from the filesystem instead.
 
   def open_uri_or_path(uri, last_modified = nil, head = false, depth = 0)
+    if RUBY_ENGINE == 'macruby'
+      # XXX we are taking a _much faster_ code path here, this change should be
+      # removed once we re-implement the IO subsystem (and therefore Net::HTTP)
+      # on top of CF.
+      framework 'Foundation'
+      url = NSURL.URLWithString(uri.to_s)
+      data = NSMutableData.dataWithContentsOfURL(url)
+      if data.nil?
+        raise Gem::RemoteFetcher::FetchError, "error when fetching data from #{uri}"
+      end
+      string = String.__new_bytestring__(data)
+      #block.call(string) if block
+      return string
+    end
     raise "block is dead" if block_given?
 
     uri = URI.parse uri unless URI::Generic === uri

Modified: MacRuby/trunk/lib/rubygems.rb
===================================================================
--- MacRuby/trunk/lib/rubygems.rb	2010-01-25 20:26:51 UTC (rev 3330)
+++ MacRuby/trunk/lib/rubygems.rb	2010-01-25 20:27:07 UTC (rev 3331)
@@ -1123,9 +1123,10 @@
 
 require 'rubygems/config_file'
 
-if RUBY_VERSION < '1.9' then
+# MacRuby requires this hack as we can't load the gem_prelude.rb file yet.
+# if RUBY_VERSION < '1.9' then
   require 'rubygems/custom_require'
-end
+# end
 
 Gem.clear_paths
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100125/e36fc787/attachment.html>


More information about the macruby-changes mailing list