On Mon, Jan 26, 2009 at 11:17 AM, Han Holl <han.h...@tietoenator.com> wrote: > On Friday 23 January 2009, Luis Lavena wrote: > >> >> Oh yeha, my fault: >> >> gem spec pg --version '0.7.9.2008.10.13' --remote > >> specifications/pg-0.7.9.2008.10.13.gemspec >> > Thanks Luis, we're getting closer and closer. > Still, the output from the aboce command starts with: > --- !ruby/object:Gem::Specification > name: pg > version: !ruby/object:Gem::Version > version: 0.7.9.2008.10.13 > platform: ruby > authors: > ... > > It looks like YAML. > A .gemspec file is like: > Gem::Specification.new do |s| > s.name = %q{commandline} > s.version = "0.7.10" > > s.specification_version = 1 if s.respond_to? :specification_version= > ... > end > > The missing link would appear to be a function that can dump a > Gem::Specification object in .gemspec form.
Hmn, never noticed that, you're correct. I've always used yaml gemspec in my gems to avoid eval'ing them. > I found them, and can report that the following works fine: > #!/usr/bin/env ruby > > require 'yaml' > require 'rubygems' > require 'rubygems/specification' > require 'tempfile' > require 'fileutils' > > gem = ARGV[0] > raise 'give name (gem-version)' if gem.nil? > out = "#{Gem::dir}/specifications/#{gem}.gemspec" > raise "#{out} already exists" if test(?f, out) > pkt, version = gem.split('-', 2) > > IO.popen("gem spec #{pkt} --version '#{version}' --remote") do |io| > Tempfile.open('gem') do |temp| > temp.puts Gem::Specification.from_yaml(io).to_ruby > FileUtils.mv(temp.path, out) > end > end > > Thanks a lot for your help. > > Cheers, > > Han Holl > _______________________________________________ > Rubygems-developers mailing list > Rubygems-developers@rubyforge.org > http://rubyforge.org/mailman/listinfo/rubygems-developers > -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exupéry _______________________________________________ Rubygems-developers mailing list Rubygems-developers@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers