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
94
votes
5 answers

Ruby Gemspec Dependency: Is possible have a git branch dependency?

Is possible have a git branch dependency, inside mygem.gemspec? I'm thinking something similar to the following: gem.add_runtime_dependency 'oauth2', :git => 'git@github.com:lgs/oauth2.git' ... but it doesn't work.
Luca G. Soave
  • 12,271
  • 12
  • 58
  • 109
34
votes
3 answers

How to add dependency of a local gem to a rails plugin/engine, in .gemspec file

I had tried in this way: s.add_dependency 'gem', :path => '../gem' like add gem in the gemfile, but it doesn't work, and will cause this error: /Users/chenqh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb:81:in…
24
votes
2 answers

Trying to build a gem, getting a Gem::InvalidSpecificationException: "[...] are not files"

I'm trying to build a custom gem I wrote called client_package but it is failing. My directory structure looks like this: client_package Gemfile Gemfile.lock client_package.gemspec Rakefile Readme.md .gitignore .git …
Ben Lee
  • 52,489
  • 13
  • 125
  • 145
22
votes
2 answers

Gemspec: How can I specify dependencies which don't have to be auto-required?

I wrote a gem with a certain array of dependencies, and some of them I'd like not to have implicitly required when bundled into another project. An example is the uuidtools gem, which I only want to require in files using it.…
ChuckE
  • 5,610
  • 4
  • 31
  • 59
19
votes
3 answers

Invalid gemspec -Illformed requirement ["# 3.2.0"]

Invalid gemspec in [/usr/lib/ruby/gems/1.8/specifications/activemodel-3.2.0.gemspec]: Illformed requirement ["# 3.2.0"] From trying to do a sudo gem update for other issues getting this hundreds of time as sudo…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
19
votes
1 answer

How do I get the version from a gemspec file?

Is there a clean way to extract the version string from a .gemspec file? (The gem is not yet installed) e.g. somethingcool.gemspec is Gem::Specification.new do |s| s.name = "somethingcool" s.version = "1.2.3" ... etc ... end I want to extract…
Gavin Brock
  • 5,027
  • 1
  • 30
  • 33
17
votes
3 answers

Specify a plugin as gem from github in Gemfile

I am including 'acts_as_rateable' gem in my Gemfile like this gem 'acts_as_rateable', :git => 'git://github.com/azabaj/acts_as_rateable.git' and then when I do bundle install it gives me this error message! Could not find gem 'acts_as_rateable …
Madhusudhan
  • 8,374
  • 12
  • 47
  • 68
16
votes
4 answers

Rails: Gemspec is not valid. Please fix this gemspec

When I install a gem from github it gives me the error: number_internationalizer at /usr/local/rvm/gems/ruby-1.9.3-p194@number_internationalizer/bundler/gems/number_internationalizer-c0d642b04e87 did not have a valid gemspec. This prevents bundler…
Bishma Stornelli
  • 2,539
  • 4
  • 22
  • 30
16
votes
1 answer

What does $:.push do in ruby?

I found this in Gemspec file of surveyor gem. What does the following line do? $:.push File.expand_path("../lib", __FILE__) require "surveyor/version" Why does the $:.push thing do? To me it looks like its just requires the ../lib/surveyor/version…
CuriousMind
  • 33,537
  • 28
  • 98
  • 137
14
votes
1 answer

What are `files`, `executables`, `test_files`, and `require_paths` in gemspec file?

I am not clear on what certain specifications in the .gemspec file are doing. Specifically, spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files =…
Aaron
  • 6,466
  • 7
  • 37
  • 75
13
votes
1 answer

How do i use a dependency from github in my gemspec?

I currently have the following in my Gemfile: gem 'voteable_mongo'#, :github => 'kamilski81/voteable_mongo' and I migrating my models into a .gemspec, but i'm not sure how this would look inside my gemspec. I currently have: s.add_dependency…
Kamilski81
  • 14,409
  • 33
  • 108
  • 161
12
votes
6 answers

Could not find 'ffi' (>= 1.3.0) among 85 total gem(s) (Gem::MissingSpecError) React native IOS on pod install

Hi I'm trying to run my react native app on mac mini. I can run another app also this app to but when i write pod install in terminal it gives this error. 1: from…
tryingtofix
  • 123
  • 1
  • 1
  • 6
12
votes
3 answers

How can I avoid bundlers warning about multiple sources when I have all gems in my .gemspec?

In my own gem, I have a Gemfile that looks basically like this: source 'https://my.gemserver.com' source 'https://rubygems.org' gemspec My .gemspec has all dependencies listed as add_dependency and add_development_dependency. As of Bundler 1.8, I…
Christoph Petschnig
  • 4,047
  • 1
  • 37
  • 46
11
votes
1 answer

How to specify source in .gemspec file?

I'm building a gem that uses rails-assets-growl gem. This gem can be added to my Gemfile using a different source than 'https://rubygems.org' like this: source 'https://rails-assets.org' do gem 'rails-assets-growl' end This works fine in…
Leantraxxx
  • 4,506
  • 3
  • 38
  • 56
10
votes
1 answer

Jeweler adds circular dependency to my gem

Gem's(gemfoo) jeweler declaration in Rakefile looks like that: Jeweler::Tasks.new do |gem| #truncated gem.add_runtime_dependency 'nokogiri', '~> 1.4.1' gem.add_development_dependency 'jeweler' end The problem is…
user80805
  • 6,088
  • 5
  • 28
  • 31
1
2 3 4 5 6 7 8