I tried to update the specs on a gem that didn't have a .specification file.
1. cd {application_home_directory}
2. rake gems:refresh_specs
When I did, I received the recursive warning:
config.gem: Unpacked gem in vendor/gems has no specification file.
Run 'rake gems:refresh_specs' to fix this.
I've also tried this, which also fails to create a specification without any error/warning:
1. cd vendor/gems/gemname
2. gem specification gemname > .specification
What could prevent the creation of a gem specification file in these cases?
Do you have config.gem statements for your gems in your environment.rb file? In my experience, you need to have the gems set up in your configuration in order for rake gems:refresh_specs to know about them.
Related
I have a custom ruby gem that relies heavily on bundle console. Nothing special or fancy, just an interactive console with the set of gems defined by the Gemfile included. We use the console a lot during development.
Currently when I run the command, I receive the following deprecation message:
[DEPRECATED] bundle console will be replaced by bin/console generated by bundle gem <name>
Digging around in the bundler docs I found the following explanation:
The bundle console will be removed and replaced with bin/console.
Over time we found bundle console hard to maintain because every
user would want to add her own specific tweaks to it. In order to
ease maintenance and reduce bikeshedding discussions, we're removing
the bundle console command in favor of a bin/console script
created by bundle gem on gem generation that users can tweak to
their needs.
Can anyone with knowledge provide a more detailed explanation? This gem currently does not have a bin directory. I'm happy to make one, I'm just not sure what should be in the file. Running bundle gem as described in the note above raises an error (as expected).
This is the file that is generated at bin/console:
#!/usr/bin/env ruby
require "bundler/setup"
require "(your gem name here)"
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start
require "irb"
IRB.start(__FILE__)
You can see the template in the rubygems GitHub repo.
I work with JRuby and Rails 3.2 but now I've found I got to work on a project on Rails 2.
I know some basic things about Rails 2 like the command jruby ./script/server to start the server instead of rails s but when we start talking about gems in Rails 2 things get complicated for me.
Right now I need to run the project and I'm getting the next errors:
First this repetitive message:
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from C:/jruby-.6.7.2/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91.
Also this:
config.gem: Unpacked gem activerecord-jdbc-adapter-0.9 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem activerecord-jdbcmysql-adapter-0.9 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem builder-2.1.2 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem ci_reporter-1.6.0 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem CVS in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem CVS in vendor/gems not in a versioned directory. Giving up.
config.gem: Unpacked gem jdbc-mysql-5.0.4 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem remarkable-3.1.8 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem remarkable_activerecord-3.1.8 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem remarkable_rails-3.1.6 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem ruby-ole-1.2.10.1 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem spreadsheet-0.6.4.1 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
config.gem: Unpacked gem will_paginate-2.2.2 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
And finally right when the server it's about to start:
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
WARNING: Using default logging
RuntimeError: will_paginate 3.0 is not compatible with Rails 2.3 or older
(root) at C:/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/will_paginate-3.0.4/lib/will_paginate.rb:8
require at org/jruby/RubyKernel.java:1033
require at C:/jruby-1.6.7.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:60
require at C:/jruby-1.6.7.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55
require at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:156
new_constants_in at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:521
new_constants_in at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:520
require at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:156
(root) at C:/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/will_paginate-3.0.4/lib/will_paginate.rb:67
require at org/jruby/RubyKernel.java:1033
require at C:/jruby-1.6.7.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
require at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:156
new_constants_in at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:521
new_constants_in at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:520
require at D:/MyProject/vendor/rails/activesupport/lib/active_support/dependencies.rb:156
(root) at D:/MyProject/config/environment.rb:84
require at org/jruby/RubyKernel.java:1033
require at D:/MyProject/vendor/rails/railties/lib/commands/server.rb:36
(root) at ./script/server:3
I would provide any other details to help solving this just let me know. Thnaks!
I'm getting a very strange error from rspec:
$ rspec spec
invalid option: --default_path=spec
I'm in a rails 4, ruby 2 app and I've updated everything to rspec-rails 3.0.0.beta. I've dumped and re installed rspec, .rspec, and spec_helper.rb.
You're probably using a different version of RSpec. The tests run fine from the balanced-ruby project. Make sure you have this line in the Gemfile:
gem "rspec", '~> 2.10'
Then run bundle install and finally try again with bundle exec rspec spec.
This is old but for whomever Googles this: in addition to checking your Gemfile, take a look at your repo's .rspec config file to see if there is an issue. If that doesn't fix it, check your environment to see if you have a global .rspec config file. Try cat ~/.rspec to see if you have one and if there are any issues with it. The global config caused issues for me.
I unpacked a gem into my vendor/gems directory and tried to run my Rails app.
I got this message:
Unpacked gem in vendor/gems not in a versioned directory
I don't understand this error and judging by the Google search results for this error there are not many people who have experienced this problem.
Could this mean I also need to vendor Rails to use vendor/gems?
The much easier and more robust way is to use gem dependencies.
Then if you want to unpack your gems into vendor/gems its as easy as typing:
rake gems:unpack
You do not need to vendor rails in order to vendor gems, the error appears to be a user error you are decompressing the gem into the wrong location and missing some version info.
You don't need to vendor Rails to use vendor gems.
Normally gems unpack to a directory called something like vendor/gems/some_gem-1.2.3. Check that all your vendored gem directories follow this pattern (i.e. GEM_NAME-VERSION).
Did you do this manually or using rake? Since a gem in the vendor/gems directory has this format - gem-name-VERSION.
For example the ruby-openid gem will be unpacked to vendor/plugins/ruby-openid-2.1.7/.
Try using rake gems:unpack to unpack the gems.
In my rails application I once used authlogic-oid and ruby-openid. Now I want to get rid of them and I removed both gems and also their config.gem lines from my environment.rb.
Although my application works, I can't do any database migrations because I get a "Missing these required gems" error. Also if I run rake gems:install these gems are re-installed.
Where are the references to the gems stored?
The standard way to define a gem dependency is in the environment configuration. It usually takes place in the environment.rb file for any environment, but some gems might be specified also per-environment. Check the environment files in config/environments.
Also make sure some file doesn't include the gem with the classic RubyGems gem command.
Finally, check these gems are not required by other gems or plugins used by your application.