I am trying to use the command line to open the the jquery-rails gem. I am using the command: bundle open jquery-rails and I am getting the message returned: To open a bundled gem, set $EDITOR or $BUNDLE_EDITOR
Forgive me if this is totally newb, but how do I set my text editor Notepad++ like the message is telling me to? I am using windows vista/Rails 3.1
Thanks for any advice.
vi ~/.bashrc or ~/.zshrc or whatever you have:
export EDITOR=vim
Because you mentioned Notepad++ I suppose you are working with Windows. You need to set an environment variable called EDITOR containing the path to Notepad++.
If you use zsh on Mac OS X,add this line of code into .zshrc file:
export EDITOR="mvim"
That will make macvim to open the gem.
don't forget to reload your bash session after setting export EDITOR="vim" in ~/bashrc
Related
I'm just staring out with Ruby. I followed a tutorial to set up Ruby environment on my Mac OS. Then, I created a file named 'personal_chef.rb' in Sublime Text and saved it to a folder I created. Next went to IRB and tried "load 'personal_chef.rb'" and got the error:
-bash: load: command not found
I think it might have to do with how I switched my PATH when installing a new version of git during Environment setup. (I did that by following their instructions and typing: 'echo 'export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"' >> ~/.bash_profile').
Can someone please help explain what is happening and how I can fix it? Basically I want to be able to create a file in Sublime Text, save it, then load it in IRB.
(I am running Mac OS 10.7.5, using Sublime Text 2.0.2 and using Terminal.app for IRB).
Thanks!
This is how you load the file:
First, make sure you enter the irb command from within the same directory you saved 'personal_chef.rb'.
This means that if you saved it to your desktop, you would type ~/desktop
You'll know you're in irb if your command line beings with irb(main)
Next simply type load 'personal_chef.rb'
If you successfully loaded the file the load method will return true.
I have Solarized installed via pathogen and it's been working fine in both terminal and MacVim on my Mac. Today, I tried setting up an Ubuntu box on Linode. I just cloned my dotfiles and symlinked to my .vim and .vimrc folders (this is the same setup as I use on my local machine.
Whenever I try to run vim on the Ubuntu box I get an error
Error detected while processing /root/.vimrc:
line 43:
E185: Cannot find color scheme solarized
Press ENTER or type command to continue
I can tell my .vimrc is being loaded because all other setting like line numbers are working.
The related lines in .vimrc are the following:
" settings needed for solarized colorscheme
syntax enable
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
This is the setup of my .vim/bundle directory (incase you suspect I don't actually have solzrized in there!):
~ ls .vim/bundle
ack coffeescript liquid snipmate vim-colors-solarized vim-jst zencoding
closetag html5.vim nerdtree surround vim-javascript vim-rails
One other thing, running echo &t_Co in vim on the ubunto box gets me 256.
Any ideas?
I was running into this problem just now, too. I had my call pathogen#infect() line in my .vimrc just fine, but was getting the
E185: Cannot find color scheme solarized
error, like you. I moved my call pathogen#infect() up to the top of my .vimrc and all is swell now. Try that if you're still having problems!
I know that it is kind of obvious, but did you check the contents of ~/.vim/bundle/vim-colors-solarized? Just in case you are running in the same issue described in Vim: Pathogen not loading
:colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath'
for the file "colors/{name}.vim. The first one that
is found is loaded.
You should put solarized.vim in ~/.vim/colors/.
This is what I did;
cp ~/.vim/bundle/vim-colors-solarized/colors/solarized.vim ~/.vim/colors/
I just ran into this problem myself on a new CentOS box where 'vi' was mapped to a version of VIM without syntax support (ie. -syntax) and was giving the E185: Cannot find color scheme solarized error, while 'vim' mapped to a version with syntax support and worked fine with solarized.
Aliasing 'vi' to 'vim' resolved the issue.
For reference:
To check if the version of vim that you are running has support for syntax highlighting, run :version from within vim. -syntax means no support, +syntax means it has support.
To create the alias, append alias vi='vim' to your ~/.bashrc or ~/.bash_profile
To re-source, type source ~/.bashrc or source ~/.bash_profile, whichever is appropriate for your setup.
One step you might be missing is to add
call pathogen#infect()
to your .vimrc file.
Src: http://www.vim.org/scripts/script.php?script_id=2332
I was getting this problem and I fixed it by issuing
cd ~/.yadr
git pull
rake update
I fix it ;)
Found this bug:
https://github.com/altercation/vim-colors-solarized/issues/104
cp ~/.vim/bundle/vim-colors-solarized/colors/solarized.vim ~/.vim/colors/
As Ryan Ransford said:
With the new version of vundle (Vundle.vim),
it appears as though "colorscheme solarized" must
come somewhere after "call vundle#end()".
This works for me!
I have the same issue and resolve it after moving color setting after call vundle#end() in ~/.vimrc
...
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
call vundle#end() " required
filetype plugin indent on " required
if has('gui_running')
set background=dark
colorscheme solarized
else
colorscheme zenburn
endif
I keep getting Command Not Found: prettify_json.rb from the command line. I'm using zsh and rvm so, I'm not sure if it has something to do with the paths setting in my .zshrc. I've compared it to some other questions here with similar problems and I'm not able to see an issue.
here is the .zshrc file:
ZSH=$HOME/.oh-my-zsh
alias vi="vim"
source $ZSH/oh-my-zsh.sh
source ~/.git-flow-completion.zsh
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export PATH=/usr/local/bin:$PATH
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
The json gem may not have shipped with prettify_json.rb. But it is available in the json-utils gem. Try gem install json-utils
I am trying to get RubyTest to work in Sublime Text 2. I followed the Instruction on the Github Readme and get the following error. Does anyone know how I could fix this?
/bin/sh: rspec: command not found
To get this to work you only need to change one setting in the RubyTest package in sb2.
If you are using rvm, your rspec gem is installed through rvm and is not found in /bin/sh
So you need to set the RubyTest package for Sublime Text 2 to automatically check for your rvm environment variables.
What to change:
1) In Sublime Text 2, go to Preferences|Browse Packages. This will open up your packages directory.
2) Open the 'RubyTest' directory and look for the file 'RubyTest.sublime-settings'.
3) find the line that says:
"check_for_rvm": false,
and change it to:
"check_for_rvm": true,
save the change.
4) That's it. It should now work.
Good Luck
This worked for me:
If you're using RVM, open a project with command line from the project's folder:
subl .
Then, it'll hook the ruby version and gems.
This is most likely due to using RVM. What is the output of
which rspec
on your command line?
Also of note, just because you've included rspec-rails in a Gemfile, does not mean that 'rspec' is an executable program that your system knows about.
You can edit the RubyTest.sublime.settings to refer to your particular path to the rspec executable and it should work.
Unfortunately, this has the nasty side effect of being tied to one particular version of Ruby. If you're using RVM to switch between versions, you'll have to update your sublime.settings.
One work around, is to run Sublime from the command line.
Running Sublime Text 2(2165) with RubyTest plugin. Ruby and Gems managed with rbenv (0.3.0).
First attempt to use RubyTest gave the following error:
/bin/sh: rspec: command not found
From the command line I ran
which rspec
and it returned no results.
After some digging, I read that bundle install does not put the executables in your $PATH.
Alternative executable paths not picked up by shims sometimes
In order to use the executible outside the app, I had to delete the gem installed by bundler and then install it manually.
gem uninstall rspec
gem install rspec
followed by
rbenv rehash (Note you will need to run bundle inside your app so it updates the location of the gem)
This had to be performed for each version of ruby I have under rbenv control.
Now when I run
which rspec
it is found in the path and RubyTest is able to grab it without any problems.
fwiw, I had to repeat the steps for cucumber as well. To use all of RubyTests' features, ruby, cucumber and rspec executables need to be in your $PATH (for rbenv it is ~/.rbenv/shims/).
Try change the path to usr/local/bin/
I wrote a post on Sublime Text Build Scripts which should show you how to do this.
http://wesbos.com/sublime-text-build-scripts/
Same issue for me. With rspec 1.3.2 what I just did to fix it is to edit the RubyTest.sublime.settings file in the plugin folder, changing the "ruby_rspec_exec" key from:
"ruby_rspec_exec": "rspec"
to
"ruby_rspec_exec": "spec"
It really depends on the location where you have your rspec executable file...
I had the same problem after installing RubyTest by cloning from the repo. I simply uninstalled and reinstalled the package inside Sublime using Package Control, then everything worked fine.
You can see a summary of this issue here: https://github.com/maltize/sublime-text-2-ruby-tests/issues/36
Essentially, what Jim said was correct, you're running RVM or some other ruby vm manager that similarly monkeys with your PATH. Following the directions from this issue I did the following:
Install the binaries in my project
bundle install --binstubs
Add the path to my .bashrc and source it
echo 'export PATH="./bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Open the sublime project from the command line (so that PATH is available in Sublime Text 2)
subl .
The following steps worked for me (I encountered the same error as OP):
Install the RubyTest plugin through the package control manager.
Note* If you don't have the package manager installed - I highly recommend it for managing sublime plugins - more info here.
Be sure to add the code here to your RubyTest.sublime-settings file.
This file can be found at (from the menu): Preferences -> Package settings -> RubyTest -> Settings User
Save file, close Sublime and restart Sublime from the terminal in your project's folder using (so PATH is available in Sublime): subl .
No, you don't need to change paths, run sublime from command line etc.
If you are using RVM, you only have to do this:
Go to Sublime Text 2, go to
preferances-> package settings -> RubyTests
and pick settings-user or settings-default (depending what you are using) and change line:
"run_rspec_command": "rspec {relative_path}"
to
"run_rspec_command": "bundle exec rspec {relative_path}"
And so forth - add bundle exec to all commands
I spent many hours struggling with this same problem! I could not get rspec to run within Sublime Text 2, using the Michael Hartl "Ruby on Rails Tutorial." It kept saying:
/bin/sh: rspec: command not found
I finally realized that the RubyTest package (https://github.com/maltize/sublime-text-2-ruby-tests) was looking in the WRONG PLACE for my RVM!
On my Mac, the path for RubyTest is /Library/Application Support/Sublime Text 2/Packages/Ruby Test
First, to make RubyTest seek the RVM, I changed the parameter in RubyTest.sublime-settings from
"check_for_rvm": false, to "check_for_rvm": true,
Then I dug into the Python code of run_ruby_test.py: https://github.com/maltize/sublime-text-2-ruby-tests/blob/master/run_ruby_test.py
At line 151, inside class BaseRubyTask, it had the wrong path for my RVM:
rvm_cmd = os.path.expanduser('~/.rvm/bin/rvm-auto-ruby')
I changed it to the full correct path: rvm_cmd = os.path.expanduser('/usr/local/rvm/bin/rvm-auto-ruby')
If this is not your path, find the correct path by typing
$ which rvm-auto-ruby and substitute that instead.
After saving run_ruby_test.py, I went to Terminal, cd to my Rails application directory, and ran spork
Finally, I opened static_pages_spec.rb in Sublime Text 2. Now all the tests work from it!
I'm using rbenv and found that adding the following to my .bashrc did the trick
/Users/user/.rbenv/shims/rspec
EDIT: I found a solution for this, you can read it in my answer bellow.
I am using Textmate on Snow Leopard, and have installed ruby 1.9. The problem is that for some reason Textmate uses Ruby 1.8.2
But when I use IRB, or run ruby scripts for the shell, the proper version of Ruby (1.9) is used.
How can I configure Textmate so it uses 1.9.2?
I've been googling and apparently you have to use the T_RUBY variable and textmate, and set some environment variable in OSX, but so far none of the methods I've found works for me.
Could someone give a step by step solution to this problem?
Update: I already tried adding the ruby binary path to TM_RUBY in textmate, and I get this error:
> Can't find
> “/Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> ” on PATH. Theme: The current PATH is:
> /usr/bin /bin /usr/sbin /sbin Please
> add the directory containing
> “/Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> /Users/myname/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
> ” to PATH in TextMate's Shell
> Variables preferences.
If you use RVM, maybe you can try to type:
> which rvm-auto-ruby
/Users/eddie/.rvm/bin/rvm-auto-ruby
and set this path as a shell variable named "TM_RUBY" in your textmate perferences like my screenshot
http://dl.dropbox.com/u/6931090/downloads/textmate-preferences.png
Hope that helps :)
Under preferences / advanced / shell variables, add a new variable called TM_RUBY. And enter the absolute path of your ruby binary.
You can get the latter by opening a terminal and typing:
which ruby
The solution is actually very easy, no special install procedures are needed. As mentioned on the TextMate blog all you need to do is tell text mate your path variable. TextMate does not load this information by default. In Preferences, go to the Variables tab add a variable PATH (if it does not already exist) with the value, $PATH:/usr/local/bin. This tells TextMate to copy the system PATH. The system's ruby is in /usr/bin/ruby which is included in OSX default PATH. If you install a custom version of ruby then also append that path, for example here I have appended /usr/local/bin (don't forget the colon).
If you use which ruby and TextMate says exec: rbenv: not found, you need to type this instead: rbenv which ruby. Use that path in TM_RUBY.
Using the path that which ruby gave me didnt work. After googling for a while, I found a solution that worked, using the auto-ruby path of rvm as the TM_RUBY variable.
The path is:
/Users/0al0/.rvm/bin/rvm-auto-ruby
This only applies if you are using rvm, of course.