rvm: command not found from cap deploy - deployment

Hope this question helps someone, but I'm interested in the answer anyway. I had this error when running
cap deploy
among the other output it gave:
rvm: command not found
I googled and tried many hacks, nothing worked except this:
run "source ~/.rvm/scripts/rvm && cd #{deploy_to} && bundle && ..."
That way I can execute anything like bundle etc. Problem is I have to specify it in the beginning of each run, or just as you see, separate commands in a single line with &&.
My question is, how can I make it work correctly? Thanks.

You should use RVM - Capistrano integration gem => https://github.com/wayneeseguin/rvm-capistrano#readme

Related

wasm-bindgen: command not found even though wasm-pack is installed (0.8.1)

From this article https://asquera.de/blog/2018-10-01/webassembly-and-wasm-bindgen/ I found we can run wasm-bindgen target/wasm32-unknown-unknown/release/qr_wasm.wasm --out-dir ./dist --no-modules --no-typescript to create wasm and js files without running wasm-pack build (it would install wasm-bindgen regardless if I have previously installed one, making it a bit slow) which seems more flexible to me but when I ran wasm-bindgen xxx it says: zsh: command not found: wasm-bindgen
I googled it but no one seems to have encountered this issue. I also have cargo install wasm-bindgen and wasm-bindgen-cli in my project.
Make sure $HOME/.cargo/bin is in your PATH.
If not:
export PATH="$PATH:$HOME/.cargo/bin"
or edit your .bashrc or some other way
I got here from google with the same problem.
My fix was cargo install wasm-bindgen-cli, per here: https://docs.rs/crate/wasm-bindgen/0.2.8
I installed wasm-bindgen using cargo install wasm-bindgen-cli command, however I wasn't able to execute it.
On Arch, I fixed it with yay -S wasm-bindgen-bin

Run older version of MATLAB in batch file

There are two versions of MATLABs (2007a and 2019a) installed on my computer. The 2019a is installed after 2007a so if you use the following code in batch file:
start matlab -r "xxx.m"
The system will call 2019a instead of 2007a.
I searched online and found that most of people say you can call older version by:
start "C:\Program Files (x86)\MATLAB\2007a\bin\win32\MATLAB.exe" -r "xxx.m"
I tried but it give me this error:
if the batch file doesn't include any command ("-r" etc.), it works just fine. MATLAB can be opened without problems.
What's the mistake I made? How could I call older version and have it run some functions?
My OS: Win7
Thanks for all of guys who commented under my question. Turned out there are two ways to do this.
As one of comment said, you just need a pair of "" after start:
start "" "C:\path\MATLAB.exe" -r "xxx.m"
You actually don't need "start", just use directory is fine:
"C:\path\MATLAB.exe" -r "xxx.m"
Both ways solve the problem. A good lesson to learn for starters.
I know this post is old. But I was searching for a solution and found one by myself. The best way is to change the order of the windows environment variables. just put the older version over the newer one and you can use the old script.

Rails Tutorial Sample App 6.26

I am following along with the sample_app everything runs create and all specs pass until I get to 6.26. As soon as I add the has_secure_password to the User class I receive a Ruby interpreter error that is 1899 lines long. The buffer in vim only shows up to line 600 so I can't even get to the root of the problem. I have verified that I have all of the gems with the correct version numbers. Not sure where to go from here. I am not sure where to start debugging from here. I have made sure to rake db:migrate and rake db:test:prepare. Any help in where to start debugging or direction to take would be great.
Thanks
You're probably missing the bcrypt-ruby gem.
You need to add bcrypt-ruby (~> 3.0.0) to Gemfile to use
has_secure_password:
gem 'bcrypt-ruby', '~> 3.0.0'
This error had nothing to do with Rails Tutorial or RSpec. It ended up being an issue with running guard within a tmux session. Everything works fine if I open a second tab and run guard in a standard terminal.

Why does Capistrano need modifications to use something like pythonbrew?

As I understand, all that Capistrano does is ssh into the server and execute the commands we want it to (mostly).
I've used rvm in some past couple of projects, and had to install the rvm-capistrano gem. Otherwise, it failed to find the executables (or so I recall), even though we had a proper .rvmrc file (with the correct ruby and the correct gemset) in the repository.
Similarly, today I was setting up deployment for a project for which I'm using pythonbrew, and a simple "cd #{deploy_to}/current && pythonbrew venv use myenv && gunicorn_django -c gunicorn.py" gave me an error message saying "cannot find the executable gunicorn_django". This, I suppose is because the virtualenv was not activated correctly. But didn't we activate the environment when we did "pythonbrew venv use myenv"? The complete command works fine if I ssh into the server and execute it on the shell, but it doesn't when I do it via Capistrano.
My question is - why does Capistrano need modifications to play along with programs like rvm and pythonbrew, even though all it's doing is executing a couple of commands over ssh?
Thats because their ssh'ing in doesn't activate your shell's environment. So it's not picking up the source statements that enable the magic. Just do an rvm use ... before running commands instead of assuming the cd will pick that up automatically. Should be fine then. If you had been using fabric there is the env() context manager that you could use to be sure thats run before each command.

REE rake gems:install is not working correct

I've installed REE on CentOS 5 for a very special task (using rails 2.3.10 and ruby 1.8) and I really need it to be isolated
In this case I won't use bundler or smth so.
Everything works ok if I'll setup every gem manually via
/opt/ree/bin/gem install agem
But when I run
/opt/ree/bin/rake gems:install
in prepared for this command project - all (or most, I haven't check every dependency) gems are installed via /usr/bin/gem into common gem path, where I do not need any of them
This is an issue and I do not want to install all gems manually. Have smb ever hit into this issue and probably knows solution?
Solution that really helped me was to temporarily replace /usr/bin/gem with a symbolic link to /opt/ree/bin/gem
With this replacement /opt/ree/bin/rake gems:intall worked as expected - all required gems were installed to REE path - returning /usr/bin/gem to original gem executable made system stable again
This is not very clean solution but it works, so it can be used like hammer in critical situation.
There's either a GEM_HOME variable somewhere in the environment, or the runtime ruby called is not ree. Therefore, I'd suggest at least 3 things to try:
Start with an almost empty environment (run env -i sh for example) and run again the rake command, see if this is still installs gems in the common gem path. Be careful, because env -i is an empty environment, you might see complaints from rubygems (because no HOME or nothing else is set)...
Check that the shebang line (first line of the rake program) really indicates your REE binary and not something else
Finally, do run rake using the REE binary with /opt/ree/bin/ruby /opt/ree/bin/rake gems:install
This should give you an indication of what's going wrong. All in all, I think that the environment issue is probably the most probable culprit of this thing