Questions tagged [gemspecs]

The gemspec file defines a Gem::Specification object.

A gem consists of two things:

  1. some code
  2. a gemspec file

The gemspec file defines a Gem::Specification object. It contains the required information for a gem. Starting in RubyGems 2.0, a Specification can hold arbitrary metadata.

REQUIRED GEMSPEC ATTRIBUTES

  • author=
  • authors=
  • files
  • name
  • platform=
  • require_paths=
  • rubygems_version
  • summary
  • version

Apart from the list, there are some more attributes that can be included in the gemspec file. These attributes are optional. Some of them are license=, description etc.

117 questions
9
votes
2 answers

Can anyone tell me what the purpose of a Gemspec file in Ruby is?

After combing through Google I know what goes in a gemspec file for my project, but I have no clue as to why we need it, I guess I'm looking for a practical definition. (Currently working through Learn Ruby the Hard Way by Zed Shaw, this was one of…
Sergio Mendoza
  • 151
  • 2
  • 6
8
votes
1 answer

Is there a way to print a message after a user installs a Ruby gem?

Is there a way to configure a gem's gemspec to print an important informational message right after someone downloads and installs the gem using gem install?
dan
  • 43,914
  • 47
  • 153
  • 254
7
votes
2 answers

Attemping to vendorize a gem into bundler with Rails 3, but Gem has no Gemspec

Following these easy steps: gem unpack spree_easy_contact -v 1.0.2 --target vendor/gems Unpacked gem: '../vendor/gems/spree_easy_contact-1.0.2' And then in my Gemfile I add this line : gem "spree_easy_contact", :path =>…
Trip
  • 26,756
  • 46
  • 158
  • 277
7
votes
1 answer

Conditional ruby gem dependencies within a gemspec

I'm building a rails engine which uses foreign keys in migrations. add_foreign_key "theblog_content_nodes", "theblog_content_statuses", column: :content_status_id From the version 4.2 rails supports foreign keys by itself…
Nickolay Kondratenko
  • 1,871
  • 2
  • 21
  • 25
6
votes
1 answer

gem.add_dependency Jeweler how do you format a git source?

I'm trying to specify a git source in my Jeweler Rake file: gem.add_dependency 'myapp', :git => "git@github.com:myaddress/myapp.git", :branch => "mybranch" but I hit a format error. Do you know how to format this?
JZ.
  • 21,147
  • 32
  • 115
  • 192
6
votes
2 answers

In Rails 3's "bundle install" of local gem (frozen gem), keep getting "Source does not contain any versions of ..."?

I am using a gem which is in vendor/gems/some-api-0.1.0, copied over from another project, and added to Gemfile: gem 'some-api', :path => '~/development/myproj/vendor/gems/some-api-0.1.0' but if I do the following, it will fail with the message: $…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
5
votes
1 answer

Strange errors when installing my gem

I just released v2.0.0 of the ginjo-rfm gem. When I install this gem on a stock Snow Leopard machine (rubygems version 1.3.5), I get the following error: admin$ sudo gem install ginjo-rfm --no-rdoc --no-ri ERROR: Error installing ginjo-rfm: …
wbr
  • 73
  • 1
  • 5
5
votes
1 answer

gem push results in "package metadata is missing"

I'm trying to push my updated gem to rubygems.com and am getting the following result. ~/dev/V2/V2GPTI (master) $ gem build v2gpti.gemspec Successfully built RubyGem Name: v2gpti Version: 0.2 File: v2gpti-0.2-universal-darwin-13.gem …
Jeff Wolski
  • 6,332
  • 6
  • 37
  • 69
5
votes
2 answers

bundle install causes validation error after moving file

In my gem development directory, I moved the file lib/project/module.rb to lib/project/helpers/module.rb and then did bundle install This gave me an invalid gemspec error project at /path/project did not have a valid gemspec. This prevents …
frediy
  • 1,766
  • 15
  • 16
5
votes
3 answers

Ruby_Installation_Error_Watir

I'm running into the following error: #ERROR C:\Users\Farooq>D: D:\>irb irb(main):001:0> require 'rubygems' => false irb(main):002:0> require 'watir' LoadError: cannot load such file -- watir/loader from…
khan
  • 547
  • 3
  • 18
5
votes
1 answer

Adding multiple gem dependencies in gemspec

How do you guys add multiple development/runtime dependencies to your gemspec? This is the way I do it: spec.add_development_dependency 'example1', '~> 1.1', '>= 1.1.4' spec.add_development_dependency 'example2', '~> 1.1', '>= 1.1.4' But I'd like…
Cecille Manalang
  • 213
  • 3
  • 14
4
votes
1 answer

Why 'bundler gem' adds 'rake' and 'rspec' to Gemfile and not to .gemspec file as a development dependencies?

I am not well familiar with Ruby world. Java build tools usually use test scope for things like jUnit. I initialized a new project with command: bundle gem new_gem_from_bundler and the content of Gemfile is source "https://rubygems.org" # Specify…
Kirill
  • 6,762
  • 4
  • 51
  • 81
4
votes
1 answer

What are the best practices for updating a gemspec's file list?

Regarding the files list for gemspecs. I've noticed that jeweler updates this list manually with a listing of files in the project. e.g. Gem::Specification.new do |s| # stuff s.files = [ "lib/somegem.rb", "README.md" ] # ... more…
4
votes
1 answer

Does gem spec. name have to equal the gem constant name?

tl;dr I'm trying to break out a part of a larger application as a mountable engine. The engine will exist in different flavors, each contained in their own gem. I can't get the gem name be different from the engine constant name. Details The…
4
votes
2 answers

How to package application layout into a Ruby gem?

I'm working on a project comprising three different applications. They are supposed to share some models and the outer layout. To avoid code duplication, I'm trying to extract the application layout…
Arthur Alkmim
  • 237
  • 1
  • 2
  • 10