Textmate error duplicating lines "ruby: warning: -K is specified; it is for 1.8 compatibility and may cause odd behavior" - ruby

While using ctrl+shift+d to shortcut to duplicate lines in Textmate, I came to the following error:
"ruby: warning: -K is specified; it is for 1.8 compatibility and may cause odd behavior"

This problem isn't limited to duplicating lines, but shows up in may other places where ruby is used. I solved it by changing PATH at Preferences… > Advanced > Shell Variables to /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
After this change, TextMate will use the older version of ruby which doesn't output said warnings.

This is an output warning from ruby 2.0 .
The only way I could solve it was by going to
/System/Library/Frameworks/Ruby.framework/Versions and changing the symlink named Current to point to the folder 1.8 ( /System/Library/Frameworks/Ruby.framework/Versions/1.8 ) .
In other words, changed back to use ruby 1.8 instead of 2.0 .

Related

Jedi-vim: No auto-complete on dot (.), testing shows erroneous "no python" error

I just installed jedi-vim and supertab (because I already had something bound to <C-Space>). <Tab> now shows the autocomplete menu and it's working pretty well, however I don't see any menus when I hit ..
If I use <Tab> in insert mode after pressing ., I get the normal menu that doesn't have the context of the name preceding the dot (and it's not at all useful because of it).
:verbose imap . says No mapping found, but I'm guessing that's not how jedi-vim works.
In my effort to troubleshoot the issue I've disabled my other plugins and replaced my .vimrc with just execute pathogen#infect().
Now, when I :e foo.py I see: "Error: jedi-vim failed to initialize Python: jedi-vim requires Vim with support for Python 2 or 3." I didn't get this error before, and :version shows that I have both Python 2 and 3 support.
Scriptnames: https://gist.github.com/hovissimo/a2413d6a5d0e1be356c0
:version: https://gist.github.com/hovissimo/f5a0e630edac8756397e
Edit:
:JediDebugInfo says Using Python Version: null
I don't know why I didn't see the error before, but it looks like my python3 integration in Vim was in fact broken.
I had Python 3.5 32-bit installed, but I was using a 64-bit version of Vim. Installing a 32-bit version of Vim (making sure it was compiled for python35) seems to have fixed all problems.

rbenv and sublime text 3

I have installed ruby using rbenv. I am using sublime text 3 and a Linux Mint 17.1 system. I am trying to build a program using control-b. When I do this I get the following message:
/bin/bash: ruby: command not found
[Finished in 0.0s with exit code 127]
[shell_cmd: ruby "/home/christopher/projects/hello.rb"]
[dir: /home/christopher/projects]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr /games:/usr/local/games]
When I check my path using my terminal, I get the following:
/home/christopher/.rbenv/shims:/home/christopher/.rbenv/bin:/usr/local /sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
How do I get my paths to line up?
Looking a long time for a solution to this I found the script "Pathway" that gave me an idea how to fix this.
I ended adding the following Pathway.py file to ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User to set a fixed ruby version managed by rbenv for all my sublime sessions:
import os
import subprocess
HOME = '/Users/my_user' # <== Change this accordingly
RBENV = '/.rbenv/versions/2.5/bin' # <== Choose version from ~/.rbenv/versions
# Sublime's default path is
# /usr/bin:/bin:/usr/sbin:/sbin
os.environ['PATH'] = HOME + RBENV + ':' + os.environ['PATH']
print('[Pathway] now the PATH is = ' + os.environ['PATH'])
print('[Pathway] sublime now uses', subprocess.check_output(["which", "ruby"]))
Now I have a deterministic and controllable ruby version to run things in sublime 🙂
So for "rbenv", your ruby executable is probably at "~/.rbenv/shims/ruby". But check! (On linux, in the directory you'll be working in, at the prompt, type "which ruby".)
The default Ruby SublimeText 3 Build system may not point to the right place.
At least that's what I think the problem was for me.
Issue is, while you can (maybe should) define a new build system for Ruby, for me, that meant two Ruby build systems, as I could not figure out what to do with the old built in one.
You can change the old one easily by installing package "PackageResourceViewer" and then restarting sublime, and then command (shift-ctrl-p on linux) "PackageResourceViewer:OpenResource" and search for "Ruby", then look for the Build system. Note I commented out stuff, and left good notes in case I need to revert.
I presume that when I next install ST3, this will be overwritten. Adding a new build system, or working with path or something is probably a better approach, but I already took to much time on this.
References
Building Ruby and Using RVM
SublimeText 3 Ruby Build Error

Doxygen 1.8.7 / GraphViz 2.38 compatabilty issue

I recently upgraded from Doxygen 1.8.4 and GraphViz 2.36 where I had no problems generating graphs to Doxygen 1.8.7 and GraphViz 2.38 and cannot now get graphs.
During the build I get large numbers of errors of the form
error: Problems running dot: exit code=-1, command='dot' arguements="myfile.dot" -Tpng -O "myfile.png"
I have downgraded to GraphViz 2.36 and the problem has disappeared.
NOTE - I have tried to run 2.36 with DOT_PATH empty and GraphViz added to path but this doesn't work either.
Only working solution at present is 2.36 with DOT_PATH defined.
Can you please check the compatibily issue and advise.
Another solution, that does not require to edit your $path is to set the DOT_PATH variable at the configuration file, to wherever you install the dot library (default path is Program Files (x86)/Graphviz2.38/bin).
You can do this with 2 ways:
With the Doxywizard tool.
At the expert tab, go to the dot at the topics and set the DOT_PATH (see the screenshot of doxywizard)
Editing manually the Doxygene config file, so your doxygene configFile must have a line like this:
DOT_PATH = "../Program Files (x86)/Graphviz2.38/bin"
I had exactly the same problem using Doxygen 1.8.6 and dot 2.38 (20140413.2041). Only a slight version difference compared to OP but the same error messages - and no graphs. dot was (and is still) set in the PATH variable but this was not enough.
It was solved though after I explicitly set DOT_PATH to the appropriate directory which is "C:/Program Files (x86)/Graphviz2.38/bin" in my case.
I encountered the same problem using Doxygen 1.8.10 and dot 2.38 with Windows 7 and DOT_PATH empty. At the end it was "only" a problem with the command line path: The dot utility was not found within the environment, where doxygen was run. One needs to make sure, that the dot installation directory is listed within the PATH environment variable. A convenient way to check is to call the command dot.exe -V right before calling doxygen. Then check the command line output for the dot version message.
Unfortunately the dot installation directory usually changes with each release of the GraphViz utility, since it contains a version reference (although it is not possible to have two versions of GraphViz installed in parallel). Under windows you need to manually update the global PATH setting and reboot (!) to make sure, that the setting is updated in all running environments as well.
In my case i got this "error: Problems running dot: exit code=1.." solved only after i run dot -c which is meant to configure dot plugins (needs write privileges)
I also encountered this problem. I tried lots of methods mentioned in the net, but failed.
Finally, I have downgraded to GraphViz 2.38 and the problem has disappeared. Now my doxygen version is 1.8 and my graphviz version is 2.38.

Use default ruby version in Sublime Text 2

My default and current version of ruby is 1.9.3. It's actually the only version that appears when I run rvm list so I don't see how I can be messing that part up. I did follow this
tutorial that I found here, but it just seemed to break everything. I keep getting "No such file or directory" for all the variations of the fix I see, even the in the comments. I am on a Mac, please let me know what other information I need to post here to help you figure out how I'm breaking things.
You can always edit which ruby is used by editing your Build command preferences:
subl ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Ruby/Ruby.sublime-build
Change the default "ruby" to whatever path you require. The version you're using at any given time can be discovered with:
which ruby
Alternatively you can just link to the default which is often located at /opt/local/rvm/bin/ruby.

Problem with Vim's Ruby plugin

I have just installed Vim and when ever I go to open in ruby file I get these errors:
Error detected while processing C:\Program files (x86)\Vim\vimfiles\ftplugin\ruby.vim
line: 76
Encoding::ConverterNotFoundError: code converter not found (UTF-16LE to ASCII-8bit)
line: 93
E121 :Undefined varaible: s:ruby_path
E15: Invalid expression: s:ruby_path
line: 76
NameError: uninitialized constant Gem::Quickloader
line: 93
I have Ruby 192 installed and I get this error even if I update ruby vim files.
These are the two lines those errors are referring to if it helps:
line 76: ruby VIM::command( 'let s:ruby_path = "%s"' % ($: + begin; require %q{rubygems}; Gem.all_load_paths.sort.uniq; rescue LoadError; []; end).join(%q{,}) )
line 93: let &l:path = s:ruby_path
Note that instead of editing ruby.vim file you can just add
let g:ruby_path = ':C:\ruby192\bin'
in your _vimrc file (or equivalent for your platform). That way you won't need to keep re-editing ruby.vim when you update it.
If you run RVM and want its default ruby, use:
let g:ruby_path = "/Users/allen/.rvm/rubies/default/bin"
If you set your ruby interpreter in your project .rvmrc file, you can create an environment variable in your .rvmrc:
rvm 1.9.2#projectname --create
export RUBY_BIN=`which ruby | sed 's/ruby$//'`
You can use environment variables in your .vimrc:
let g:ruby_path=$RUBY_BIN
(Note you should also set a default $RUBY_BIN in your .bashrc or .zshrc so this works outside of .rvmrc projects.)
If your ~/.rvm/rubies/default/bin path does not yet exist, you need to set your rvm system default of ruby. At your command prompt or terminal application, enter:
rvm use 1.9.2 --default
using whatever ruby version you need.
How did you install Ruby?
Go into irb and enter:
Gem.all_load_paths.uniq
which should return a list of paths to your install gems that Gem knows about also.
That's what is failing in your error message and leads me to suspect you are missing some path or environment info, because it looks like vim isn't able to find your Ruby gems correctly.
Encoding::ConverterNotFoundError is a core library exception, so that part is working, but it looks like the Gem command isn't working.
Your problem is probably Ruby 1.9 - AFAIK Vim only works with Ruby 1.8, so you might have to downgrade your Ruby version to get Vim working.
I opened the file "C:...\vim73\ftplugin\ruby.vim" and right before line 73 or so, where the code reads:
if !exists("s:ruby_path")
I added:
let s:ruby_path = 'C:\ruby192\bin'
So far vim seems happier about editing ruby files. Note I installed my ruby in the "C:" directory instead of "Program Files" to get a better pathname to ruby.exe.
My version of ruby.vim is dated 2010 Mar 15.
Updating to the latest release of Ruby 1.9.2 (1.9.2p180 (2011-02-18) at the time of posting) fixed this for me.
I was running 1.9.2p132 or so when I had the problem, which seems to have been patched around Dec 2010. You can check your current version by running ruby -v.

Resources