From grant at antiflux.org Wed Mar 1 21:02:04 2006 From: grant at antiflux.org (Grant Hollingworth) Date: Wed, 1 Mar 2006 19:02:04 -0700 Subject: [Rubygems-developers] [PATCH] config.rb Message-ID: <20060302020204.GA24336@okcomputer.antiflux.org> This patch introduces rubygems/config.rb, which contains an rbconfig-style hash of the paths in setup.rb's .config. The rest of RubyGems then uses Gem::CONFIG rather than Config::CONFIG. On Debian systems, for instance, Ruby is /usr/bin/ruby, but sitedir is /usr/local/lib/site_ruby. The existing RubyGems doesn't deal well with cases like that. There is a new option for setup.rb: --gem-home. $GEM_HOME still overrides it. I removed the OS X framework special cases. Since the .pkg just copies its files into place, config.rb will have to be generated before the package is made. It seemed a simpler solution than complicated require logic or a dummy config.rb. If a gembindir different than bindir is needed, I can add that easily. I've attached a CVS diff plus two new files. metaconfig adds --gem-home and sets setup.rb's path defaults from config.rb, if available. gem update --system should work for installs with --prefix or whatever. pre-setup.rb generates config.rb. The tests don't run without config.rb, but they don't work without an installed copy of RubyGems, anyway. (I tried running tests with only the source directory, using RUBYLIB=lib rake test, but I have flexmock and rake installed as gems. Damn you, chicken. Damn you, egg.) I made a small patch to setup.rb so that metaconfig's set_config_default actually does something. One last thing: while testing, I noticed weird output from post-install.rb, and eventually figured out that I had RUBYOPT=rubygems set. Despite the $:.unshift("lib"), the old RubyGems install was being used. -------------- next part -------------- ? metaconfig ? lib/rubygems/pre-setup.rb Index: Rakefile =================================================================== RCS file: /var/cvs/rubygems/rubygems/Rakefile,v retrieving revision 1.58 diff -u -r1.58 Rakefile --- Rakefile 24 Feb 2006 00:54:18 -0000 1.58 +++ Rakefile 2 Mar 2006 01:18:40 -0000 @@ -38,6 +38,7 @@ 'html', 'pkgs/sources/sources*.gem', '.config', + 'lib/rubygems/config.rb', '**/debug.log', 'logs' ) Index: post-install.rb =================================================================== RCS file: /var/cvs/rubygems/rubygems/post-install.rb,v retrieving revision 1.6 diff -u -r1.6 post-install.rb --- post-install.rb 9 Jul 2005 23:18:32 -0000 1.6 +++ post-install.rb 2 Mar 2006 01:18:40 -0000 @@ -37,8 +37,8 @@ end def install_windows_batch_files - bindir = Config::CONFIG['bindir'] - ruby_install_name = Config::CONFIG['ruby_install_name'] + bindir = Gem::CONFIG['bindir'] + ruby_install_name = Gem::CONFIG['ruby_install_name'] is_windows_platform = Config::CONFIG["arch"] =~ /dos|win32/i require 'find' Find.find('bin') do |f| Index: setup.rb =================================================================== RCS file: /var/cvs/rubygems/rubygems/setup.rb,v retrieving revision 1.2 diff -u -r1.2 setup.rb --- setup.rb 10 Jul 2005 04:07:20 -0000 1.2 +++ setup.rb 2 Mar 2006 01:18:41 -0000 @@ -69,7 +69,11 @@ attr_reader :name attr_reader :description - attr_accessor :default + attr_reader :default + def default=(default) + @value = default if @value == @default + @default = default + end alias help_default default def help_opt Index: lib/rubygems.rb =================================================================== RCS file: /var/cvs/rubygems/rubygems/lib/rubygems.rb,v retrieving revision 1.88 diff -u -r1.88 rubygems.rb --- lib/rubygems.rb 3 Dec 2005 18:59:35 -0000 1.88 +++ lib/rubygems.rb 2 Mar 2006 01:18:41 -0000 @@ -1,4 +1,5 @@ require 'rbconfig' +require 'rubygems/config' module Gem class LoadError < ::LoadError @@ -95,6 +96,19 @@ set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home @gem_home end + + ## + # The directory path where Gem binaries are to be installed. + # + # return:: [String] The directory path + # + def bindir(install_dir=Gem.dir) + if(install_dir == Gem.default_dir) + Gem::CONFIG['bindir'] + else + File.join(install_dir, "bin") + end + end ## # List of directory paths to search for Gems. @@ -364,27 +378,7 @@ # Default home directory path to be used if an alternate value is # not specified in the environment. def default_dir - ## rbconfig = Dir.glob("{#{($LOAD_PATH).join(',')}}/rbconfig.rb").first - ## if rbconfig - ## module_eval File.read(rbconfig) unless const_defined?("Config") - ## else - ## require 'rbconfig' - ## end - # - # Note on above code: we have an issue if a Config class is - # already defined and we load 'rbconfig'. The above code is - # supposed to work around that but it's been commented out. In - # any case, I moved "require 'rbconfig'" to the top of this - # file, because there was a circular dependency between this - # method and our custom require. In any case, rbconfig is a - # fundamental RubyGems dependency, so it might as well be up the - # top. -- Gavin Sinclair, 2004-12-12 - # - if defined? RUBY_FRAMEWORK_VERSION - return File.join(File.dirname(Config::CONFIG["sitedir"]), "Gems") - else - File.join(Config::CONFIG['libdir'], 'ruby', 'gems', Config::CONFIG['ruby_version']) - end + CONFIG['gem-home'] end private Index: lib/rubygems/deployment.rb =================================================================== RCS file: /var/cvs/rubygems/rubygems/lib/rubygems/deployment.rb,v retrieving revision 1.2 diff -u -r1.2 deployment.rb --- lib/rubygems/deployment.rb 16 Mar 2005 03:09:29 -0000 1.2 +++ lib/rubygems/deployment.rb 2 Mar 2006 01:18:41 -0000 @@ -105,8 +105,8 @@ def new_deployment(target_dir = nil) unless target_dir - require 'rbconfig' - target_dir = Config::CONFIG['sitelibdir'] + require 'rubygems/config' + target_dir = CONFIG['siterubyver'] end target_dir = File.expand_path(target_dir) deployment = self[target_dir] Index: lib/rubygems/installer.rb =================================================================== RCS file: /var/cvs/rubygems/rubygems/lib/rubygems/installer.rb,v retrieving revision 1.106 diff -u -r1.106 installer.rb --- lib/rubygems/installer.rb 26 Feb 2006 01:42:39 -0000 1.106 +++ lib/rubygems/installer.rb 2 Mar 2006 01:18:41 -0000 @@ -2,6 +2,7 @@ require 'pathname' require 'rbconfig' +require 'rubygems/config' require 'rubygems/format' require 'rubygems/dependency_list' @@ -166,30 +167,10 @@ end end - ## - # Determines the directory for binaries - # - def bindir(install_dir=Gem.dir) - if(install_dir == Gem.default_dir) - # mac framework support - if defined? RUBY_FRAMEWORK_VERSION - File.join(File.dirname(Config::CONFIG["sitedir"]), File.basename(Config::CONFIG["bindir"])) - else # generic install - Config::CONFIG['bindir'] - end - else - File.join(install_dir, "bin") - end - end - def generate_bin(spec, install_dir=Gem.dir) return unless spec.executables && ! spec.executables.empty? - # If the user has asked for the gem to be installed in - # a directory that is the system gem directory, then - # use the system bin directory, else create (or use) a - # new bin dir under the install_dir. - bindir = bindir(install_dir) + bindir = Gem.bindir Dir.mkdir bindir unless File.exist? bindir raise Gem::FilePermissionError.new(bindir) unless File.writable?(bindir) @@ -243,7 +224,7 @@ path = File.join(install_dir, "gems", spec.full_name, spec.bindir, bin_file_name) File.open(path, "rb") do |file| first_line = file.readlines("\n").first - path_to_ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) + path_to_ruby = Gem::CONFIG['rubypath'] if first_line =~ /^#!/ # Preserve extra words on shebang line, like "-w". Thanks RPA. shebang = first_line.sub(/\A\#!\s*\S*ruby\S*/, "#!" + path_to_ruby) @@ -408,9 +389,9 @@ # def remove_executables(gemspec) return if gemspec.nil? + bindir = Gem.bindir if(gemspec.executables.size > 0) - raise Gem::FilePermissionError.new(Config::CONFIG['bindir']) unless - File.writable?(Config::CONFIG['bindir']) + raise Gem::FilePermissionError.new(bindir) unless File.writable?(bindir) list = Gem.source_index.search(gemspec.name).delete_if { |spec| spec.version == gemspec.version } @@ -429,7 +410,6 @@ say "Executables and scripts will remain installed." return else - bindir = Config::CONFIG['bindir'] gemspec.executables.each do |exe_name| say "Removing #{exe_name}" File.unlink(File.join(bindir, exe_name)) rescue nil -------------- next part -------------- require 'rbconfig' add_path_config('gem-home', File.join('$libdir', 'ruby', 'gems', Config::CONFIG['ruby_version']), 'the directory for Gems') # load paths from previous install begin require 'rubygems/config' Gem::CONFIG_UNEXPANDED.each {|key, val| set_config_default(key, val) } rescue LoadError # older RubyGems or not installed end -------------- next part -------------- # copy .config file created by setup.rb to an rbconfig-style rubygems/config.rb File.open('config.rb', 'w') do |f| f.print <<-END.gsub(/^ /, '') # This file is generated by the RubyGems setup.rb module Gem CONFIG = {} END File.foreach("#{srcdir_root}/.config") do |l| key, value = l.chomp.split(/=/) f.print %{ CONFIG["#{key}"] = "#{value}"\n} end f.print %q{ def self.expand(val) val.gsub!(/\$\$|\$(\w+)|\$\(([^()]+)\)|\$\\\{([^{}]+)\\\}/) do |var| if !(v = $1 || $2 || $3) '$' elsif key = CONFIG[v] CONFIG[v] = false expand(key) CONFIG[v] = key else var end end val end CONFIG_UNEXPANDED = {} CONFIG.each {|k, v| CONFIG_UNEXPANDED[k] = v.dup } CONFIG.each_value {|v| expand(v) } end }.gsub(/^ /, '') end From grant at antiflux.org Fri Mar 3 21:00:02 2006 From: grant at antiflux.org (Grant Hollingworth) Date: Fri, 3 Mar 2006 19:00:02 -0700 Subject: [Rubygems-developers] [PATCH] too much clobbering Message-ID: <20060304020002.GA22840@okcomputer.antiflux.org> 'rake clobber' removes test/data/PostMessage-0.0.1.gem, which is in CVS. This patch limits the test/data clobbering to [a-z]-*.gem. -------------- next part -------------- Index: Rakefile =================================================================== RCS file: /var/cvs/rubygems/rubygems/Rakefile,v retrieving revision 1.58 diff -u -r1.58 Rakefile --- Rakefile 24 Feb 2006 00:54:18 -0000 1.58 +++ Rakefile 4 Mar 2006 01:43:22 -0000 @@ -32,7 +32,7 @@ "test/data/one/one-*0.0.1.gem", "test/temp", 'test/data/gemhome', - 'test/data/*.gem', + 'test/data/[a-z]-*.gem', 'scripts/*.hieraki', 'data__', 'html', From jim at weirichhouse.org Wed Mar 29 09:46:37 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Wed, 29 Mar 2006 09:46:37 -0500 Subject: [Rubygems-developers] Testing for Gems 0.9.0 Beta In-Reply-To: <018a01c63975$c77db8e0$1301a8c0@tomhplaptop> References: <018a01c63975$c77db8e0$1301a8c0@tomhplaptop> Message-ID: <442A9DCD.1050402@weirichhouse.org> Tom Copeland wrote: >> I wanted to run some ideas by you. One of the big changes >> scheduled for >> RubyGems 0.9.0 is how the gem command downloads the gem index from >> RubyForge. Currently, gem grabs the entire wad of gem specs if it >> detects that the size of the index file has changed. The new version >> will incrementally download only those gems that have been >> updated since >> the last download. Hopefully this will cut down download bandwidth a >> bit and speed up the end user experience. > > Hi Jim - > > Sounds great! Yup, I've talked with Rich about this a bit. Tom, here is the software to generate the rubygems server index files. The script is index_gem_repository.rb and is called as follows: index_gem_repository.rb -d REPO_DIRECTORY Where REPO_DIRECTORY is where the yaml file is currently placed. In addition to the standard yaml/yaml.Z files produced, it will also produce a quick directory containing each gem spec individually zipped and ready for incremental downloads. If you want to see output while the script runs, just include a --verbose option. There's a --help option too. Although this will be part of the gem 0.9.0 release, I've tested it with version 0.8.0 and it will work fine, so you don't have to upgrade your entire gem setup on the machine to try this out. I've tested this quite a bit on my personal gem repository and am confident it won't break existing gem downloads, it probably a good a idea keep the old indexing software around (just in case :). Once you start running this on RubyForge, I will put together a beta release of gems for limited distribution for testing the incremental downloads. Thanks. -- -- Jim Weirich jweirich at one.net http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) -------------- next part -------------- A non-text attachment was scrubbed... Name: index_gem_repository.rb Type: application/x-ruby Size: 7268 bytes Desc: not available Url : http://rubyforge.org/pipermail/rubygems-developers/attachments/20060329/0b35f20d/attachment-0001.bin From transfire at gmail.com Wed Mar 29 21:26:11 2006 From: transfire at gmail.com (TRANS) Date: Wed, 29 Mar 2006 21:26:11 -0500 Subject: [Rubygems-developers] Getting at non-lib dirs in gem (like datadir) Message-ID: <4b6f054f0603291826h7072ed8se70e3b561d00505d@mail.gmail.com> Could these be added to the Gems module? # Queries useful for getting to non-lib files in a distribution. def active?(gemname) @loaded_specs ||= Hash.new @loaded_specs.key? gemname end def gemspec(gemname) @loaded_specs[gemname] if active?(gemname) end def gempath(gemname) @loaded_specs[gemname].full_gem_path if active?(gemname) end def gemdir(gemname, dir) if active?(gemname) File.join(gempath, dir) end end The offer a solution to the data/ dir problem. I.e. DATADIR = Gem.gemdir( 'calibre', 'data/calibre/units' ) Thanks. From tom at infoether.com Wed Mar 29 21:44:37 2006 From: tom at infoether.com (Tom Copeland) Date: Wed, 29 Mar 2006 21:44:37 -0500 Subject: [Rubygems-developers] Testing for Gems 0.9.0 Beta In-Reply-To: <442A9DCD.1050402@weirichhouse.org> References: <018a01c63975$c77db8e0$1301a8c0@tomhplaptop> <442A9DCD.1050402@weirichhouse.org> Message-ID: <1143686677.11538.15.camel@hal> On Wed, 2006-03-29 at 09:46 -0500, Jim Weirich wrote: > Tom, here is the software to generate the rubygems server index files. > The script is index_gem_repository.rb and is called as follows: > > index_gem_repository.rb -d REPO_DIRECTORY > > Where REPO_DIRECTORY is where the yaml file is currently placed. In > addition to the standard yaml/yaml.Z files produced, it will also > produce a quick directory containing each gem spec individually zipped > and ready for incremental downloads. > > If you want to see output while the script runs, just include a > --verbose option. There's a --help option too. > > Although this will be part of the gem 0.9.0 release, I've tested it with > version 0.8.0 and it will work fine, so you don't have to upgrade your > entire gem setup on the machine to try this out. > > I've tested this quite a bit on my personal gem repository and am > confident it won't break existing gem downloads, it probably a good a > idea keep the old indexing software around (just in case :). > > Once you start running this on RubyForge, I will put together a beta > release of gems for limited distribution for testing the incremental > downloads. Super! That sounds great, it sure would be nice to get the index a bit smaller. OK, I'll see if I can get this in place. Thanks, Tom From transfire at gmail.com Thu Mar 30 19:18:14 2006 From: transfire at gmail.com (TRANS) Date: Thu, 30 Mar 2006 19:18:14 -0500 Subject: [Rubygems-developers] Getting at non-lib dirs in gem (like datadir) In-Reply-To: <4b6f054f0603291826h7072ed8se70e3b561d00505d@mail.gmail.com> References: <4b6f054f0603291826h7072ed8se70e3b561d00505d@mail.gmail.com> Message-ID: <4b6f054f0603301618n4a99f770saf3e095bd3335e1@mail.gmail.com> On 3/29/06, TRANS wrote: > Could these be added to the Gems module? > > # Queries useful for getting to non-lib files in a distribution. > > def active?(gemname) > @loaded_specs ||= Hash.new > @loaded_specs.key? gemname > end > > def gemspec(gemname) > @loaded_specs[gemname] if active?(gemname) > end > > def gempath(gemname) > @loaded_specs[gemname].full_gem_path if active?(gemname) > end > > def gemdir(gemname, dir) > if active?(gemname) > File.join(gempath, dir) > end > end ASctually, that last one should be: def gemdir(gemname, dir) if active?(gemname) File.join(gempath(gemname), dir) end end T. From jim at weirichhouse.org Fri Mar 31 17:16:00 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Fri, 31 Mar 2006 17:16:00 -0500 Subject: [Rubygems-developers] CVS Head Gem has problems installing latest rails Message-ID: <442DAA20.5010007@weirichhouse.org> I get the following while installing a the latest version of rails. $ sudo gem install rails -y Successfully installed rails-1.1.0 Successfully installed activerecord-1.14.0 Successfully installed actionpack-1.12.0 Successfully installed actionmailer-1.2.0 Successfully installed actionwebservice-1.1.0 Installing ri documentation for activerecord-1.14.0... Installing RDoc documentation for activerecord-1.14.0... Installing ri documentation for actionpack-1.12.0... ERROR: While executing gem ... (RuntimeError) Unhandled special: Special: type=17, text="SimpleXML" This happened on both windows and linux. The windows box is running version ruby 1.8.2, the linux box is 1.8.4. Both boxes are running the CVS head for gems, which runs the RI documentation generator. Since I'm not hearing complaints from other users, I suspect that it is an RI doc issue. I ran "gem rdoc" on each of the packages individually and had no problem (on the windows box ... haven't tried it on linux yet). Anyone who know the RI doc process better than I do wish to comment? -- -- Jim Weirich jim at weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) From anatol.pomozov at gmail.com Fri Mar 31 18:32:08 2006 From: anatol.pomozov at gmail.com (Anatol Pomozov) Date: Sat, 1 Apr 2006 01:32:08 +0200 Subject: [Rubygems-developers] CVS Head Gem has problems installing latest rails In-Reply-To: <442DAA20.5010007@weirichhouse.org> References: <442DAA20.5010007@weirichhouse.org> Message-ID: <3665a1a00603311532v4a2439e8wb27ffe25a2027db8@mail.gmail.com> Hi, folk. I have the same problem (Unhandled special: Special:) for a lot of gem-packages, not only for rails. Also on 1.8.2 and 1.8.4 on Windows platform. Very annoying error. On 4/1/06, Jim Weirich wrote: > > I get the following while installing a the latest version of rails. > > $ sudo gem install rails -y > Successfully installed rails-1.1.0 > Successfully installed activerecord-1.14.0 > Successfully installed actionpack-1.12.0 > Successfully installed actionmailer-1.2.0 > Successfully installed actionwebservice-1.1.0 > Installing ri documentation for activerecord-1.14.0... > Installing RDoc documentation for activerecord-1.14.0... > Installing ri documentation for actionpack-1.12.0... > ERROR: While executing gem ... (RuntimeError) > Unhandled special: Special: type=17, text="SimpleXML" > > This happened on both windows and linux. The windows box is running > version ruby 1.8.2, the linux box is 1.8.4. Both boxes are running the > CVS head for gems, which runs the RI documentation generator. Since I'm > not hearing complaints from other users, I suspect that it is an RI doc > issue. > > I ran "gem rdoc" on each of the packages individually and had no problem > (on the windows box ... haven't tried it on linux yet). > > Anyone who know the RI doc process better than I do wish to comment? > > -- anatol (http://pomozov.info) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rubygems-developers/attachments/20060401/d9a48250/attachment.htm