How do I convert HTML to HAML in textmate? - rvm

I'm trying to write a textmate 2 command to convert the selected text from HTML to HAML. I'm use RVM so I installed html2haml gem to a textmate specific gemset and set TM_RUBY variable to /Users/mark/.rvm/bin/ruby-1.9.3-p392#Textmate as per https://rvm.io/integration/textmate
here's my attempt:
#!/usr/bin/env bash
[[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
echo "$TM_SELECTED_TEXT" | html2haml -s
but this gives the error "command not found html2haml" because html2haml is installed in an rvm gemset and textmate is running a bash script so it doesn't know about TM_RUBY. How do I sort this mess out?

the solution is to use the TM_RUBY as ruby has -S which does PATH search:
echo "$TM_SELECTED_TEXT" | $TM_RUBY -S html2haml -s

Related

Does nvm have to be before rvm in PATH?

Why does nvm is added before /home/user/.rvm/gems/ruby-2.2.3/bin
in PATH ?
echo $PATH
/home/user/.rvm/bin:/home/user/.nvm/versions/node/v5.1.0/bin:/home/user/.rvm/gems/ruby-2.2.3/bin:/home/user/.rvm/gems/ruby-2.2.3#global/bin:/home/user/.rvm/rubies/ruby-2.2.3/bin:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/user/.rvm/bin
My .zshrc file end looks like this
export NVM_DIR="/home/user/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads nvm
export PATH="$HOME/.rvm/bin:$PATH" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
I get the following error because of that.
rvm -v
Warning! PATH is not properly set up, '/home/user/.rvm/gems/ruby-2.2.3/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.2.3'.
rvm 1.26.11 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
rvm is expecting to be the first in your PATH. You can disable this warning so that you do not have this issue by adding the following line to your .rvmrc file:
rvm_silence_path_mismatch_check_flag=1
This should disable that warning.
Your .rvmrc file should be located at: ~/.rvmrc. Create it if it does not exist.
Now, make nvm the first in your PATH and place rvm after that.

RVM sourcing line not found for Bash, rerun this command with '--auto-dotfiles' flag to fix it

Removed rvm. When I reinstall I get this:
RVM sourcing line not found for Bash, rerun this command with '--auto-dotfiles' flag to fix it.
Given that I used [~]$ \curl -sSL https://get.rvm.io | bash -s stable --ruby is it wanting me to run this command with the dotfiles flag?
The "rerun this command" line means to rerun rvm reinstall ruby-2.3.3, with the flag added. This worked for me:
[~]$ \curl -sSL https://get.rvm.io | bash -s stable --ruby --auto-dotfiles
... The idea is to just tack on --auto-dotfiles to the last command you ran.

Does NitrousIO support RBENV?

With Nitrous.io the documentation states that other Ruby version managers may be used instead of RVM.
However, sudo is needed for installing rbenv
Is RVM currently the only option on nitrous.io?
If you do not wish to use RVM which is pre-installed then you can install rbenv. Run the following commands within your Nitrous.IO console:
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ source ~/.bashrc
These steps can be found within the Octopress guide which utilizes rbenv on Nitrous.IO.

Problem with RVM use

I am having trouble with using rvm use in zsh. Whenever I do rvm use 1.9.2 or other ruby version, it gives confirmation as Using /home/kxhitiz/.rvm/gems/ruby-1.9.2-p290
But when I do rvm list ruby 1.9.2 is not selected. This works fine in bash. That means I can go to bash and select ruby version I need, and I can come back to zsh to use it.
So that means if I have to change ruby from list of rubies I have installed, I have to go to bash to select it and once selected in bash, I can see it selected in zsh as well.
Any solution would be highly appreciated.
Ok, I did fixed it by adding following line at the end of my ~/.zshrc file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Cheers!

RVM on debian and rails 3

I'm following https://github.com/diaspora/diaspora/wiki/Installing-on-Debian and trying to get RVM installed on debian. Executing
bash < <(curl -s https://rvm.io/install/rvm)
gives me nothing, it does not result in anything. I have curl installed but the command doesn't generate any output.
You can just download https://rvm.io/install/rvm via browser and then execute bash ./rvm . The command you entered actually executes the same.
EDIT: the new way:
curl -L https://get.rvm.io -o rvm-installer
chmod +x rvm-installer
./rvm-installer
rm -f rvm-installer
Which is equivalent to:
curl -L https://get.rvm.io | bash
The former command was using -s without -S which was hiding errors from curl.