<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Hieraki recent changes</title>
    <link>http://gemtacular.rubygems.org/</link>
    <description>Hieraki recent changes</description>
    <language>en-us</language>
    <ttl>40</ttl>
    <item>
      <title>Daniel Berger: Specification Reference</title>
      <description>p(((. &lt;em&gt;This page is generated by &lt;tt&gt;hieraki&lt;/tt&gt; rake task in the
RubyGems CVS.  Any changes to this page will be lost.  Contact a
member of the RubyGems team if you have suggestions.&lt;/em&gt;

p(((. &lt;em&gt;Last generated: 2005-06-01 00:11:33 EDT (Wednesday)&lt;/em&gt;

h3. Introduction

In order to create a gem, you need to define a gem specification, commonly
called a "gemspec".

A gemspec consists of several _attributes_.  Some of these are required;
most of them are optional.  The main body of this document is an alphabetical
list of gemspec attributes, each with a description, example usage, notes, and
more.

See also:

h3. &lt;a name="toc"&gt;Important Attributes&lt;/a&gt;

&lt;a href="#name"&gt;name&lt;/a&gt; .. &lt;a href="#version"&gt;version&lt;/a&gt; .. &lt;a href="#platform"&gt;platform&lt;/a&gt; .. &lt;a href="#summary"&gt;summary&lt;/a&gt; .. &lt;a href="#require_paths"&gt;require_paths&lt;/a&gt; .. &lt;a href="#files"&gt;files&lt;/a&gt; .. &lt;a href="#dependencies"&gt;dependencies&lt;/a&gt;

h3. Alphabetical

* *A* &lt;a href="#authors"&gt;authors&lt;/a&gt; .. &lt;a href="#autorequire"&gt;autorequire&lt;/a&gt;
* *B* &lt;a href="#bindir"&gt;bindir&lt;/a&gt;
* *D* &lt;a href="#default_executable"&gt;default_executable&lt;/a&gt; .. &lt;a href="#dependencies"&gt;dependencies&lt;/a&gt; .. &lt;a href="#description"&gt;description&lt;/a&gt;
* *E* &lt;a href="#email"&gt;email&lt;/a&gt; .. &lt;a href="#executables"&gt;executables&lt;/a&gt; .. &lt;a href="#extensions"&gt;extensions&lt;/a&gt; .. &lt;a href="#extra_rdoc_files"&gt;extra_rdoc_files&lt;/a&gt;
* *F* &lt;a href="#files"&gt;files&lt;/a&gt;
* *H* &lt;a href="#has_rdoc"&gt;has_rdoc&lt;/a&gt; .. &lt;a href="#homepage"&gt;homepage&lt;/a&gt;
* *N* &lt;a href="#name"&gt;name&lt;/a&gt;
* *P* &lt;a href="#platform"&gt;platform&lt;/a&gt;
* *R* &lt;a href="#rdoc_options"&gt;rdoc_options&lt;/a&gt; .. &lt;a href="#require_paths"&gt;require_paths&lt;/a&gt; .. &lt;a href="#required_ruby_version"&gt;required_ruby_version&lt;/a&gt; .. &lt;a href="#requirements"&gt;requirements&lt;/a&gt; .. &lt;a href="#rubyforge_project"&gt;rubyforge_project&lt;/a&gt;
* *S* &lt;a href="#summary"&gt;summary&lt;/a&gt;
* *T* &lt;a href="#test_files"&gt;test_files&lt;/a&gt;
* *V* &lt;a href="#version"&gt;version&lt;/a&gt;

h3. Themed


* *Basics:* 
&lt;a href="#name"&gt;name&lt;/a&gt; .. &lt;a href="#version"&gt;version&lt;/a&gt; .. &lt;a href="#summary"&gt;summary&lt;/a&gt; .. &lt;a href="#description"&gt;description&lt;/a&gt; .. &lt;a href="#platform"&gt;platform&lt;/a&gt; .. &lt;a href="#required_ruby_version"&gt;required_ruby_version&lt;/a&gt; .. &lt;a href="#requirements"&gt;requirements&lt;/a&gt; .. &lt;a href="#dependencies"&gt;dependencies&lt;/a&gt;

* *Files, Libraries, and Executables:* 
&lt;a href="#files"&gt;files&lt;/a&gt; .. &lt;a href="#require_paths"&gt;require_paths&lt;/a&gt; .. &lt;a href="#autorequire"&gt;autorequire&lt;/a&gt; .. &lt;a href="#bindir"&gt;bindir&lt;/a&gt; .. &lt;a href="#executables"&gt;executables&lt;/a&gt; .. &lt;a href="#default_executable"&gt;default_executable&lt;/a&gt;

* *C compilation:* 
&lt;a href="#extensions"&gt;extensions&lt;/a&gt;

* *Documentation:* 
&lt;a href="#rdoc_options"&gt;rdoc_options&lt;/a&gt; .. &lt;a href="#has_rdoc"&gt;has_rdoc&lt;/a&gt; .. &lt;a href="#extra_rdoc_files"&gt;extra_rdoc_files&lt;/a&gt;

* *Testing:* 
&lt;a href="#test_files"&gt;test_files&lt;/a&gt;

* *About:* 
&lt;a href="#authors"&gt;authors&lt;/a&gt; .. &lt;a href="#email"&gt;email&lt;/a&gt; .. &lt;a href="#homepage"&gt;homepage&lt;/a&gt; .. &lt;a href="#rubyforge_project"&gt;rubyforge_project&lt;/a&gt;

h2. Attribute Survey


----


h3. &lt;a name="authors"&gt;authors&lt;/a&gt;

&lt;em&gt;Type: String or Array;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

The author or authors of the package contained in the gem.


h4. Usage

&lt;pre&gt;
  spec.author = 'John Jones'
  spec.authors = ['John Jones', 'Mary Smith']
&lt;/pre&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="autorequire"&gt;autorequire&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;;   default = nil&lt;/em&gt;


h4. Description

The file that will be loaded when &lt;tt&gt;require_gem&lt;/tt&gt; is called.


h4. Usage

&lt;pre&gt;
  spec.files = ['lib/rake.rb", "lib/rake/**/*.rb", ...]
  spec.autorequire = 'rake'
&lt;/pre&gt;


h4. Notes

In the above example, when the user's code calls &lt;tt&gt;require_gem 'rake'&lt;/tt&gt;, an implicit &lt;tt&gt;require 'rake'&lt;/tt&gt; is called afterwards. It is a shortcut so the user doesn't have to do what seems to be a redundant &lt;tt&gt;require&lt;/tt&gt;.

Specifying &lt;tt&gt;autorequire&lt;/tt&gt; is optional.  If there is no single default file that should be loaded, then it doesn't make sense to specify it.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="bindir"&gt;bindir&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;;   default = "bin"&lt;/em&gt;


h4. Description

The directory containing the application files, if any.


h4. Usage

&lt;pre&gt;
  spec.bindir = 'bin'
&lt;/pre&gt;


h4. Notes

An "application file" is a file that is intended to be run from the command line.  If your package contains such files, they will typically be placed in a &lt;tt&gt;bin&lt;/tt&gt; directory, hence the name *bindir*.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="date"&gt;date&lt;/a&gt;

&lt;em&gt;Type: Time;   &lt;em&gt;Required&lt;/em&gt;;   default = "Time.now"&lt;/em&gt;


h4. Description

The date/time that the gem was created.


h4. Usage

&lt;pre&gt;
  spec.date = File.utime('VERSION')
&lt;/pre&gt;


h4. Notes

It's generally sufficient to leave it to the default.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="default_executable"&gt;default_executable&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;;   default = (see below)&lt;/em&gt;


h4. Description

Of all the application files in the package, the *default executable* is the one that can be run directly through the gem.


h4. Usage

&lt;pre&gt;
  spec.executables = ['bin/foo', 'bin/bar']
  spec.default_executable = 'bin/bar'
&lt;/pre&gt;


h4. Notes

If you only specify one application file in *executables*, that file becomes the default executable.  Therefore, you only need to specify this value if you have more than one application file.

The notion of running applications directly through a gem is not well supported at the moment.  The idea is that you can download a gem, say &lt;tt&gt;monopoly.gem&lt;/tt&gt; (the board game), and run &lt;tt&gt;gem monopoly.gem&lt;/tt&gt;, which would run the &lt;tt&gt;monopoly&lt;/tt&gt; application. This is not an in-demand feature.

&lt;em&gt;XXX: Is the full path necessary?&lt;/em&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="dependencies"&gt;dependencies&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;;   default = []&lt;/em&gt;


h4. Description

Lists the gems that must be installed for this gem to work.


h4. Usage

&lt;pre&gt;
  spec.add_dependency('log4r', '&gt;= 1.0.5')
&lt;/pre&gt;


h4. Notes

When installing a gem with &lt;tt&gt;gem install ...&lt;/tt&gt;, its dependencies will be checked.  If they are not installed, &lt;tt&gt;gem&lt;/tt&gt; will offer to install them.

See also &lt;a href="#requirements"&gt;requirements&lt;/a&gt;.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="description"&gt;description&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

Detailed description of the gem.  See also &lt;a href="#summary"&gt;summary&lt;/a&gt;.


h4. Usage

&lt;pre&gt;
  spec.description = &lt;&lt;-EOF
    Rake is a Make-like program implemented in Ruby. Tasks and
    dependencies are specified in standard Ruby syntax.
  EOF
&lt;/pre&gt;


h4. Notes

When the gem is built, the description is re-formatted into a single line with sensible whitespace.  This means you can use here-docs with formatting, as demonstrated above, without worrying about the formatting.

The _description_ should be more detailed than the _summary_.  You might consider copying all or part of your project's README into this field.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="email"&gt;email&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

The author's email address.


h4. Usage

&lt;pre&gt;
  spec.email = 'john.jones@example.com'
&lt;/pre&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="executables"&gt;executables&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

A list of files in the package that are applications.


h4. Usage

&lt;pre&gt;
  # XXX: is this correct?
  spec.executables &lt;&lt; 'rake'
&lt;/pre&gt;


h4. Notes

For example, the &lt;tt&gt;rake&lt;/tt&gt; gem has &lt;tt&gt;rake&lt;/tt&gt; as an executable. You don't specify the full path (as in &lt;tt&gt;bin/rake&lt;/tt&gt;); all application-style files are expected to be found in &lt;a href="#bindir"&gt;bindir&lt;/a&gt;.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="extensions"&gt;extensions&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

The paths to &lt;tt&gt;extconf.rb&lt;/tt&gt;-style files used to compile extensions.


h4. Usage

&lt;pre&gt;
  spec.extensions &lt;&lt; 'ext/rmagic/extconf.rb'
&lt;/pre&gt;


h4. Notes

These files will be run when the gem is installed, causing the C (or whatever) code to be compiled on the user's machine.

&lt;em&gt;XXX: Any other comments?&lt;/em&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="extra_rdoc_files"&gt;extra_rdoc_files&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

A list of _extra_ files that will be used by RDoc to generate the documentation.


h4. Usage

&lt;pre&gt;
  spec.extra_rdoc_files = ['README', 'doc/user-guide.txt']
&lt;/pre&gt;


h4. Notes

When the user elects to generate the RDoc documentation for a gem (typically at install time), all the library files are sent to RDoc for processing.  This option allows you to have some non-code files included for a more complete set of documentation.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="files"&gt;files&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

The list of files to be contained in the gem.


h4. Usage

&lt;pre&gt;
  require 'rake'
  spec.files = FileList['lib/**/*.rb', 'bin/*', '[A-Z]*', 'test/**/*'].to_a
  
  # or without Rake...
  spec.files = Dir['lib/**/*.rb'] + Dir['bin/*']
  spec.files &lt;&lt; Dir['[A-Z]*'] + Dir['test/**/*']
  spec.files.reject! { |fn| fn.include? "CVS" }
&lt;/pre&gt;


h4. Notes

You don't need to use Rake, obviously, but it does make it much easier to specify files, as it automatically excludes CVS files, backups, etc.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="has_rdoc"&gt;has_rdoc&lt;/a&gt;

&lt;em&gt;Type: boolean;   &lt;em&gt;Optional&lt;/em&gt;;   default = false&lt;/em&gt;


h4. Description

Indicates whether the code in the gem has been commented with RDoc in mind.


h4. Usage

&lt;pre&gt;
  spec.has_rdoc = true
&lt;/pre&gt;


h4. Notes

This attribute has an advisory role only.  Any gem can be submitted for RDoc processing.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="homepage"&gt;homepage&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

URL of the project or author.


h4. Usage

&lt;pre&gt;
  spec.hompage = 'http://rake.rubyforge.org'
&lt;/pre&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="name"&gt;name&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Required&lt;/em&gt;&lt;/em&gt;


h4. Description

The name of the gem.


h4. Usage

&lt;pre&gt;
  spec.name = 'rake'
&lt;/pre&gt;


h4. Notes

The name does not include the version number; see &lt;a href="#version"&gt;version&lt;/a&gt;.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="platform"&gt;platform&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Required&lt;/em&gt;;   default = "Gem::Platform::Ruby"&lt;/em&gt;


h4. Description

The target platform for the gem.


h4. Usage

&lt;pre&gt;
  spec.platform = Gem::Platform::Win32
&lt;/pre&gt;


h4. Notes

Most gems contain pure Ruby code; they should simply leave the default value in place.  Some gems contain C (or other) code to be compiled into a Ruby "extension".  The should leave the default value in place unless their code will only compile on a certain type of system.  Some gems consist of pre-compiled code ("binary gems").  It's especially important that they set the _platform_ attribute appropriately.  A shortcut is to set the platform to Gem::Platform::CURRENT, which will cause the gem builder to set the platform to the appropriate value for the system on which the build is being performed.

If this attribute is set to a non-default value, it will be included in the filename of the gem when it is built, e.g. &lt;tt&gt;fxruby-1.2.0-win32.gem&lt;/tt&gt;.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="rdoc_options"&gt;rdoc_options&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;;   default = []&lt;/em&gt;


h4. Description

Specifies the &lt;tt&gt;rdoc&lt;/tt&gt; options to be used when generating API documentation.


h4. Usage

&lt;pre&gt;
  spec.rdoc_options &lt;&lt; '--title' &lt;&lt; 'Rake -- Ruby Make' &lt;&lt;
                       '--main' &lt;&lt; 'README' &lt;&lt;
                       '--line-numbers'
&lt;/pre&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="require_paths"&gt;require_paths&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Required&lt;/em&gt;;   default = ["lib"]&lt;/em&gt;


h4. Description

List of ''require'' paths from the root of the gem.


h4. Usage

&lt;pre&gt;
  # If all library files are in the root directory...
  spec.require_path = '.'
  
  # If you have 'lib' and 'ext' directories...
  spec.require_paths &lt;&lt; 'ext'
&lt;/pre&gt;


h4. Notes

The default is sufficient in most cases, as Ruby packages tend to be structured so that library code is found under the &lt;tt&gt;lib&lt;/tt&gt; directory.

The example above shows that you can use &lt;tt&gt;spec.require_path = '...'&lt;/tt&gt; instead of &lt;tt&gt;spec.require_paths = [...]&lt;/tt&gt;.  This is a shortcut, acknowledging that nearly all gems will have only one require path element.

Be careful about interpreting this attribute, however.  It is used to modify the &lt;tt&gt;LOAD_PATH&lt;/tt&gt;, and thus to resolve &lt;tt&gt;require&lt;/tt&gt; calls.  So if code calls &lt;tt&gt;require 'rake/packagetask'&lt;/tt&gt;, for example, and the &lt;tt&gt;require_paths&lt;/tt&gt; is set to &lt;tt&gt;lib&lt;/tt&gt;, then there had better be a file &lt;tt&gt;lib/rake/packagetask.rb&lt;/tt&gt;.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="required_ruby_version"&gt;required_ruby_version&lt;/a&gt;

&lt;em&gt;Type: Gem::Version::Requirement;   &lt;em&gt;Optional&lt;/em&gt;;   default = "&gt; 0.0.0"&lt;/em&gt;


h4. Description

The version of Ruby required to use the gem.


h4. Usage

&lt;pre&gt;
  # If it will work with 1.6.8 or greater...
  spec.required_ruby_version = '&gt;= 1.6.8'
  
  # ...but not with 1.7/1.8...
  spec.required_ruby_version = '~&gt; 1.6.8'
  
  # The typical case these days...
  spec.required_ruby_version = '&gt;= 1.8.1'
&lt;/pre&gt;


h4. Notes

See the RubyGems wiki for documentation on specifying versions.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="requirements"&gt;requirements&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;;   default = []&lt;/em&gt;


h4. Description

Lists the external (to &lt;nowiki&gt;RubyGems&lt;/nowiki&gt;) requirements that must be met for this gem to work.  It's simply information for the user.


h4. Usage

&lt;pre&gt;
  spec.requirements &lt;&lt; 'libmagick, v6.0 or greater'
  spec.requirements &lt;&lt; 'A powerful graphics card'
&lt;/pre&gt;


h4. Notes

For requirements that can be met by other gems, see &lt;a href="#dependencies"&gt;dependencies&lt;/a&gt;.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="rubyforge_project"&gt;rubyforge_project&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;&lt;/em&gt;


h4. Description

The RubyForge project corresponding to the gem.


h4. Usage

&lt;pre&gt;
  spec.rubyforge_project = 'rake'
&lt;/pre&gt;


h4. Notes

Obviously, if your gem doesn't have a Rubyforge project, leave this setting alone.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="rubygems_version"&gt;rubygems_version&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Optional&lt;/em&gt;;   default = "&lt;em&gt;current version of RubyGems&lt;/em&gt;"&lt;/em&gt;


h4. Description

The version of RubyGems used to create this gem.


h4. Usage

&lt;pre&gt;
  No usage ... it is set automatically when the gem is created.
&lt;/pre&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="specification_version"&gt;specification_version&lt;/a&gt;

&lt;em&gt;Type: Integer;   &lt;em&gt;Optional&lt;/em&gt;;   default = "&lt;em&gt;Revision level of the RubyGems specification this gem conforms to.&lt;/em&gt;"&lt;/em&gt;


h4. Description

The revision level of the GemSpec specification that this gem conforms to.


h4. Usage

&lt;pre&gt;
  No usage ... it is set automatically when the gem is created.
&lt;/pre&gt;

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="summary"&gt;summary&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Required&lt;/em&gt;&lt;/em&gt;


h4. Description

A short description of the gem.


h4. Usage

&lt;pre&gt;
  spec.summary = 'Ruby based make-like utility.'
&lt;/pre&gt;


h4. Notes

The summary is used to describe the gem in lists produced by the &lt;tt&gt;gem&lt;/tt&gt; tool.  See also &lt;a href="#description"&gt;description&lt;/a&gt;, which is less important.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="test_files"&gt;test_files&lt;/a&gt;

&lt;em&gt;Type: Array;   &lt;em&gt;Optional&lt;/em&gt;;   default = []&lt;/em&gt;


h4. Description

A collection of unit test files.  They will be loaded as unit tests when the user requests a gem to be unit tested.


h4. Usage

&lt;pre&gt;
  spec.test_files = Dir.glob('test/tc_*.rb')     # (1)
  spec.test_file  = 'tests/test-suite.rb'        # (2)
  spec.test_files = ['tests/test-suite.rb']      # (3)
&lt;/pre&gt;


h4. Notes

Example (1) specifies that all files matching &lt;tt&gt;tc_*.rb&lt;/tt&gt; in the &lt;tt&gt;test&lt;/tt&gt; directory are unit test files.

Example (2) shows that you can specify a test suite instead, which presumably loads individual test cases.  This uses the shortcut method &lt;tt&gt;test_file=&lt;/tt&gt;, and has the same effect as example (3).

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;

----


h3. &lt;a name="version"&gt;version&lt;/a&gt;

&lt;em&gt;Type: String;   &lt;em&gt;Required&lt;/em&gt;&lt;/em&gt;


h4. Description

The version of the gem.  See RationalVersioningPolicy for some advice on specifying the version number for your gem.


h4. Usage

&lt;pre&gt;
  spec.version = '0.4.1'
&lt;/pre&gt;


h4. Notes

The canonical way to represent versions in RubyGems is with the &lt;tt&gt;Gem::Version&lt;/tt&gt; class.  But the practical way to specify it in a gemspec is with a String.

The version string must consist purely of numbers and periods.

&lt;em&gt;Goto &lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/em&gt;
</description>
      <pubDate>Mon,  5 Jan 2009 12:37:07 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/20#page85</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/20#page85</link>
    </item>
    <item>
      <title>Jim Weirich: Installing a remote gem</title>
      <description>When you run (as root, if appropriate and necessary)

&lt;pre&gt;gem install --remote progressbar
# shortcut: gem i -r progressbar&lt;/pre&gt;

the _progressbar_ gem will be installed on your computer.  Notice that you don't need to specify the version, but you can if you want to.  It will default to the last version available.

&lt;pre&gt;gem ins -r progressbar-0.0.3&lt;/pre&gt;

or

&lt;pre&gt;gem ins -r progressbar --version '&gt; 0.0.1'&lt;/pre&gt;

In both cases, the output is simply:

  Attempting remote installation of 'progressbar'
  Successfully installed progressbar, version 0.0.3

RubyGems allows you to have multiple versions of a library installed and choose in your code which version you wish to use.

Useful extra options for installation are &lt;tt&gt;--gen-rdoc&lt;/tt&gt; for generating the gem's RDoc API documentation, and &lt;tt&gt;--run-tests&lt;/tt&gt; to run the gem's unit tests, if any.

Note too that when you remotely install a gem, it will download and install any specified dependencies.  Try installing *copland* and see that it prompts you to accept *log4r* as well (if it's not already installed).

</description>
      <pubDate>Sun, 20 May 2007 10:23:21 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/2#page5</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/2#page5</link>
    </item>
    <item>
      <title>Jim Weirich: Searching remotely installable gems</title>
      <description>When you run

&lt;pre&gt;  gem query --remote --name-matches doom
  # shortcut: gem q -R -n doom&lt;/pre&gt;

you will see a detailed list of _matching_ gems on the remote server.

Sample output:

&lt;pre&gt;
*** REMOTE GEMS ***

ruby-doom (0.8, 0.0.7)
    Ruby-DOOM provides a scripting API for creating DOOM
    maps. It also provides higher-level APIs to make map
    creation easier.
&lt;/pre&gt;

&lt;p&gt;When you run&lt;/p&gt;


&lt;pre&gt;  gem query --remote --name-matches doom
  # shortcut: gem q -R -n doom&lt;/pre&gt;

        &lt;p&gt;you will see a detailed list of &lt;em&gt;matching&lt;/em&gt; gems on the remote server.&lt;/p&gt;


        &lt;p&gt;Sample output:&lt;/p&gt;


&lt;pre&gt;
*** REMOTE GEMS ***

ruby-doom (0.8, 0.0.7)
    Ruby-DOOM provides a scripting API for creating DOOM
    maps. It also provides higher-level APIs to make map
    creation easier.
&lt;/pre&gt;</description>
      <pubDate>Sun, 20 May 2007 10:22:07 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/2#page4</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/2#page4</link>
    </item>
    <item>
      <title>Jim Weirich: Installing gems in a non-standard directory.</title>
      <description>p((. &lt;em&gt;How do I install gems in a non-standard location, such as my home directory?&lt;/em&gt;

You have to redefine the location of the GEM_HOME variable and add the paths to the gem repositories in the RUBYLIB variable before launching the installation into a custom directory.

GEM_HOME should point to $PREFIX/lib/ruby/gems/1.8 if it used with the 1.8 version of ruby.

RUBYLIB should point to the $PREFIX/lib/ruby and $PREFIX/lib/site_ruby/1.8

Here is a shell script that runs in the rubygems
distribution directory to install into /home/user :

  PREFIX=$HOME
  export GEM_HOME=$PREFIX/lib/ruby/gems/1.8 
  export RUBYLIB=$PREFIX/lib/ruby:$PREFIX/lib/site_ruby/1.8
  ruby setup.rb all --prefix=$PREFIX

You may add GEM_HOME and RUBYLIB into your ~/.profile file to automatically load on login.</description>
      <pubDate>Wed,  8 Nov 2006 00:52:31 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/15#page101</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/15#page101</link>
    </item>
    <item>
      <title>Jim Weirich: Installing gems in a non-standard directory.</title>
      <description>p((. &lt;em&gt;How do I install gems in a non-standard location, such as my home directory?&lt;/em&gt;

You have to redefine the location of the GEM_HOME variable and add the
paths to the gem repositories in the RUBYLIB variable before launching the
installation into a custom directory.

GEM_HOME should point to $PREFIX/lib/ruby/gems/1.8 if it used with the 1.8
version of ruby.

RUBYLIB should point to the $PREFIX/lib/ruby and $PREFIX/lib/site_ruby/1.8

Here is a shell script that runs in the rubygems
distribution directory to install into /home/user :

  PREFIX=/home/user
  export GEM_HOME=$PREFIX/lib/ruby/gems/1.8 
  export RUBYLIB=$PREFIX/lib/ruby:PREFIX/lib/site_ruby/1.8
  ruby setup.rb all --prefix=$PREFIX

You may add GEM_HOME and RUBYLIB into your ~/.profile file to
automatically load on login.</description>
      <pubDate>Wed,  8 Nov 2006 00:49:12 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/15#page101</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/15#page101</link>
    </item>
    <item>
      <title>Jim Weirich: Q: How do I install gems in my home directory?</title>
      <description>A: You have to redefine the location of the GEM_HOME variable and add the
paths to the gem repositories in the RUBYLIB variable before launching the
installation into a custom directory.

GEM_HOME should point to $PREFIX/lib/ruby/gems/1.8 if it used with the 1.8
version of ruby.

RUBYLIB should point to the $PREFIX/lib/ruby and $PREFIX/lib/site_ruby/1.8

Here is a shell script that runs in the rubygems
distribution directory to install into /home/user :

  PREFIX=/home/user
  export GEM_HOME=$PREFIX/lib/ruby/gems/1.8 
  export RUBYLIB=$PREFIX/lib/ruby:PREFIX/lib/site_ruby/1.8
  ruby setup.rb all --prefix=$PREFIX

You may add GEM_HOME and RUBYLIB into your ~/.profile file to
automatically load on login.</description>
      <pubDate>Wed,  8 Nov 2006 00:47:27 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/15#page101</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/15#page101</link>
    </item>
    <item>
      <title>Jim Weirich: Q1</title>
      <description>A1</description>
      <pubDate>Wed,  8 Nov 2006 00:46:44 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/15#page101</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/15#page101</link>
    </item>
    <item>
      <title>Chad Fowler: Using a gem in your code</title>
      <description>Here we demonstrate the use of the *progressbar* gem.  This library may use terminal features that are not available in your system.

If you wish, enter the following code into a file and run it. (Note that you must require the rubygems library before executing this code, as detailed in chapter 3 of this manual.)

&lt;pre&gt;
require 'progressbar'

bar = ProgressBar.new("Example progress", 50)
total = 0
until total &gt;= 50
  sleep(rand(2)/2.0)
  increment = (rand(6) + 3)
  bar.inc(increment)
  total += increment
end
&lt;/pre&gt;

Here is a "screenshot" of the partially complete progress bar.

  Example progr:  29% |ooooooooooo                             | ETA:  00:00:04

The first line of the program requires the progressbar library file.  RubyGems will look for the @progressbar.rb@ file in the standard library locations.  If not found, it will look through its gem repository for a gem that contains @progressbar.rb@.  If a gem is used, RubyGems attempts to use the latest installed version by default.

Note that the program was able to use the latest available installed gem by default _without_ any explicit action in the code.  The developer may develop a library without worrying about using RubyGems.

However, to _run_ the code, the environment does need to be "gem enabled". See "Setting Up the RubyGems Environment":http://docs.rubygems.org/read/chapter/3#page70 for details on how to make this happen.
</description>
      <pubDate>Fri, 22 Sep 2006 15:46:40 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/4#page16</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/4#page16</link>
    </item>
    <item>
      <title>Jim Weirich: Why does require return false when loading a file from a gem?</title>
      <description>p{font-style: italic}.  Require returns false when loading a file from a gem.  Usually require will return true when it has loaded correctly.  What's wrong?

h3. Answer

Nothing.  Well, something.  But nothing you need to worry about.

A false return from the require method does _not_ indicate an error.  It just means that the file has  already been loaded.

RubyGems has a feature that allows a file to be automatically loaded when a gem is activated (i.e. selected).  When you require a file that is in an inactive gem, the RubyGems software will activate that gem for you.  During that activation, any autoloaded files will be loaded for you.

So, by the time your require statement actually does the work of loading the file, it has already been autoloaded via the gem activation, and therefore it returns false.

As we said, it is not a problem, but it sure is confusing to folks doing requires in an irb session.  Future versions of RubyGems will correct this behavior.
</description>
      <pubDate>Thu,  6 Apr 2006 01:06:49 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page100</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page100</link>
    </item>
    <item>
      <title>Jim Weirich: Why does require return false when loading a file from a gem?</title>
      <description>p{font-style: italic}.  Require returns false when loading a file from a gem.  Usually require will return true when its loaded correctly.  What's wrong?

h3. Answer

Nothing.  Well, something.  But nothing you need to worry about.

A false return from the require method does not indicate an error.  It means that the file is already loaded.  Proabably the file was listed as an auto-required file in the gem, so when the gem was activated, the file was already loaded.  So when you explicitly require the file, the file has already been loaded, so require returns false.

I repeat, there is nothing wrong.

The only time this causes concern is when someone requires the file in an irb session and notices the return type.

However, the next version of RubyGems will correct this problem so that newcomers wont be surprised by the result.</description>
      <pubDate>Thu,  6 Apr 2006 00:58:38 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page100</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page100</link>
    </item>
    <item>
      <title>Jim Weirich: Why does require return false when loading a file from a gem?</title>
      <description>p{font-style: italic}.  Require returns false when loading a file from a gem.  Usually requrie will return true when its loaded correctly.  What's wrong?

h3. Answer

Nothing.  Well, something.  But nothing you need to worry about.

A false return from the require method does not indicate an error.  It means that the file is already loaded.  Proabably the file was listed as an auto-required file in the gem, so when the gem was activated, the file was already loaded.  So when you explicitly require the file, the file has already been loaded, so require returns false.

I repeat, there is nothing wrong.

The only time this causes concern is when someone requires the file in an irb session and notices the return type.

However, the next version of RubyGems will correct this problem so that newcomers wont be surprised by the result.</description>
      <pubDate>Thu,  6 Apr 2006 00:58:19 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page100</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page100</link>
    </item>
    <item>
      <title>Jim Weirich: Why does returns false when loading a file from a gem?</title>
      <description>p{font-style: italic}.  Require returns false when loading a file from a gem.  Usually requrie will return true when its loaded correctly.  What's wrong?

h3. Answer

Nothing.  Well, something.  But nothing you need to worry about.

A false return from the require method does not indicate an error.  It means that the file is already loaded.  Proabably the file was listed as an auto-required file in the gem, so when the gem was activated, the file was already loaded.  So when you explicitly require the file, the file has already been loaded, so require returns false.

I repeat, there is nothing wrong.

The only time this causes concern is when someone requires the file in an irb session and notices the return type.

However, the next version of RubyGems will correct this problem so that newcomers wont be surprised by the result.</description>
      <pubDate>Thu,  6 Apr 2006 00:57:52 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page100</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page100</link>
    </item>
    <item>
      <title>Jim Weirich: &lt;tt&gt;gemlock&lt;/tt&gt; script</title>
      <description>&lt;em&gt;(new in version 0.9.0)&lt;/em&gt;

The @gemlock@ script will generate a series of @require_gem@ commands that will lock down an application or library to a particular version of their dependent gems.

For example, if you wish to lock down a particular version of the Rails library, use:

&lt;pre&gt;
  $ gemlock rails-1.0.0
  require "rubygems"
  require_gem 'rails', '= 1.0.0'
  require_gem 'rake', '= 0.7.0.1'
  require_gem 'activesupport', '= 1.2.5'
  require_gem 'activerecord', '= 1.13.2'
  require_gem 'actionpack', '= 1.11.2'
  require_gem 'actionmailer', '= 1.1.5'
  require_gem 'actionwebservice', '= 1.0.0'
&lt;/pre&gt;

@gemlock@ will find all the direct and indirect gems required by rails-1.0.0 and specify the most recent, currently installed version of those gems.  The output should be place in the application (or library) will it will be run *before* any other require statement in the program.

If your application depends on more than one gem, just list all the gems in the command line and @gemlock@ will display the locking commands for all of them.

h3. Usage

&lt;pre&gt;
  Usage: bin/gemlock [options] GEM_NAME-VERSION...

  Where options are:
    -v, --verbose                    Verbose output
    -s, --[no-]strict                Fail if unable to satisfy a dependency
    -h, --help                       Show this message
    -V, --version                    Show version
&lt;/pre&gt;
</description>
      <pubDate>Tue,  4 Apr 2006 16:20:31 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/17#page99</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/17#page99</link>
    </item>
    <item>
      <title>Jim Weirich: &lt;tt&gt;gemlock&lt;/tt&gt; script</title>
      <description>&lt;em&gt;(new in version 0.9.0)&lt;/em&gt;

The @gemlock@ script will generate a series of @require_gem@ commands that will lock down an application or library to a particular version of their dependent gems.

For example, if you wish to lock down a particular version of the Rails library, use:

  $ gemlock rails-1.0.0
  require "rubygems"
  require_gem 'rails', '= 1.0.0'
  require_gem 'rake', '= 0.7.0.1'
  require_gem 'activesupport', '= 1.2.5'
  require_gem 'activerecord', '= 1.13.2'
  require_gem 'actionpack', '= 1.11.2'
  require_gem 'actionmailer', '= 1.1.5'
  require_gem 'actionwebservice', '= 1.0.0'

@gemlock@ will find all the direct and indirect gems required by rails-1.0.0 and specify the most recent, currently installed version of those gems.  The output should be place in the application (or library) will it will be run *before* any other require statement in the program.

If your application depends on more than one gem, just list all the gems in the command line and @gemlock@ will display the locking commands for all of them.

h3. Usage

  Usage: bin/gemlock [options] GEM_NAME-VERSION...

  Where options are:
    -v, --verbose                    Verbose output
    -s, --[no-]strict                Fail if unable to satisfy a dependency
    -h, --help                       Show this message
    -V, --version                    Show version

</description>
      <pubDate>Tue,  4 Apr 2006 16:19:28 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/17#page99</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/17#page99</link>
    </item>
    <item>
      <title>Jim Weirich: &lt;tt&gt;gemlock&lt;/tt&gt; script</title>
      <description>The @gemlock@ script will generate a series of @require_gem@ commands that will lock down an application or library to a particular version of their dependent gems.

For example, if you wish to lock down a particular version of the Rails library, use:

  $ gemlock rails-1.0.0
  require "rubygems"
  require_gem 'rails', '= 1.0.0'
  require_gem 'rake', '= 0.7.0.1'
  require_gem 'activesupport', '= 1.2.5'
  require_gem 'activerecord', '= 1.13.2'
  require_gem 'actionpack', '= 1.11.2'
  require_gem 'actionmailer', '= 1.1.5'
  require_gem 'actionwebservice', '= 1.0.0'

@gemlock@ will find all the direct and indirect gems required by rails-1.0.0 and specify the most recent, currently installed version of those gems.  The output should be place in the application (or library) will it will be run *before* any other require statement in the program.

If your application depends on more than one gem, just list all the gems in the command line and @gemlock@ will display the locking commands for all of them.

h3. Usage


</description>
      <pubDate>Tue,  4 Apr 2006 16:18:16 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/17#page99</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/17#page99</link>
    </item>
    <item>
      <title>Jim Weirich: &lt;tt&gt;gemlock&lt;/tt&gt; script</title>
      <description>The @gemlock@ script will generate a series of @require_gem@ commands that will lock down an application or library to a particular version of their dependent gems.
</description>
      <pubDate>Tue,  4 Apr 2006 16:08:52 EDT</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/17#page99</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/17#page99</link>
    </item>
    <item>
      <title>Jim Weirich: No such file to load -- rubygems</title>
      <description>p{font-style: italic}. When I run the &lt;tt&gt;gem&lt;/tt&gt; command, I get the following error message:

&lt;pre&gt; ruby: No such file to load -- rubygems (LoadError)&lt;/pre&gt;

p{font-style: italic}. What's wrong?

h3. Answer

It looks like executing copy of Ruby does not have the RubyGems library installed.  RubyGems was probably installed at one time (because the &lt;tt&gt;gem&lt;/tt&gt; command is recognized), but it may have been installed on a different installation of Ruby than the one you are currently running.

h4. Things to check

* Check that the installation of Ruby that is running is the same one that has RubyGems installed.  On a unix system, the &lt;tt&gt;which&lt;/tt&gt; command (or &lt;tt&gt;type&lt;/tt&gt; command) will help figure this out.

* Verify that the currently running installation of Ruby does indeed have the RubyGems library installed.  You should find a "&lt;tt&gt;rubygems.rb&lt;/tt&gt;" file in the site_ruby/1.8 directory of the Ruby installation.

These mixup can easily happen after installing a new instance of Ruby, but the old instance preceeds the new one in the PATH list.</description>
      <pubDate>Thu, 29 Dec 2005 10:03:09 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page98</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page98</link>
    </item>
    <item>
      <title>Jim Weirich: No such file to load -- rubygems</title>
      <description>p{font-style: italic}. When I run the &lt;tt&gt;gem&lt;/tt&gt; command, I get the following error message: ruby: 

&lt;pre&gt;No such file to load -- rubygems (LoadError)&lt;/pre&gt;

p{font-style: italic}. What's wrong?

h3. Answer

It looks like executing copy of Ruby does not have the RubyGems library installed.  RubyGems was probably installed at one time (because the &lt;tt&gt;gem&lt;/tt&gt; command is recognized), but it may have been installed on a different installation of Ruby than the one you are currently running.

h4. Things to check

* Check that the installation of Ruby that is running is the same one that has RubyGems installed.  On a unix system, the &lt;tt&gt;which&lt;/tt&gt; command (or &lt;tt&gt;type&lt;/tt&gt; command) will help figure this out.

* Verify that the currently running installation of Ruby does indeed have the RubyGems library installed.  You should find a "&lt;tt&gt;rubygems.rb&lt;/tt&gt;" file in the site_ruby/1.8 directory of the Ruby installation.

These mixup can easily happen after installing a new instance of Ruby, but the old instance preceeds the new one in the PATH list.</description>
      <pubDate>Thu, 29 Dec 2005 10:02:21 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page98</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page98</link>
    </item>
    <item>
      <title>Jim Weirich: No such file to load -- rubygems</title>
      <description>p{font-style: italic}. When I run the &lt;tt&gt;gem&lt;/tt&gt; command, I get the following error message: ruby: 

&lt;pre&gt;No such file to load -- rubygems (LoadError)&lt;/pre&gt;

p{font-style: italic}. What's wrong?

h3. Answer


</description>
      <pubDate>Thu, 29 Dec 2005 09:54:38 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page98</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page98</link>
    </item>
    <item>
      <title>Jim Weirich: RubyGems hangs while updating the source index.</title>
      <description>p{font-style: italic}. I have a problem with RubyGems. It doesn't matter what I try to install with, it freezez.

p{font-style: italic}. Particulary I tried to execute:

    gem install rails --include-dependencies

p{font-style: italic}. but the command freezez at the following message:

    "Updating Gem source index for: http://gems.rubyforge.org"

h3. Answer

[I lost my internet connection while composing the answer to this question.  Unfortunately, I now no longer recall what I intended to write.  The answer (or at least part of the answer) is buried deep in the RubyGems mail archive.  I'll try to update this after a bit of research.  Sorry for leaving this question hanging.] 

</description>
      <pubDate>Tue, 20 Dec 2005 14:24:25 EST</pubDate>
      <guid>http://gemtacular.rubygems.org/read/chapter/19#page96</guid>
      <link>http://gemtacular.rubygems.org/read/chapter/19#page96</link>
    </item>
  </channel>
</rss>
