code
stringlengths
1
1.73M
language
stringclasses
1 value
require "rexml/child" module REXML module DTD class ElementDecl < Child START = "<!ELEMENT" START_RE = /^\s*#{START}/um PATTERN_RE = /^\s*(#{START}.*?)>/um PATTERN_RE = /^\s*#{START}\s+((?:[:\w_][-\.\w_]*:)?[-!\*\.\w_]*)(.*?)>/ #\s*((((["']).*?\5)|[^\/'">]*)*?)(\/)?>/um, true) ...
Ruby
require "rexml/child" module REXML module DTD class NotationDecl < Child START = "<!NOTATION" START_RE = /^\s*#{START}/um PUBLIC = /^\s*#{START}\s+(\w[\w-]*)\s+(PUBLIC)\s+((["']).*?\4)\s*>/um SYSTEM = /^\s*#{START}\s+(\w[\w-]*)\s+(SYSTEM)\s+((["']).*?\4)\s*>/um def initialize src ...
Ruby
require "rexml/parseexception" require "rexml/formatters/pretty" require "rexml/formatters/default" module REXML # Represents a node in the tree. Nodes are never encountered except as # superclasses of other objects. Nodes have siblings. module Node # @return the next sibling (nil if unset) def next_si...
Ruby
module REXML # Defines a number of tokens used for parsing XML. Not for general # consumption. module XMLTokens NCNAME_STR= '[\w:][\-\w.]*' NAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}" NAMECHAR = '[\-\w\.:]' NAME = "([\\w:]#{NAMECHAR}*)" NMTOKEN = "(?:#{NAMECHAR})+" NMTOKENS = "#{NMTOKEN...
Ruby
require 'rexml/xmltokens' # [ :element, parent, name, attributes, children* ] # a = Node.new # a << "B" # => <a>B</a> # a.b # => <a>B<b/></a> # a.b[1] # => <a>B<b/><b/><a> # a.b[1]["x"] = "y" # => <a>B<b/><b x="y"/></a> # a.b[0].c # => <a>B<b><c/...
Ruby
require 'rexml/entity' require 'rexml/doctype' require 'rexml/child' require 'rexml/doctype' require 'rexml/parseexception' module REXML # Represents text nodes in an XML document class Text < Child include Comparable # The order in which the substitutions occur SPECIALS = [ /&(?!#?[\w-]+;)/u, /</u, />...
Ruby
require 'rexml/xmltokens' module REXML # Adds named attributes to an object. module Namespace # The name of the object, valid if set attr_reader :name, :expanded_name # The expanded name of the object, valid if name is set attr_accessor :prefix include XMLTokens NAMESPLIT = /^(?:(#{NCNAME_S...
Ruby
module REXML module Encoding # ID ---> Encoding name attr_reader :encoding def encoding=(encoding) encoding = encoding.name if encoding.is_a?(Encoding) if encoding.is_a?(String) original_encoding = encoding encoding = find_encoding(encoding) unless encoding ra...
Ruby
require 'rexml/functions' require 'rexml/xpath_parser' module REXML # Wrapper class. Use this class to access the XPath functions. class XPath include Functions # A base Hash object, supposing to be used when initializing a # default empty namespaces set, but is currently unused. # TODO: either se...
Ruby
require "rexml/parent" require "rexml/namespace" require "rexml/attribute" require "rexml/cdata" require "rexml/xpath" require "rexml/parseexception" module REXML # An implementation note about namespaces: # As we parse, when we find namespaces we put them in a hash and assign # them a unique ID. We then conver...
Ruby
require 'rexml/parsers/streamparser' require 'rexml/parsers/baseparser' require 'rexml/light/node' module REXML module Parsers class LightParser def initialize stream @stream = stream @parser = REXML::Parsers::BaseParser.new( stream ) end def add_listener( listener ) @p...
Ruby
require 'forwardable' require 'rexml/parseexception' require 'rexml/parsers/baseparser' require 'rexml/xmltokens' module REXML module Parsers # = Using the Pull Parser # <em>This API is experimental, and subject to change.</em> # parser = PullParser.new( "<a>text<b att='val'/>txet</a>" ) # while p...
Ruby
module REXML module Parsers class StreamParser def initialize source, listener @listener = listener @parser = BaseParser.new( source ) end def add_listener( listener ) @parser.add_listener( listener ) end def parse # entity string while true ...
Ruby
require 'rexml/parsers/baseparser' require 'rexml/parseexception' require 'rexml/namespace' require 'rexml/text' module REXML module Parsers # SAX2Parser class SAX2Parser def initialize source @parser = BaseParser.new(source) @listeners = [] @procs = [] @namespace_stack ...
Ruby
require 'rexml/validation/validationexception' require 'rexml/undefinednamespaceexception' module REXML module Parsers class TreeParser def initialize( source, build_context = Document.new ) @build_context = build_context @parser = Parsers::BaseParser.new( source ) end def add_...
Ruby
require 'rexml/namespace' require 'rexml/xmltokens' module REXML module Parsers # You don't want to use this class. Really. Use XPath, which is a wrapper # for this class. Believe me. You don't want to poke around in here. # There is strange, dark magic at work in this code. Beware. Go back! Go ...
Ruby
require 'rexml/parsers/streamparser' require 'rexml/parsers/baseparser' module REXML module Parsers class UltraLightParser def initialize stream @stream = stream @parser = REXML::Parsers::BaseParser.new( stream ) end def add_listener( listener ) @parser.add_listener( li...
Ruby
require 'rexml/parseexception' require 'rexml/undefinednamespaceexception' require 'rexml/source' require 'set' module REXML module Parsers # = Using the Pull Parser # <em>This API is experimental, and subject to change.</em> # parser = PullParser.new( "<a>text<b att='val'/>txet</a>" ) # while pars...
Ruby
require 'rexml/formatters/pretty' module REXML module Formatters # The Transitive formatter writes an XML document that parses to an # identical document as the source document. This means that no extra # whitespace nodes are inserted, and whitespace within text nodes is # preserved. Within these c...
Ruby
require 'rexml/formatters/default' module REXML module Formatters # Pretty-prints an XML document. This destroys whitespace in text nodes # and will insert carriage returns and indentations. # # TODO: Add an option to print attributes on new lines class Pretty < Default # If compact is se...
Ruby
module REXML module Formatters class Default # Prints out the XML document with no formatting -- except if id_hack is # set. # # ie_hack:: # If set to true, then inserts whitespace before the close of an empty # tag, so that IE's bad XML parser doesn't choke. def init...
Ruby
require 'rexml/parseexception' module REXML class UndefinedNamespaceException < ParseException def initialize( prefix, source, parser ) super( "Undefined prefix #{prefix} found" ) end end end
Ruby
module REXML module Validation class ValidationException < RuntimeError def initialize msg super end end end end
Ruby
require "rexml/validation/validation" require "rexml/parsers/baseparser" module REXML module Validation # Implemented: # * empty # * element # * attribute # * text # * optional # * choice # * oneOrMore # * zeroOrMore # * group # * value # * interleave # * mixed ...
Ruby
require 'rexml/validation/validationexception' module REXML module Validation module Validator NILEVENT = [ nil ] def reset @current = @root @root.reset @root.previous = true @attr_stack = [] self end def dump puts @root.inspect end ...
Ruby
require 'rexml/functions' require 'rexml/xmltokens' module REXML class QuickPath include Functions include XMLTokens # A base Hash object to be used when initializing a # default empty namespaces set. EMPTY_HASH = {} def QuickPath::first element, path, namespaces=EMPTY_HASH match(elem...
Ruby
require 'rexml/namespace' require 'rexml/xmltokens' require 'rexml/attribute' require 'rexml/syncenumerator' require 'rexml/parsers/xpathparser' class Object # provides a unified +clone+ operation, for REXML::XPathParser # to use across multiple Object types def dclone clone end end class Symbol # provid...
Ruby
# -*- encoding: utf-8 -*- # REXML is an XML toolkit for Ruby[http://www.ruby-lang.org], in Ruby. # # REXML is a _pure_ Ruby, XML 1.0 conforming, # non-validating[http://www.w3.org/TR/2004/REC-xml-20040204/#sec-conformance] # toolkit with an intuitive API. REXML passes 100% of the non-validating Oasis # tests[http://ww...
Ruby
require "rexml/child" require "rexml/source" module REXML # Represents an XML Instruction; IE, <? ... ?> # TODO: Add parent arg (3rd arg) to constructor class Instruction < Child START = '<\?' STOP = '\?>' # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?> # content is every...
Ruby
require 'socket' require 'resolv' class << IPSocket # :stopdoc: alias original_resolv_getaddress getaddress # :startdoc: def getaddress(host) begin return Resolv.getaddress(host).to_s rescue Resolv::ResolvError raise SocketError, "Hostname not known: #{host}" end end end class TCPSoc...
Ruby
# Include the English library file in a Ruby script, and you can # reference the global variables such as \VAR{\$\_} using less # cryptic names, listed in the following table.% \vref{tab:english}. # # Without 'English': # # $\ = ' -- ' # "waterbuffalo" =~ /buff/ # print $", $', $$, "\n" # # With Eng...
Ruby
#-- # Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy...
Ruby
require 'socket' require 'fcntl' require 'timeout' require 'thread' begin require 'securerandom' rescue LoadError end # Resolv is a thread-aware DNS resolver library written in Ruby. Resolv can # handle multiple DNS requests concurrently without blocking the entire ruby # interpreter. # # See also resolv-replace.r...
Ruby
# # = base64.rb: methods for base64-encoding and -decoding strings # # The Base64 module provides for the encoding (#encode64, #strict_encode64, # #urlsafe_encode64) and decoding (#decode64, #strict_decode64, # #urlsafe_decode64) of binary data using a Base64 representation. # # == Example # # A simple encoding and de...
Ruby
# encoding: utf-8 # # = matrix.rb # # An implementation of Matrix and Vector classes. # # See classes Matrix and Vector for documentation. # # Current Maintainer:: Marc-André Lafortune # Original Author:: Keiju ISHITSUKA # Original Documentation:: Gavin Sinclair (sourced from <i>Ruby in a Nutshell</i> (Matsumoto, O'Rei...
Ruby
require 'monitor' require 'thread' require 'drb/drb' require 'rinda/rinda' require 'enumerator' require 'forwardable' module Rinda ## # A TupleEntry is a Tuple (i.e. a possible entry in some Tuplespace) # together with expiry and cancellation data. class TupleEntry include DRbUndumped attr_accessor...
Ruby
require 'drb/drb' require 'thread' ## # A module to implement the Linda distributed computing paradigm in Ruby. # # Rinda is part of DRb (dRuby). # # == Example(s) # # See the sample/drb/ directory in the Ruby distribution, from 1.8.2 onwards. # #-- # TODO # == Introduction to Linda/rinda? # # == Why is this library s...
Ruby
# # Note: Rinda::Ring API is unstable. # require 'drb/drb' require 'rinda/rinda' require 'thread' module Rinda ## # The default port Ring discovery will use. Ring_PORT = 7647 ## # A RingServer allows a Rinda::TupleSpace to be located via UDP broadcasts. # Service location uses the following steps: # ...
Ruby
class Matrix # Adapted from JAMA: http://math.nist.gov/javanumerics/jama/ # Eigenvalues and eigenvectors of a real matrix. # # Computes the eigenvalues and eigenvectors of a matrix A. # # If A is diagonalizable, this provides matrices V and D # such that A = V*D*V.inv, where D is the diagonal matrix with...
Ruby
class Matrix # Adapted from JAMA: http://math.nist.gov/javanumerics/jama/ # # For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n # unit lower triangular matrix L, an n-by-n upper triangular matrix U, # and a m-by-m permutation matrix P so that L*U = P*A. # If m < n, then L is m-by-m and ...
Ruby
# # forwardable.rb - # $Release Version: 1.1$ # $Revision: 31685 $ # by Keiju ISHITSUKA(keiju@ishitsuka.com) # original definition by delegator.rb # Revised by Daniel J. Berger with suggestions from Florian Gross. # # Documentation by James Edward Gray II and Gavin Sinclair # # == ...
Ruby
# :enddoc: warn('lib/rational.rb is deprecated') if $VERBOSE class Fixnum alias quof fdiv alias rdiv quo alias power! ** unless method_defined? :power! alias rpower ** end class Bignum alias quof fdiv alias rdiv quo alias power! ** unless method_defined? :power! alias rpower ** end
Ruby
#-- # benchmark.rb - a performance benchmarking library # # $Id: benchmark.rb 32269 2011-06-28 06:09:46Z naruse $ # # Created by Gotoken (gotoken@notwork.org). # # Documentation by Gotoken (original RD), Lyle Johnson (RDoc conversion), and # Gavin Sinclair (editing). #++ # # == Overview # # The Benchmark module provide...
Ruby
# == Pretty-printer for Ruby objects. # # = Which seems better? # # non-pretty-printed output by #p is: # #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<PrettyPrint::GroupQueue:0x81fed3c @queue=[[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], []]>, @buffer=[], @newline="\n", @gro...
Ruby
## # Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings # to the rest of RubyGems. # class Gem::PathSupport ## # The default system path for managing Gems. attr_reader :home ## # Array of paths to search for Gems. attr_reader :path ## # # Constructor. Takes a single argument...
Ruby
## # Provides a single method +deprecate+ to be used to declare when # something is going away. # # class Legacy # def self.klass_method # # ... # end # # def instance_method # # ... # end # # extend Gem::Deprecate # deprecate :instance_method, "X.z", 2011, 4 # # ...
Ruby
require 'tempfile' require 'rubygems' require 'rubygems/remote_fetcher' ## # A fake Gem::RemoteFetcher for use in tests or to avoid real live HTTP # requests when testing code that uses RubyGems. # # Example: # # @fetcher = Gem::FakeFetcher.new # @fetcher.data['http://gems.example.com/yaml'] = source_index.to_yaml...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems/command' require 'rubygems/user_interaction' ## # The command manager registers and installs all the individual sub-commands # supported by the gem command. # # Ext...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems' ## # The documentation manager generates RDoc and RI for RubyGems. class Gem::DocManager include Gem::UserInteraction @configured_args = [] def self.conf...
Ruby
require 'rubygems' require 'rubygems/dependency_list' require 'rubygems/installer' require 'rubygems/spec_fetcher' require 'rubygems/user_interaction' ## # Installs a gem along with all its dependencies from local and remote gems. class Gem::DependencyInstaller include Gem::UserInteraction attr_reader :gems_to_...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ #-- # Some system might not have OpenSSL installed, therefore the core # library file openssl might not be available. We localize testing # for the presence of OpenSSL in this file. ...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require "rubygems" require 'rubygems/command_manager' require 'rubygems/config_file' require 'rubygems/doc_manager' ## # Load additional plugins from $LOAD_PATH Gem.load_env_plugins...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems/exceptions' require 'rubygems/gem_openssl' require 'fileutils' # # = Signed Gems README # # == Table of Contents # * Overview # * Walkthrough # * Command-Line Optio...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems' # forward-declare module Gem::Security # :nodoc: class Policy # :nodoc: end end ## # Mixin methods for install and update options for Gem::Commands module G...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems' require 'rubygems/user_interaction' Gem.load_yaml require 'rubygems/package' ## # The Builder class processes RubyGem specification files # to produce a .gem fil...
Ruby
module Gem if defined? ::Psych::Visitors class NoAliasYAMLTree < Psych::Visitors::YAMLTree def visit_String(str) return super unless str == '=' # or whatever you want quote = Psych::Nodes::Scalar::SINGLE_QUOTED @emitter.scalar str, nil, nil, false, true, quote end # Noo...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems/version' require 'rubygems/requirement' require 'rubygems/platform' require "rubygems/deprecate" # :stopdoc: class Date; end # for ruby_code if date.rb wasn't requi...
Ruby
require 'rubygems' require 'rubygems/format' require 'time' begin gem 'builder' require 'builder/xchar' rescue LoadError end ## # Top level class for building the gem repository index. class Gem::Indexer include Gem::UserInteraction ## # Build indexes for RubyGems older than 1.2.0 when true attr_acces...
Ruby
require 'stringio' require 'rubygems/user_interaction' ## # This Gem::StreamUI subclass records input and output to StringIO for # retrieval during tests. class Gem::MockGemUi < Gem::StreamUI class TermError < RuntimeError attr_reader :exit_code def initialize exit_code super @exit_code = exit_...
Ruby
# :stopdoc: # Hack to handle syck's DefaultKey bug # # This file is always loaded AFTER either syck or psych are already # loaded. It then looks at what constants are available and creates # a consistent view on all rubys. # # All this is so that there is always a YAML::Syck::DefaultKey # class no matter if the full y...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'tsort' require 'rubygems/deprecate' ## # Gem::DependencyList is used for installing and uninstalling gems in the # correct order to avoid conflicts. class Gem::DependencyLi...
Ruby
# This exists just to satify bugs in marshal'd gemspecs that # contain a reference to YAML::PrivateType. We prune these out # in Specification._load, but if we don't have the constant, Marshal # blows up. module Psych class PrivateType end end # This exists just to satify bugs in marshal'd gemspecs that # contain ...
Ruby
require "rubygems" require "rubygems/deprecate" ## # GemPathSearcher has the capability to find loadable files inside # gems. It generates data up front to speed up searches later. class Gem::GemPathSearcher ## # Initialise the data we need to make searches later. def initialize # We want a record of all...
Ruby
require "rubygems/version" ## # A Requirement is a set of one or more version restrictions. It supports a # few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators. # REFACTOR: The fact that a requirement is singular or plural is kind of # awkward. Is Requirement the right name for this? Or should it b...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems/package' ## # Gem::Format knows the guts of the RubyGem .gem file format and provides the # capability to read gem files class Gem::Format attr_accessor :spec ...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ ## # Module that defines the default UserInteraction. Any class including this # module will have access to the +ui+ method that returns the default UI. module Gem::DefaultUserInter...
Ruby
require 'rubygems/test_case' require 'rubygems/package' ## # A test case for Gem::Package::Tar* classes class Gem::Package::TarTestCase < Gem::TestCase def ASCIIZ(str, length) str + "\0" * (length - str.length) end def SP(s) s + " " end def SP_Z(s) s + " \0" end def Z(s) s + "\0" e...
Ruby
# -*- coding: utf-8 -*- #-- # Copyright (C) 2004 Mauricio Julio Fernández Pradier # See LICENSE.txt for additional licensing information. #++ ## # TarReader reads tar files and allows iteration over their items class Gem::Package::TarReader include Gem::Package ## # Raised if the tar IO is not seekable cla...
Ruby
# -*- coding: utf-8 -*- #++ # Copyright (C) 2004 Mauricio Julio Fernández Pradier # See LICENSE.txt for additional licensing information. #-- ## # Class for reading entries out of a tar file class Gem::Package::TarReader::Entry ## # Header for this tar entry attr_reader :header ## # Creates a new tar ent...
Ruby
# -*- coding: utf-8 -*- #-- # Copyright (C) 2004 Mauricio Julio Fernández Pradier # See LICENSE.txt for additional licensing information. #++ module Gem::Package::FSyncDir private ## # make sure this hits the disc def fsync_dir(dirname) dir = open dirname, 'r' dir.fsync rescue # ignore IOError if ...
Ruby
# -*- coding: utf-8 -*- #-- # Copyright (C) 2004 Mauricio Julio Fernández Pradier # See LICENSE.txt for additional licensing information. #++ ## # Allows writing of tar files class Gem::Package::TarWriter class FileOverflow < StandardError; end ## # IO wrapper that allows writing a limited amount of data c...
Ruby
# -*- coding: utf-8 -*- #-- # Copyright (C) 2004 Mauricio Julio Fernández Pradier # See LICENSE.txt for additional licensing information. #++ ## # TarOutput is a wrapper to TarWriter that builds gem-format tar file. # # Gem-format tar files contain the following files: # [data.tar.gz] A gzipped tar file containing the...
Ruby
# -*- coding: utf-8 -*- #-- # Copyright (C) 2004 Mauricio Julio Fernández Pradier # See LICENSE.txt for additional licensing information. #++ ## #-- # struct tarfile_entry_posix { # char name[100]; # ASCII + (Z unless filled) # char mode[8]; # 0 padded, octal, null # char uid[8]; # ditto # cha...
Ruby
module Gem # TODO: move this whole file back into rubygems.rb @post_install_hooks ||= [] @post_uninstall_hooks ||= [] @pre_uninstall_hooks ||= [] @pre_install_hooks ||= [] ## # An Array of the default sources that come with RubyGems def self.default_sources %w[http://rubygems.org/] end ...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'rubygems' ## # The format class knows the guts of the RubyGem .gem file format and provides # the capability to read gem files class Gem::OldFormat attr_accessor :spec, ...
Ruby
require 'rubygems/remote_fetcher' module Gem::GemcutterUtilities OptionParser.accept Symbol do |value| value.to_sym end ## # Add the --key option def add_key_option add_option('-k', '--key KEYNAME', Symbol, 'Use the given API key', 'from ~/.gem/credentials') do |value,...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'optparse' require 'rubygems/user_interaction' ## # Base class for all Gem commands. When creating a new gem command, define # #new, #execute, #arguments, #defaults_str, #de...
Ruby
require 'webrick' require 'zlib' require 'erb' require 'rubygems' require 'rubygems/doc_manager' ## # Gem::Server and allows users to serve gems for consumption by # `gem --remote-install`. # # gem_server starts an HTTP server on the given port and serves the following: # * "/" - Browsing of gem spec files for instal...
Ruby
require 'rubygems/remote_fetcher' require 'rubygems/user_interaction' require 'rubygems/errors' require 'rubygems/text' ## # SpecFetcher handles metadata updates from remote gem repositories. class Gem::SpecFetcher include Gem::UserInteraction include Gem::Text FILES = { :all => 'specs', :lates...
Ruby
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ require 'fileutils' require 'rubygems' require 'rubygems/dependency_list' require 'rubygems/doc_manager' require 'rubygems/user_interaction' ## # An Uninstaller. # # The uninstaller ...
Ruby
class Gem::ErrorReason; end # Generated when trying to lookup a gem to indicate that the gem # was found, but that it isn't usable on the current platform. # # fetch and install read these and report them to the user to aid # in figuring out why a gem couldn't be installed. # class Gem::PlatformMismatch < Gem::ErrorRe...
Ruby
require 'rubygems/command' class Gem::Commands::LockCommand < Gem::Command def initialize super 'lock', 'Generate a lockdown list of gems', :strict => false add_option '-s', '--[no-]strict', 'fail if unable to satisfy a dependency' do |strict, options| options[:strict] = stri...
Ruby
require 'rubygems/command' require 'rubygems/commands/query_command' class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand def initialize super 'search', 'Display all gems whose name contains STRING' remove_option '--name-matches' end def arguments # :nodoc: "STRING fragment of g...
Ruby
require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/version_option' class Gem::Commands::FetchCommand < Gem::Command include Gem::LocalRemoteOptions include Gem::VersionOption def initialize super 'fetch', 'Download a gem and place it in the current directory' add_bulk...
Ruby
require 'rubygems/command' require 'rubygems/version_option' require 'rubygems/doc_manager' class Gem::Commands::RdocCommand < Gem::Command include Gem::VersionOption def initialize super 'rdoc', 'Generates RDoc for pre-installed gems', :version => Gem::Requirement.default, :include_rdoc =...
Ruby
require 'rubygems/command' require 'rubygems/server' class Gem::Commands::ServerCommand < Gem::Command def initialize super 'server', 'Documentation and gem repository HTTP server', :port => 8808, :gemdir => [], :daemon => false OptionParser.accept :Port do |port| if port =~ /\A\d+\z/ then ...
Ruby
require 'rubygems/command' require 'rubygems/version_option' require 'rubygems/uninstaller' ## # Gem uninstaller command line tool # # See `gem help uninstall` class Gem::Commands::UninstallCommand < Gem::Command include Gem::VersionOption def initialize super 'uninstall', 'Uninstall gems from the local rep...
Ruby
require 'rubygems/command' require 'rubygems/indexer' ## # Generates a index files for use as a gem server. # # See `gem help generate_index` class Gem::Commands::GenerateIndexCommand < Gem::Command def initialize super 'generate_index', 'Generates the index files for a gem server directory', ...
Ruby
require 'rubygems/command' require 'rubygems/security' class Gem::Commands::CertCommand < Gem::Command def initialize super 'cert', 'Manage RubyGems certificates and signing settings' add_option('-a', '--add CERT', 'Add a trusted certificate.') do |value, options| cert = OpenSSL::X509:...
Ruby
require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/spec_fetcher' require 'rubygems/version_option' require 'rubygems/text' class Gem::Commands::QueryCommand < Gem::Command include Gem::Text include Gem::LocalRemoteOptions include Gem::VersionOption def initialize(name = 'que...
Ruby
require 'rubygems/command' require 'rubygems/installer' require 'rubygems/version_option' require 'rubygems/remote_fetcher' class Gem::Commands::UnpackCommand < Gem::Command include Gem::VersionOption def initialize require 'fileutils' super 'unpack', 'Unpack an installed gem to the current directory', ...
Ruby
require 'rubygems/command' require 'rubygems/dependency_list' require 'rubygems/uninstaller' class Gem::Commands::CleanupCommand < Gem::Command def initialize super 'cleanup', 'Clean up old versions of installed gems in the local repository', :force => false, :install_dir => Gem.dir add...
Ruby
require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/version_option' class Gem::Commands::DependencyCommand < Gem::Command include Gem::LocalRemoteOptions include Gem::VersionOption def initialize super 'dependency', 'Show the dependencies of an installed gem', ...
Ruby
require 'rubygems/command' require 'rubygems/command_manager' require 'rubygems/install_update_options' require 'rubygems/local_remote_options' require 'rubygems/spec_fetcher' require 'rubygems/version_option' require 'rubygems/commands/install_command' class Gem::Commands::UpdateCommand < Gem::Command include Gem:...
Ruby
require 'rubygems/command' require 'rubygems/local_remote_options' require 'rubygems/spec_fetcher' require 'rubygems/version_option' class Gem::Commands::OutdatedCommand < Gem::Command include Gem::LocalRemoteOptions include Gem::VersionOption def initialize super 'outdated', 'Display all gems that need up...
Ruby
require 'rubygems/command' class Gem::Commands::HelpCommand < Gem::Command # :stopdoc: EXAMPLES = <<-EOF Some examples of 'gem' usage. * Install 'rake', either from local directory or remote server: gem install rake * Install 'rake', only from remote server: gem install rake --remote * Install 'rake'...
Ruby
require 'rubygems/command' require 'rubygems/commands/query_command' ## # An alternate to Gem::Commands::QueryCommand that searches for gems starting # with the the supplied argument. class Gem::Commands::ListCommand < Gem::Commands::QueryCommand def initialize super 'list', 'Display gems whose name starts wit...
Ruby
require 'rubygems/command' require 'rubygems/format' require 'rubygems/installer' require 'rubygems/version_option' class Gem::Commands::PristineCommand < Gem::Command include Gem::VersionOption def initialize super 'pristine', 'Restores installed gems to pristine condition from files located in th...
Ruby
require 'rubygems/command' require 'rubygems/remote_fetcher' require 'rubygems/spec_fetcher' require 'rubygems/local_remote_options' class Gem::Commands::SourcesCommand < Gem::Command include Gem::LocalRemoteOptions def initialize require 'fileutils' super 'sources', 'Manage the sources and ca...
Ruby
require 'rubygems/command' class Gem::Commands::EnvironmentCommand < Gem::Command def initialize super 'environment', 'Display information about the RubyGems environment' end def arguments # :nodoc: args = <<-EOF packageversion display the package version gemdir display th...
Ruby