Downloading and Installing Ruby from the command line - ruby

I would like to install ruby from the command line. I don't mind where it gets installed from but I guess Here would probably be the best place.
The aim is to use ocra to provide a one click installer that runs a ruby script through the command line. Using the backsticks `` arguments method in ruby to install a list of gems along with it. This way, should I decide to change computer, I can run the ruby install as a .exe file and it will do it all for me.
Will this method work? What do you think? What would the command be to actually download and run the rubyinstaller" from the command line?
I am running windows XP.

For automatically pulling down from the web, you can try wget for windows. Then you can point it at the installer url.
Edit: (thanks to excellent suggestion by Ninjaxor)
You can then invoke installer via either the /silent or /verysilent command line options.

Related

unable to run 'aws' from cygwin

I'm using cygwin installed on Windows 10 and trying to access awscli from it.
I used pip install awscli to install awscli. This installed awscli. I then tried to run only aws to see if it is installed and I get the following error:
-bash: /cygdrive/c/Program Files/Anaconda2/Scripts/aws: C:\Program: bad interpreter: No such file or directory
I'm not sure why this is happening. Any help in this regard would be highly apreciated.
This is still an issue even with the latest version of AWS cli. So after some trial and error I found a pretty good workaround that will not make you switch your favorite shell.
First, make sure python is on your PATH. That is from anywhere in the system you can just run python and it work.
Find the aws script and open it for editing (for me it was located in c:\Program Files\Python36\Scripts\aws) and change the hashbang (that would be the first line in the script) to #!python.exe. For me it was set to #!c:\Program Files\Python36\python.exe. That space in the middle of Program Files caused the issue when that path got converted to Linux like path. Changing it to #!python.exe sidesteps the issue.
When you update AWS cli, repeat the workaround.
PS. You could also avoid this issue by installing python somewhere in a folder without spaces in path. That requires to reconfigure your system, so I did not do that myself.
I would install the standard python and ensure it is coming up first in your path with which python and which pip. Path issues like this are due to mixing and matching executables targeting different platforms in my experience. Certain commands do not implement functionality to convert paths from Windows to Linux and back (it appears your specific commands are failing on spaces).
Since you say you are on Windows 10, if you have the anniversary edition, I would recommend Windows Subsystem for Linux over cygwin. You will likely see less Windows issues on WSL since it uses the exact same ubuntu packages you would use on Linux instead of the cygwin port and maps them low level to the NT Kernel.
The Problem comes from "Program Files" having a space. This is something that is related to cygwin (I encountered the same error with git bash on windows). In a script I had something like this:
#!/c/Program Files/some_program/executable.exe
Escaping the space with a backslash or using quotes didn't work.
The solution is to use the DOS' short filename:
Progra~1 for "Program Files"
Progra~2 for "Program Files (x86)"
So my line would turn into:
#!/c/Progra~1/some_program/executable.exe
In Windows:
cd .. to go to home directory which shows pwd as /.
Now, cd to /cygdrive/c/Program\ Files/Anaconda2/Scripts
Now, run: python aws configure
Example:
user#user /cygdrive/c/Program Files/Anaconda2/Scripts
$python aws configure

Cygwin - can't run ruby command

When I run ruby -v in cygwin, it shows me the ruby which I have installed in windows. FYI - I never installed any ruby as a part of my cygwin installation.
But when I run gem list, I get the error:
/cygdrive/c/ruby/bin/gem:
C:/dev/ruby/bin/ruby.exe^M: bad interpreter: Permission denied
I Googled and found this problem a lot. But there is no one who explained what it means and why it happens. Can someone please answer those questions for me and help me to fix this problem?
Thank you very much !
Under cygwin, your best bet is to run the cygwin version of ruby, installed using the cygwin setup tool.
You can use regular ruby, but you will have interoperability issues like this.
What you are seeing here is the shell complaining about a ^M at the end of the "shebang" line of the gem script (first line that tells it what interpreter to use). This ^M is an artefact of the windows environment where all lines end with this character as well as just the newline character that unix uses on its own.
You could solve this problem by removing the newlines e.g. by using dos2unix command on gem but it won't be long before you run into further issues ...

Ruby devkit installing issue

I've been trying to install ruby dev kit and following the instruction on this page.
http://rubyonwindowsguides.github.io/book/ch02-04.html
My problem is that when I run rb.dk in the devkit directory, it quits before i am able to do anything (so i am not able to follow next steps).
I really appreciate all help.
run it in a cmd prompt as C:\Ruby\devkit>ruby dk.rb.
Running it by associating the CLI with the file causes the cmd prompt to close as soon as the ruby interpreter stops.

how can I run shell script line by line [duplicate]

I'll love something like Microsoft Visual Studio's line-by-line debugging in bash, with current variables values and so.
Is there any tool or way to do it? set -x and set -v are nice but not perfect.
See bashdb.
If it's installed on your system, see man bashdb.
If it's not installed, see http://bashdb.sourceforge.net
Yes. Use "bashdb" from http://bashdb.sourceforge.net/
Latest version at time of writing
http://sourceforge.net/projects/bashdb/files/bashdb/4.2-0.8/
If you are on a Mac (like I was) then you might need to install the GNU version of Bash.
I did that using "MacPorts"
http://www.macports.org/
Once you have MacPorts...
port install bash
Then follow the instructions to
./configure (in bashdb unpacked directory)
make
sudo make install
Then add the folder where bashdb can be found in your PATH

python packages open new window

I installed python27 64-bit on windows 7. I also have setuptools and pip installed. Now when I execute command in windows console new console window appear, message is printed in it and close before i can read something from it. e. g. I installed yolk and when type yolk -l in cmd it shows me all packages in new cmd window and close immediately. What should I do if I want all messages in main command window?
When you run pip or easy_install from the command-line, your system will be starting easy_install.exe or pip.exe. As of Python 2.7 x64 these executables have a manifest file to satisfy Windows 7's UAC requirements. You can read a little more about this here, but in short, because the applications could be running with different permissions, a new window is opened.
I don't believe there's a proper fix to get around this, short of downgrading. However, you can bypass the problem by not using the executable files.
Back up and then remove pip.exe, easy_install.exe, and fab.exe (if you have Fabric).
Create a bunch of batch files matching the original binaries' names, and put them in the same folder that had the binaries (default C:\Python27\Scripts).
easy_install.bat
#echo off
easy_install-script.py %*
pip.bat
#echo off
pip-script.py %*
fab.bat
#echo off
fab-script.py %*
With these in place, you should find your command-line use of these tools doesn't spawn a new window. Happy hacking.
I tried these, but still a new terminal opened. So i ran the cmd as an administrator, and python worked fine.
try specifying the commands like so:
c:\python27\python.exe -m easy_install Django==1.6.5v
I have the same problem, but it repairs when I turn off an Antivirus.
try specifying the commands like so:
c:\python27\python.exe -m pip install Django==1.6.5v

Resources