Last active
August 29, 2015 13:57
-
-
Save krnwonseungee/9536759 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WHAT ARE ENVIRONMENTAL VARIABLES? | |
| probably saw them in your challenge directories, under config. | |
| such as ENV['BUNDLE_GEMFILE'] in the environment.rb file and | |
| Environment variables are variables passed to programs by the command line or the graphical shell. | |
| Though there are a number of environment variables that only affect the command line or graphical | |
| shell itself (such as PATH or HOME), there are also several that directly affect how Ruby scripts execute. | |
| basically, they are variables that capture a certain element in your environment. | |
| HOW TO ACCESS THEM? | |
| most commonly, system path variables. | |
| Windows: SET | |
| Mac & Linux: printenv | |
| LANG=en_US.UTF-8 | |
| USER=apprentice | |
| HOME=/Users/apprentice | |
| on IRB, enter ENV and that will give you the list of environmental variables pertaining to Ruby. | |
| "PWD" => "/Users/apprentice", | |
| "EDITOR" => "/usr/local/bin/subl --wait", | |
| "LANG" => "en_US.UTF-8", | |
| "ITERM_PROFILE" => "Default", | |
| "_system_arch" => "x86_64", | |
| "PS1" => "\\n\\[\\e[0;38;5;32m\\]`_ps1_git_username``__git_ps1`\\040\\[\\e[m\\]\\w\\n\\[\\e[0;38;5;250m\\]$\\[\\e[m\\]\\040", | |
| "_system_version" => "10.9", | |
| "rvm_env_string" => "ruby-1.9.3-p448", | |
| "rvm_version" => "1.22.15 (stable)", | |
| "SHLVL" => "1", | |
| "COLORFGBG" => "12;8", | |
| "HOME" => "/Users/apprentice", | |
| "rvm_ruby_string" => "ruby-1.9.3-p448", | |
| "ITERM_SESSION_ID" => "w0t0p0", | |
| "LOGNAME" => "apprentice", | |
| "GEM_PATH" => "/Users/apprentice/.rvm/gems/ruby-1.9.3-p448:/Users/apprentice/.rvm/gems/ruby-1.9.3-p448@global", | |
| "DISPLAY" => "/tmp/launch-poRAL6/org.macosforge.xquartz:0", | |
| "RUBY_VERSION" => "ruby-1.9.3-p448", | |
| "_system_name" => "OSX", | |
| "__rvm_date" => "() { \\date \"$@\" || return $?\n}", | |
| "_" => "/Users/apprentice/.rvm/rubies/ruby-1.9.3-p448/bin/irb", | |
| "LINES" => "25", | |
| "COLUMNS" => "80" | |
| WHAT IS ENV, IN CONTEXT OF RUBY? | |
| ENV is a hash-like accessor for environment variables. it's on Ruby Docs. | |
| in order to access your variables and the values of those variables, | |
| you include the word ENV in your command. | |
| For example... | |
| ENV[name] = value | |
| ENV.each_pair (yields each key-value pair in a hash) | |
| has_value? | |
| RESOURCES | |
| http://www.ruby-doc.org/core-2.1.0/ENV.html | |
| http://ruby.about.com/od/rubyfeatures/a/envvar.htm | |
| http://softimage.wiki.softimage.com/xsidocs/EnvVars_SettingandUsingEnvironmentVariables.htm | |
| http://www.makeuseof.com/tag/what-are-environment-variables-how-can-i-use-them-windows/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment