summaryrefslogtreecommitdiff
path: root/trunk/lib/rubygems/builder.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-25 15:13:14 +0000
commitd0233291bc8a5068e52c69c210e5979e5324b5bc (patch)
tree7d9459449c33792c63eeb7baa071e76352e0baab /trunk/lib/rubygems/builder.rb
parent0dc342de848a642ecce8db697b8fecd83a63e117 (diff)
parent72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff)
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/lib/rubygems/builder.rb')
-rw-r--r--trunk/lib/rubygems/builder.rb88
1 files changed, 0 insertions, 88 deletions
diff --git a/trunk/lib/rubygems/builder.rb b/trunk/lib/rubygems/builder.rb
deleted file mode 100644
index 6fd8528f56..0000000000
--- a/trunk/lib/rubygems/builder.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-#--
-# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
-# All rights reserved.
-# See LICENSE.txt for permissions.
-#++
-
-module Gem
-
- ##
- # The Builder class processes RubyGem specification files
- # to produce a .gem file.
- #
- class Builder
-
- include UserInteraction
- ##
- # Constructs a builder instance for the provided specification
- #
- # spec:: [Gem::Specification] The specification instance
- #
- def initialize(spec)
- require "yaml"
- require "rubygems/package"
- require "rubygems/security"
-
- @spec = spec
- end
-
- ##
- # Builds the gem from the specification. Returns the name of the file
- # written.
- #
- def build
- @spec.mark_version
- @spec.validate
- @signer = sign
- write_package
- say success
- @spec.file_name
- end
-
- def success
- <<-EOM
- Successfully built RubyGem
- Name: #{@spec.name}
- Version: #{@spec.version}
- File: #{@spec.full_name+'.gem'}
-EOM
- end
-
- private
-
- def sign
- # if the signing key was specified, then load the file, and swap
- # to the public key (TODO: we should probably just omit the
- # signing key in favor of the signing certificate, but that's for
- # the future, also the signature algorithm should be configurable)
- signer = nil
- if @spec.respond_to?(:signing_key) && @spec.signing_key
- signer = Gem::Security::Signer.new(@spec.signing_key, @spec.cert_chain)
- @spec.signing_key = nil
- @spec.cert_chain = signer.cert_chain.map { |cert| cert.to_s }
- end
- signer
- end
-
- def write_package
- open @spec.file_name, 'wb' do |gem_io|
- Gem::Package.open gem_io, 'w', @signer do |pkg|
- pkg.metadata = @spec.to_yaml
-
- @spec.files.each do |file|
- next if File.directory? file
-
- stat = File.stat file
- mode = stat.mode & 0777
- size = stat.size
-
- pkg.add_file_simple file, mode, size do |tar_io|
- tar_io.write open(file, "rb") { |f| f.read }
- end
- end
- end
- end
- end
- end
-end
-