Difference between revisions of "Ruby Setup"

From CSE425S Wiki
Jump to navigation Jump to search
 
(48 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Language==
 
==Language==
 
===Mac OSX===
 
===Mac OSX===
 +
Note: depending on how the permissions are set up on your machine you may need to prefix a command with <code>sudo</code> or perhaps you may have to omit <code>sudo</code>.
 +
 +
====[https://brew.sh/ Homebrew]====
 +
<nowiki>/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" </nowiki>
 +
<!--
 
====Standard Ruby====
 
====Standard Ruby====
 
Nicely, Ruby ships with the Mac standard installation.  While it may not be the most up to date version, it may be the best option to simply use your default version: /usr/bin/ruby.
 
Nicely, Ruby ships with the Mac standard installation.  While it may not be the most up to date version, it may be the best option to simply use your default version: /usr/bin/ruby.
 +
-->
 +
====Install Ruby====
 +
<nowiki>brew install ruby</nowiki>
 +
 +
====Add Ruby To Path====
 +
if Mac OSX 10.15 Catalina or greater
 +
 +
    ~/.zshrc
  
====Tk Gem====
+
else
<nowiki>sudo gem install tk</nowiki>
 
  
Note: If you have problems with this step, try installing [[Active_Tcl_Setup|Active Tcl 8.5]].
+
    ~/.bash_profile
 +
 
 +
Add this line:
 +
 
 +
<nowiki>export PATH="/usr/local/opt/ruby/bin:$PATH"</nowiki>
 +
 
 +
====check ruby====
 +
You can either
 +
 
 +
1) restart your terminal
 +
 
 +
or
 +
 
 +
2) source the appropriate configuration file based on your shell (which is often dependent on the OSX version)
 +
 
 +
<nowiki>source .zshrc</nowiki>
 +
 
 +
or
 +
 
 +
<nowiki>source .bash_profile</nowiki>
 +
 
 +
Then run
 +
 
 +
<nowiki>ruby --version</nowiki>
 +
 
 +
which should report version <code>2.7.2</code> as of Fall 2020.
 +
 
 +
<!--
 +
 
 +
====Tk====
 +
{| class="wikitable"
 +
!colspan="2"| &lt;=== Choose One Path ===&gt;
 +
|-
 +
| style="width: 50%; text-align:center;" | &darr; &darr; &darr; R + XQuartz + Tk Path &darr; &darr; &darr;
 +
| style="width: 50%; text-align:center;" | &darr; &darr; &darr; Active Tcl/Tk Path &darr; &darr; &darr;
 +
|- style="vertical-align:top;"
 +
|
 +
* Download and Install [https://cran.r-project.org/bin/macosx/ R]
 +
 
 +
* Download and Install [https://www.xquartz.org/ XQuartz]
 +
|
 +
* Download and Install [[Active_Tcl_Setup|Active Tcl 8.5]]
 +
|-
 +
|<code>gem install tk -- --with-tcl-include=/opt/R/arm64/include --with-tk-include=/opt/R/arm64/include --with-tcl-dir=/opt/R/arm64/lib --with-tk-dir=/opt/R/arm64 --with-X11-dir=/opt/X11 --with-tcllib=tcl8.6 --with-tklib=tk8.6</code>
 +
|<code>gem install tk</code>
 +
|}
 +
 
 +
-->
  
 
====OS Gem====
 
====OS Gem====
Line 15: Line 74:
 
  <nowiki>sudo gem install chunky_png</nowiki>
 
  <nowiki>sudo gem install chunky_png</nowiki>
  
====[https://brew.sh/ Homebrew]====
+
====OpenGL Gem====
  <nowiki>/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" </nowiki>
+
  <nowiki>sudo gem install opengl-bindings</nowiki>
 +
 
 +
====Opener Gem====
 +
<nowiki>sudo gem install opener</nowiki>
  
====OpenGL Runtime====
+
====Zip Gem====
  <nowiki>sudo brew install glfw</nowiki>
+
  <nowiki>sudo gem install zip</nowiki>
  
====OpenGL Gem====
+
===Windows===
<nowiki>sudo gem install opengl-bindings</nowiki>
+
====Ruby====
 +
Download and Install [https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.2-1/rubyinstaller-devkit-3.1.2-1-x64.exe Ruby+Devkit 3.1.2-1 (x64)]
  
 
<!--
 
<!--
=====Install ActiveTcl 8.5=====
 
[https://www.activestate.com/products/tcl/downloads/ Install ActiveTcl 8.5 (not 8.6) from www.activestate.com]
 
=====Install [https://rvm.io/rvm/install Ruby Version Manager]=====
 
<nowiki>\curl -sSL https://get.rvm.io | bash</nowiki>
 
=====Install Ruby With Tcl and Tk=====
 
<nowiki>rvm reinstall ruby-2.2.3 --with-tcl --with-tk</nowiki>
 
=====Set Ruby Version=====
 
<nowiki>rvm use 2.2.3 --default</nowiki>
 
=====Confirm Version=====
 
<nowiki>ruby --version</nowiki>
 
-->
 
  
===Windows===
+
{| class="wikitable"
====Ruby Installer====
+
!colspan="3"| &lt;=== Choose One Path ===&gt;
[https://rubyinstaller.org/downloads/ Download From RubyInstaller]
+
|-
 +
| style="width: 34%; text-align:center;" | &darr; &darr; &darr; Ruby 3 Path &darr; &darr; &darr;
 +
| style="width: 33%; text-align:center;" | &darr; &darr; &darr; Ruby 2 Path &darr; &darr; &darr;
 +
| style="width: 33%; text-align:center;" | &darr; &darr; &darr; Ruby 2 (Legacy Version) Path &darr; &darr; &darr;
 +
|- style="vertical-align:top;"
 +
|1) Download and Install [https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.1-1/rubyinstaller-devkit-3.1.1-1-x64.exe Ruby+Devkit 3.1.1-1 (x64)]
 +
|1) Download and Install [https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.5-1/rubyinstaller-2.7.5-1-x64.exe Ruby+Devkit 2.7.5-1 (x64)]
 +
|Download and Install [https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.3-x64.exe  Ruby 2.3.3 (x64)]
  
[https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.2-1/rubyinstaller-devkit-2.7.2-1-x64.exe Ruby+Devkit 2.7.2-1 (x64)]
+
Best sure to select:
 +
* Install Tcl/Tk support
 +
* Add Ruby executables to your PATH
  
====Tk Gem====
+
[[File:RubyInstaller 233 with callout.png|400px]]
<nowiki>gem install tk</nowiki>
+
|-
 +
|2) <code>gem install tk</code>
 +
|2) <code>gem install tk</code>
 +
|
 +
|}
  
Note: If you have problems with this step, try installing [[Active_Tcl_Setup|Active Tcl 8.5]].
+
-->
  
 
====OS Gem====
 
====OS Gem====
Line 61: Line 126:
  
 
====OpenGL Runtime====
 
====OpenGL Runtime====
[https://www.transmissionzero.co.uk/files/software/development/GLUT/freeglut-MinGW.zip Download FreeGLUT]
+
NOTE: the first time you run one of the course's Ruby script which uses OpenGL, it will automatically download and extract [https://www.transmissionzero.co.uk/files/software/development/GLUT/freeglut-MinGW.zip FreeGLUT] and [https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.bin.WIN64.zip GLFW3] to your ~/Downloads/CSE425s folder and use the files within.
 +
 
 +
====Opener Gem====
 +
<nowiki>gem install opener</nowiki>
  
 
===Linux===
 
===Linux===
 +
<!--
 
====ActiveTcl====
 
====ActiveTcl====
 
{{:Active_Tcl_Setup}}
 
{{:Active_Tcl_Setup}}
 +
-->
 +
====Ruby Language====
  
====Ruby Language With Tk====
+
=====Fedora=====
A path that has worked on Ubuntu 20.04:
+
[https://developer.fedoraproject.org/tech/languages/ruby/ruby-installation.html install ruby]
  
 +
=====Ubuntu=====
 
  <nowiki>sudo apt-get install ruby-full</nowiki>
 
  <nowiki>sudo apt-get install ruby-full</nowiki>
 
+
<!--
  <nowiki>sudo gem install tk -- --with-ActiveTcl</nowiki>
+
  <nowiki>sudo gem install tk --with-ActiveTcl</nowiki>
 +
-->
  
 
====OS Gem====
 
====OS Gem====
Line 89: Line 162:
 
====OpenGL Gem====
 
====OpenGL Gem====
 
  <nowiki>sudo gem install opengl-bindings</nowiki>
 
  <nowiki>sudo gem install opengl-bindings</nowiki>
 +
 +
====Opener Gem====
 +
<nowiki>sudo gem install opener</nowiki>
  
 
<!-- Does NOT seem to be required for Linux: gem install glfw3-->
 
<!-- Does NOT seem to be required for Linux: gem install glfw3-->
Line 129: Line 205:
 
* [https://www.jetbrains.com/student/ Apply for student status with JetBrains]
 
* [https://www.jetbrains.com/student/ Apply for student status with JetBrains]
 
* [https://www.jetbrains.com/ruby/download/ Download and Install RubyMine]
 
* [https://www.jetbrains.com/ruby/download/ Download and Install RubyMine]
 +
* Ensure that the Ruby SDK and Gems setting is correctly configured
  
 
==Check Installation==
 
==Check Installation==
 +
<!--
 +
'''NOTE: CSE 425s no longer uses tk so there is no longer a tk_check.rb to run.'''
 +
 +
<youtube>7KN7NJ7VvNE</youtube>
 
===Tk===
 
===Tk===
 +
{{RubyToRun|tk_check|installation_check|main}}
 +
 
[[File:Tk installation check.png]]
 
[[File:Tk installation check.png]]
 +
-->
  
 
===OpenGL===
 
===OpenGL===
 +
 +
Mac users- run this:
 +
 +
{{RubyToRun|mac_osx_glfw_downloader_and_extractor|installation_check|main}}
 +
 +
Everyone, including Mac users, run this:
 +
 +
{{RubyToRun|opengl_check|installation_check|main}}
 +
 
[[File:Opengl  installation check.png]]
 
[[File:Opengl  installation check.png]]
  
 
===OpenGL Texture===
 
===OpenGL Texture===
 +
{{RubyToRun|opengl_texture_check|installation_check|main}}
 +
 
[[File:Opengl texture installation check.png]]
 
[[File:Opengl texture installation check.png]]

Latest revision as of 19:07, 7 November 2024

Language

Mac OSX

Note: depending on how the permissions are set up on your machine you may need to prefix a command with sudo or perhaps you may have to omit sudo.

Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 

Install Ruby

brew install ruby

Add Ruby To Path

if Mac OSX 10.15 Catalina or greater

   ~/.zshrc

else

   ~/.bash_profile

Add this line:

export PATH="/usr/local/opt/ruby/bin:$PATH"

check ruby

You can either

1) restart your terminal

or

2) source the appropriate configuration file based on your shell (which is often dependent on the OSX version)

source .zshrc

or

source .bash_profile

Then run

ruby --version

which should report version 2.7.2 as of Fall 2020.


OS Gem

sudo gem install os

PNG Gem

sudo gem install chunky_png

OpenGL Gem

sudo gem install opengl-bindings

Opener Gem

sudo gem install opener

Zip Gem

sudo gem install zip

Windows

Ruby

Download and Install Ruby+Devkit 3.1.2-1 (x64)


OS Gem

gem install os

PNG Gem

gem install chunky_png

OpenGL Gem

gem install opengl-bindings

Zip Gem

gem install zip

OpenGL Runtime

NOTE: the first time you run one of the course's Ruby script which uses OpenGL, it will automatically download and extract FreeGLUT and GLFW3 to your ~/Downloads/CSE425s folder and use the files within.

Opener Gem

gem install opener

Linux

Ruby Language

Fedora

install ruby

Ubuntu
sudo apt-get install ruby-full

OS Gem

sudo gem install os

PNG Gem

sudo gem install chunky_png

OpenGL Runtime

sudo apt-get update
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
sudo apt-get install libglfw3-dev

OpenGL Gem

sudo gem install opengl-bindings

Opener Gem

sudo gem install opener


IDE

Check Installation

OpenGL

Mac users- run this:

file to run: src/main/ruby/installation_check/mac_osx_glfw_downloader_and_extractor.rb Ruby logo.svg

Everyone, including Mac users, run this:

file to run: src/main/ruby/installation_check/opengl_check.rb Ruby logo.svg

Opengl installation check.png

OpenGL Texture

file to run: src/main/ruby/installation_check/opengl_texture_check.rb Ruby logo.svg

Opengl texture installation check.png