I am trying to install ruby-mp3info as a gem on my computer.
Running sudo gem install ruby-mp3info seems to work OK.
In my environment.rb file, I added config.gem "ruby-mp3info".
When I try to run the server, it fails, claiming I have some missing gems
Following the error message's advice:
Run `rake gems:install` to install the missing gems.
I run the command, which simply returns my local path. Running the server again - I get the same error message.
Could someone explain what I am doing wrong? How does one go about installing gems from RubyForge - or in general?
How does the gem command know where to find the necessary files - they are not all stored on my computer. Does it have hardcoded urls built into it?
Here's what did the trick.
In my environment.rb file, I had the following:
config.gem "ruby-mp3info"
Playing around with the options, I found that I had to specify the lib attribute:
config.gem "ruby-mp3info", :lib => "mp3info"
This solved the problem.
I've run into a similar problem on servers when running Phusion Passenger (mod_rails). Problem being I forget to update the Passenger gem repository like this:
/opt/ruby-enterprise-1.8.6-20090421/bin/gem install whatever
instead of simply this:
gem install whatever
It would be a useful utility for someone to write, keeping the 2 gem repos in sync.
Related
i was told that using config.gem alongside :path => "path/to/dir" would work.
on server restart though environment.rb does not pull the gem im pointing at.
anyone have any ideas?
SO it seems running bundler was the way to go.
in console:
gem install bundle
then
gem list
copy those gems and format them like this: http://gembundler.com/gemfile.html. Then place them in Gemfile (home dir)
NOW for the LOCAL gem ( which i have stored in project/local_gems/thin-1.2.10 ) i placed this in the Gemfile
gem "thin", :path => "local_gems/thin-1.2.10/"
next:
bundle install
NOW... heres the tricky bit.. when running 'thin' as you web server its necessary to run thin commands within the bundled environment SO:
bundle exec thin start
and there you have it ! Running a ' thin ' web server on rails 2.3.8 using bundler!
Its is worthwhile to note that you WILL NOT see updates to you local gem file until:
- you stopped the server ( ctrl + c )
- saved all files associated with that gem,
- redo 'bundle install'
- THEN run server again to see changes
Are you sure you are using rvm, and the rvm version you want to be using, when you are installing your gem? You might be trying to install the gem using your system ruby. If all that is the case, then you might want to set your default rvm version to be the one you want to use. Then you will always get the gems into that rvm version.
I am following the tutorial on railstutoiral.org and encounter the following error: "ZenTest is not part of the bundle. Add it to Gemfile. (Gem::LoadError)." I have ZenTest (4.4.2) installed according to gemlist so what's wrong? Thanks!
Open 'Gemfile' in the root of your rails application, and add a section like this to the bottom:
group :development, :test do
gem 'ZenTest'
end
Then at the command line, type:
bundle install
This command will install the gem and associate it with your application. It might take a few minutes :)
The cause of your problem is that under rails 3, rubygems are managed by a tool called bundler, which manages all the dependencies between your gems and ensures that your application is always started with the right versions of the right gems, even when you move it between servers.
One more thing to note is that if you want to run a command from a gem you've installed using bundler, you need to type 'bundle exec <command>' to ensure the right environment is established to run the command.
Even if you have it installed it isn't getting loaded because it says it isn't in the Gemfile. The Gemfile exists at the root of your project directory.
Rails 3.0.0, Passenger 2.2.15:
Create a new Rails project
Add gem 'paperclip', :git => 'git://github.com/lmumar/paperclip.git', :branch => 'rails3'
to your Gemfile
Do bundle install
Everything OK, starting with rails/script server & accessing also works
However, when accessing with Passenger, it says:
git://github.com/lmumar/paperclip.git (at rails3) is not checked out. Please run bundle install (Bundler::GitError)
I have tried bundler pack (doesn't help) and setting BUNDER_HOME to ~/.bundler (the Paperclip git gets installed there by bundler install) in the .htaccess and various places in config/*.rb, but this wasn't successful, too.
~/.bundler is owned by the same user as the Rails project (Passenger runs under this user), so it can't be a permission problem. sudo is installed and called by bundle install.
Any hints?
Im used to have this problem, resolve using
bundle --deployment
Which will install the gems in vendor/bundle
Solution (took me a few hours):
Mare sure that RAILS_ROOT/.bundle/config (SetEnv etc. didn't work for me) contains:
---
BUNDLE_PATH: /home/xxxxx/.bundler
Note BUNDLE_PATH, not BUNDLER_PATH! There was also an DISABLED_SHARED_GEMS=1 entry, I removed it.
Then bundler recognises the correct path even when loaded from Passenger. Without Passenger, it always worked (and used /home/xxxxx/.bundler, as said in the question)
You can use bundle install --path vendor/bundle to install the gems locally, instead of into system gems.
If you want to keep using system gems, though, it's just one line in your Apache configuration to tell Passenger where to find your system gems:
SetEnv GEM_HOME /Users/bob/.bundle
There's a slightly more elaborate writeup on my blog at Using Passenger with GEM_HOME set
I ran into this problem while writing a Sinatra app. To solve it I added this line to config.ru.
require 'bundler/setup'
I had the same problem and it was due to a rights issue with RVM.
The user that run the web server can not check if GIT gem is available.
As "Passenger" using the web user to run, it can not do this check.
The solution I found was to add web user to rvm group:
usermod -a -G rvm apache
I hope this will help some other people that don't want to have GEM deployed into "vendor/bundle".
I installed the passenger gem and its apache module as a sudo user and that was the problem in my case.
The reason why I used sudo initially was that I copied the code from railscasts' episode 122. Installing it without sodu access resolved this issue. Since Ruby was installed using rvm without the sudo access on my system.
I am working on a project and i was trying make it up and running in my local machine. But unfortunately the app is using a gem data_warehouse( found gem 'data_warehouse', '= 1.5.2' in environment.rb), I tried to look for this gem but can't find this gem, I was unable to run the application because of this. I never used data warehousing in ruby on rails either. I am slightly aware of the concept data warehousing. If any one aware of this gem please post the url for this gem or an alternate solution for avoiding this problem.
Neither can I. Now, assuming that you have a production machine where this gem is found:
You can see the installed gems with:
gem list
Go to production machine and run
gem env
There, you should see something like
REMOTE SOURCES:
http://gems.rubyforge.org/
http://gems.github.com/
After running the same command on your local computer, you can add the missing remote sources with:
sudo gem sources -a "http://missing_remote_sources"
and then try to install your gem.
If this doesn't work, you could also try a monkey-patch. Run
rake gems:unpack
on your production server. After this, you will be able to find your gem in the /vendor/gems folder. Copy the folder into your local vendor folder and it should work.
Btw, as it could just be a typo: have you tried commenting the line in the config file?
I get this error when launching my Mongrel server...
$ script/server --debugger
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
config.gem: Unpacked gem authlogic-2.1.3 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
=> Debugger enabled
=> Call with -d to detach
=> Ctrl-C to shutdown server
When I run rake gems:refresh_specs like it suggests I get another error though:
rake aborted!
undefined method `installed_source_index' for #<Gem::SourceIndex:0x100551a58>
Any thoughts on how to fix this?
I am not sure why it is broken in Authlogic, but I had to generate it myself.
Try this in your Rails project:
$prompt> cd vendor/gems/authlogic-2.1.3
$prompt> gem specification authlogic > .specification
I'm just going to chime in here, because I experience the same thing today, except with a different gem.
I was updating hoptoad to use the notifier as a gem instead of a plugin, and one of the instructions from the Github page is to unpack the gem into vendor/gems.
I'm on Mac OS X, and I unpacked the gem as so:
$> rake gems:unpack GEM=hoptoad_notifier
After I did this, I got the error specified, and the gem didn't actually unpack (it created the directory in vendor/gems, but didn't actually unpack the gem).
I deleted the directory from vendor/gems, and tried again as:
$> sudo rake gems:unpack GEM=hoptoad_notifier
Worked this time, unpacked properly, and no error.
I believe this is the reason:
http://github.com/binarylogic/authlogic/commit/05e452472616bd60bb81affc75a1cb3d95cf7857
The owner purposely added the gitignore on the .specification file.
I'm guessing u freeze this particular gem and submit it in your code branch under vendor/gems/..and as expected, git ignore this particular file per request
I had to pop into vendor/gems/authlogic and remove '.specification' from the .gitignore
Once you've done that you can run rake gems:refresh_specs
Only problem is that the next time you upgrade this gem the bad .gitignore comes back
I had the same "unknown GEM" problems. After much faffing about I found the following recipe :
First, I installed the gem using the standard "gem install authlogic", which placed the gem in /Library/Ruby/Gems/1.8.
Within RadRails, I used the rake task "gems:unpack" which seems to gather all the gems relevant to your app and place them in /vendor/gems as desired.
I then uninstalled the system wide gem to check it has really worked with : gem uninstall authlogic --install-dir=/Library/Ruby/Gems/1.8
Seems to work well.
Build and install the gem before generating the .specification file
$prompt> cd vendor/gems/authlogic-2.1.3
$prompt> gem build authlogic.gemspec
$prompt> gem install authlogic.gemspec
$prompt> gem specification authlogic > .specification