⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 builder.rb

📁 Amarok是一款在LINUX或其他类UNIX操作系统中运行的音频播放器软件。 经过两年开发后
💻 RB
字号:
#--# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.# All rights reserved.# See LICENSE.txt for permissions.#++require "rubygems/package"require "rubygems/security"require "yaml"require 'rubygems/gem_openssl'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)      @spec = spec    end        ##    # Builds the gem from the specification.  Returns the name of the file written.    #    def build      @spec.mark_version      @spec.validate            # 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 algorihtm 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      file_name = @spec.full_name+".gem"      Package.open(file_name, "w", signer) do |pkg|          pkg.metadata = @spec.to_yaml          @spec.files.each do |file|              next if File.directory? file              pkg.add_file_simple(file, File.stat(file_name).mode & 0777,                                  File.size(file)) do |os|                                      os.write File.open(file, "rb"){|f|f.read}                                  end          end      end      say success      file_name    end        def success      <<-EOM  Successfully built RubyGem  Name: #{@spec.name}  Version: #{@spec.version}  File: #{@spec.full_name+'.gem'}EOM    end  endend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -