Rspec bundle is broken in TextMate and rvm - ruby

I've had a difficult time since I started using rvm. I've done all the rvm/textmate set up and have the latest bundles but I still can't run Rspec test from textmate.
I have the latest bundle from github.com/rspec/rspec-tmbundle.git
and it's installed in ~/Library/Application\ Support/TextMate/Bundles/
RSpec.tmbundle
RVM default is using the system ruby 1.8.6
Rspec gem versions
gem list --local | grep spec
blue_light_special (0.2.0)
rspec (2.2.0)
rspec-core (2.2.1, 2.0.1)
rspec-expectations (2.2.0, 2.0.1)
rspec-mocks (2.2.0, 2.0.1)
rspec-rails (2.0.1, 1.3.2)
TextMate
TM_RUBY=/Users/jspooner/.rvm/bin/rvm-auto-ruby
The Error: rspec/core (LoadError)
/Users/jspooner/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/rspec/mate.rb:29:in require': no such file to load -- rspec/core (LoadError) from /Users/jspooner/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/rspec/mate.rb:29 from /tmp/textmate-command-8073.rb:2:inrequire' from /tmp/textmate-command-8073.rb:2

The best solution I've found is from Jacques Crocker.
http://groups.google.com/group/rubyversionmanager/browse_thread/thread/64b84bbcdf49e9b?fwc=1
It requires replacing the contents of textmate_ruby with the code below and never running rvm wrapper xxx textmate again.
#!/usr/bin/env sh
source ~/.rvm/scripts/rvm
cd .
exec ruby "$#"
This has also fixed the same issue with the cucumber bundle.

Did you try following the instructions here: http://rvm.io/integration/textmate/

My case is slightly different but took me more than an hour to figure out:
Turns out I ran rvm wrapper ree textmate a while after installing ree with rvm and in the mean time the ree shorthand changed from meaning ree-1.8.7-2010.01 to ree-1.8.7-2010.02
here's more details on my message:
https://gist.github.com/721987
I'm posting it here too because it's one of the first pages I landed onto while trying to figure this one out.

I've got a similar problem and figured out that my textmate ruby wrapper is pointing to a different version. I was able to get it work by putting below content in projectx/.rvmrc
rvm 1.9.2#projectx --create
rvm wrapper 1.9.2#projectx textmate
Hope this helps.

Related

Mysterious LoadError on installed gem with bundler

The following terminal session explains the problem. I don't understand how it's possible that I'm getting a load error on an installed gem.
The sailthru gem which isn't loading is something I installed today, which may be relevant. I verified it was installed to the same location as my other gems, and I also tried restarting the Terminal app. I'm using rbenv on a mac. However, I have not installed a new version of ruby for at least a few weeks, and have been using it daily until now without any issues.
Thanks for any help.
$ gem list | grep sailthru
sailthru (1.1.2)
sailthru-client (4.0.1, 2.0.0)
$ cat Gemfile | grep sailthru
gem 'sailthru'
$ cat Gemfile.lock | grep sailthru
sailthru (1.1.2)
sailthru
$ bundle exec thin start
Using rack adapter
/Users/jg/Dropbox/sinatra/app.rb:5:in `require': cannot load such file -- sailthru (LoadError)
$ irb
irb(main):001:0> require 'sailthru'
=> true
irb(main):002:0>
There is no sailthru file to require.
You should take a look at the project page.
require 'sailthru'
should be
require 'sailthru/client'
Hope this helps.
EDIT
Just noticed the last part where you gave irb output.
The sailthru.rb file is part of the sailthru-client gem. It is working through irb because irb is not loaded via bundle exec. This means that every gem installed is available in irb.
To fix this (if you need that sailthru-client gem in your app. Add gem 'sailthru-client' to your gem file. Do a bundle install, then run your bundle exec again.
You should not see that error after that. Keep in mind. bundle exec only uses gem libraries that are specified in your Gemfile.

`default_gemfile': Could not locate Gemfile (Bundler::GemfileNotFound)

I am new to the ruby on merb, using ruby 1.8.7 version. while run the app it showing like this
`default_gemfile': Could not locate Gemfile (Bundler::GemfileNotFound)
from /home/subrahmanyam/.rvm/gems/ruby-1.8.7-p374#global/gems/bundler-1.5.3/lib/bundler.rb:242:in `default_gemfile'
from /home/subrahmanyam/.rvm/gems/ruby-1.8.7-p374#global/gems/bundler-1.5.3/lib/bundler.rb:188:in `root'
from /home/subrahmanyam/.rvm/gems/ruby-1.8.7-p374#global/gems/bundler-1.5.3/lib/bundler.rb:98:in `bundle_path'
from /home/subrahmanyam/.rvm/gems/ruby-1.8.7-p374#global/gems/bundler-1.5.3/lib/bundler.rb:395:in `configure_gem_home_and_path'
from /home/subrahmanyam/.rvm/gems/ruby-1.8.7-p374#global/gems/bundler-1.5.3/lib/bundler.rb:89:in `configure'
from /home/subrahmanyam/.rvm/gems/ruby-1.8.7-p374#global/gems/bundler-1.5.3/lib/bundler.rb:150:in `definition'
from /home/subrahmanyam/.rvm/gems/ruby-1.8.7-p374#global/gems/bundler-1.5.3/lib/bundler.rb:115:in `setup'
from /usr/bin/merb:10
when i am trying to install ' rvm rubygems 1.4.2 ' it shows followed message like
Installed rubygems 2.0.14 is newer then 1.4.2, skipping installation, use --force to force installation'
This is to request you to provide the solution at the earliest possible. Please help me.
Thanks in advance
If you are new to Ruby you shouldn't use 1.8.7. Its no longer supporter and you will run into problems beyond the one you are having right now. Upgrade to Ruby 2.1.1:
rvm get stable
rvm install 2.1.1
Then locate your project and install your gems by running:
bundle install
I was having this issue trying to get TextMate 2 working with the Cucumber bundle from
https://github.com/cucumber/cucumber-tmbundle
I'm using rvm integration with TM_RUBY set to my .rvm/bin/rvm_auto_ruby, but the cucumber not be resolved. I ended up hard coding BUNDLE_GEMFILE and GEM_HOME into the 'Run Feature' and 'Run Single Scenario' commands:
ENV['BUNDLE_GEMFILE'] = ENV['TM_PROJECT_DIRECTORY'] + '/Gemfile'
ENV['GEM_HOME'] = '/Users/my/.rvm/gems/ruby-1.9.3-p448#monaco-mongoid3'
Anyways, hope that helps someone else.

sinatra app on localhost via unicorn: syntax error

I have a Sinatra app that I continually upgrade (local only, at the moment). Problem being that I know nothing at all about Ruby — my friend made me the app and it's worked beautifully for over almost a year.
To see the site on localhost, I do this:
bundle exec unicorn -l 9000
I don't understand this, haven't needed to. I know I'm using the unicorn gem to run the app directed at port 9000 (due to an old printer conflict).
Today, I get this error:
in `evaluate': compile error (SyntaxError)
syntax error, unexpected ':', expecting $end
which refers to line 16 of my gem file, the sinatra-contrib gem:
gem "sinatra-contrib", require: "sinatra/reloader"
I've never had this error before. Haven't ever touched the gem file, and it's been working for a year. The only thing I can think I've done recently that may have affected my environment is installing a gemset called Wordless:
rvm use 1.8.7#wordless --create --default && gem install therubyracer sprockets compass coffee-script thor yui-compressor && rvm wrapper 1.8.7#wordless wordless compass ruby
I'd appreciate insights, and hopefully I can start to learn a thing or two about managing ruby gems. Thanks.
You were using Ruby 1.9 before. The line you referenced is in 1.9 format, which Ruby 1.8 does not understand.
When you installed Wordless you said:
rvm use 1.8.7#wordless --create --default
This made Ruby 1.8.7 your default interpreter. To switch back to whatever you used before do:
rvm list rubies
And then:
rvm use [the 1.9.x you found in the list above] --default

Cannot use ruby-debug19 with 1.9.3-p0? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with “Symbol not found: _ruby_threadptr_data_type”
I run this:
gem install ruby-debug19
And in my cucumber env.rb file, I have this:
require 'ruby-debug'
When I try to run, though, I get this exception:
/home/skendall/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/skendall/.rvm/gems/ruby-1.9.3-p0/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so (LoadError)
What do I need to do to get ruby-debug to work with 1.9.3-p0?
UPDATE: ruby-debug19 is not maintained anymore. This question and my answer have become irrelevant, it's far easier to use the 'debugger' gem instead.
See Debugging in ruby 1.9
I also ran into this, and found the solution in Ruby 1.9.3 and ruby-debug. You need to install not-yet-officially-released versions of ruby-debug-base19 and linecache19. The currently released versions indeed cause the exception you had.
Use this gist.
#To install ruby-debug on Ubuntu ruby-1.9.3 you need to download from http://rubyforge.org/frs/?group_id=8883
linecache19-0.5.13.gem
ruby_core_source-0.1.5.gem
ruby-debug19-0.11.6.gem
ruby-debug-base19-0.11.26.gem
#Then in your console
export RVM_SRC=/your/path/to/ruby-1.9.3
# Note, your source path should be something like /home/user/.rvm/src/ruby-1.9.3-p0
gem install archive-tar-minitar
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=/$RVM_SRC
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=/$RVM_SRC
This is a known bug. There's reportedly some work arounds here, here and finally here.
If the workarounds are annoying and/or impossible due to your rvm/bundler setup, which is the case with me, consider pry, and optionally the pry-debug plugin. Pry might be a more generally useful tool than ruby-debug anyways.

Having trouble installing Autotest in Rails in Ubuntu 10.10 enviroment

I'm learning how to program in Rails. I'm a complete newbie, and I'm learning from the screen-cast "Rails Tutorial: Learn by Example" by Michael Hartl.
I've been doing pretty well, until I've come to this obstacle, and I don't know how to figure it out. It's a bit frustrating to be frank, and I'd like to move forward with Rails & start making stuff :)
I installed RubyGems 1.8.5 by hitting:
$ gem update --system
and then installed ZenTest gem by hitting:
$ sudo gem install ZenTest
then I installed auto-test rails gem by hitting:
$ sudo gem install autotest-rails
and so got the message
Successfully installed autotest-rails-4.1.0
1 gem installed
Installing ri documentation for autotest-rails-4.1.0...
Installing RDoc documentation for autotest-rails-4.1.0...
So all was lookin' fine and dandy. I navigated to my app folder, and hit
$ autotest
and then got the message
/usr/local/lib/ruby/1.9.1/rubygems.rb:762:in `report_activate_error': Could not find RubyGem ZenTest (>= 0) (Gem::LoadError)
from /usr/local/lib/ruby/1.9.1/rubygems.rb:219:in `activate'
from /usr/local/lib/ruby/1.9.1/rubygems.rb:1065:in `gem'
from /usr/local/bin/autotest:18:in `<main>'
I've tried searching for an answer to why this is happening, but I can't find any. Please help me solve this problem. I'd like to move forward with learning Rails :)
EDIT Maybe I should also mention that I have RSpec installed already -- I don't know if that's of any significance -- giving you a better understanding as to whats going on with my problem -- but I thought I'd just put it out there.
Cheers.
Are you using Rails 3+? If so look for a file called Gemfile inside the rails app root directory. Open it up, add:
gem 'ZenTest'
gem 'autotest-rails'
Save, exit and then run from command line:
bundle
After this try rerunning autotest
I'm at the same point of learning RoR (in this case RoR 3.0.3, Ruby 1.9.2p180, Ubuntu 11.04). I'm also stymied by the lack of consistency. In my case:
$ "You don't have i18n installed in my application. Please add it to your Gemfile and run bundle install".
Gemfile:
gem 'ZenTest'
gem 'autotest-rails'
gem 'i18n'
$bundle install => OK
$bundle show i18n => <ruby path>/gems/i18n-0.6.0
$autotest => (same result)
Any ideas? This is NOT going to help RoR adoption, if it's so obtuse to load a basic TDD environment. (I'll step off my soapbox now.)
try in command line "bundle install"

Resources