Skip to content

Instantly share code, notes, and snippets.

@kweestian
Created September 30, 2014 18:34
Show Gist options
  • Save kweestian/42d817533d03a446d7a3 to your computer and use it in GitHub Desktop.
Save kweestian/42d817533d03a446d7a3 to your computer and use it in GitHub Desktop.
Interactive ruby
Last login: Tue Sep 30 10:40:48 on ttys001
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ ~/Documents/Christian/LightHouseLabs/
-bash: /Users/bettinahamelin/Documents/Christian/LightHouseLabs/: is a directory
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ cd Vagrantfile
-bash: cd: Vagrantfile: Not a directory
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ ls
AlbumData.xml
Applications
Attachments
Auto Import
ChangeManagement-MegWhitmanandeBay.doc
ChangeManagement-StarDistributorsInc-1..docx
Database
Desktop
Documents
Downloads
Dropbox
GitHub
Info.plist
Library
Library.data
Library.iPhoto
Library6.iPhoto
Library7.iPhoto
Masters
Medical & Dental claim summary 2009.pdf
Medical & Dental claim summary.pdf
Movies
Music
Pictures
Previews
ProjectDBVersion.plist
Projects.db
Projects.db-journal
Public
Sites
Thumb64Segment.data
ThumbJPGSegment.data
Thumbnails
Vagrantfile
VirtualBox VMs
W1D1.md
iLifeShared
iPhoto.ipspot
iPhotoAux.db
iPhotoLock.data
iPhotoMain.db
iPod Photo Cache
notes.md
rent 2586 Cook
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ cd ~/Documents/Christian/LightHouseLabs/VagrantFile/work/Vagrantfile
-bash: cd: /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/work/Vagrantfile: Not a directory
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ pwd
/Users/bettinahamelin
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ vagrant ssh
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
VM must be created before running this command. Run `vagrant up` first.
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/base
Bettina-Hamelins-MacBook-Pro:~ bettinahamelin$ cd ~/Documents/Christian/LightHouseLabs/VagrantFile/
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/base
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ cd ~/Documents/Christian/LightHouseLabs/VagrantFile/work/Vagrantfile
-bash: cd: /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/work/Vagrantfile: Not a directory
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ pwd
/Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ work/.vagrant/machines/default/virtualbox/
-bash: work/.vagrant/machines/default/virtualbox/: is a directory
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/base
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ pwd
/Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ work/.vagrant/
-bash: work/.vagrant/: is a directory
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/base
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant init
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
`Vagrantfile` already exists in this directory. Remove it before
running `vagrant init`.
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/base
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ pwd
/Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/base
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ work/.vagrant/machines/default/virtualbox/
-bash: work/.vagrant/machines/default/virtualbox/: is a directory
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/base
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'base' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box 'base' (v0) for provider: virtualbox
default: Downloading: base
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.
Couldn't open file /Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile/base
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ ls
Vagrantfile scavenger_hunt-master work
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ pwd
/Users/bettinahamelin/Documents/Christian/LightHouseLabs/VagrantFile
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ vagrant ssh
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
VM must be created before running this command. Run `vagrant up` first.
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ cd Vagrantfile / work/
-bash: cd: Vagrantfile: Not a directory
Bettina-Hamelins-MacBook-Pro:VagrantFile bettinahamelin$ cd work/
Bettina-Hamelins-MacBook-Pro:work bettinahamelin$ vagrant ssh
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-65-generic-pae i686)
* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Tue Sep 30 01:41:51 2014 from 10.0.2.2
vagrant [vagrant]> orb
No command 'orb' found, did you mean:
Command 'rb' from package 'lrzsz' (universe)
Command 'irb' from package 'ruby1.8' (main)
Command 'irb' from package 'ruby1.9.1' (main)
Command 'erb' from package 'ruby1.8' (main)
Command 'erb' from package 'ruby1.9.1' (main)
Command 'orbd' from package 'gcj-4.6-jre-headless' (main)
Command 'orbd' from package 'openjdk-6-jre-headless' (main)
Command 'orbd' from package 'openjdk-7-jre-headless' (universe)
Command 'orbd' from package 'gcj-4.5-jre-headless' (universe)
Command 'mrb' from package 'mrb' (universe)
orb: command not found
vagrant [vagrant]> irb
2.0.0-p247 :001 > ^C
2.0.0-p247 :001 > irb
2.0.0-p247 :001 > ^C
2.0.0-p247 :001 > q
NameError: undefined local variable or method `q' for main:Object
from (irb#1):1
2.0.0-p247 :002 > irb
2.0.0-p247 :001 > say_hi "Josh"
NoMethodError: undefined method `say_hi' for main:Object
from (irb#2):1
2.0.0-p247 :002 > say_hi = "Josh"
=> "Josh"
2.0.0-p247 :003 > say_hi = "Hi, "
=> "Hi, "
2.0.0-p247 :004 > say_hi "Josh
2.0.0-p247 :005"> say_hi "Josh"
2.0.0-p247 :006"> puts "Hi, Josh"
2.0.0-p247 :007"> irb
2.0.0-p247 :008"> say_hi = "Josh"
2.0.0-p247 :009"> :q
2.0.0-p247 :010"> :wq
2.0.0-p247 :011"> :qw
2.0.0-p247 :012"> say_hi = "Josh"
2.0.0-p247 :013"> say_hi = Josh
2.0.0-p247 :014">
Display all 333 possibilities? (y or n)
! equal?
!= eval
!~ exec
<=> exit
== exit!
=== extend
=~ fail
@prompt false
ARGF fg
ARGV for
ArgumentError fork
Array format
BEGIN freeze
BasicObject frozen?
Bignum gem
Binding gem_original_require
CROSS_COMPILING gets
Class global_variables
Comparable hash
Complex help
ConditionVariable if
Config in
Data include
2.0.0-p247 :014">
2.0.0-p247 :015"> q
2.0.0-p247 :016"> say_hi ="Hi, "
2.0.0-p247 :017"> my_name = "Christian"
2.0.0-p247 :018"> say_hi + my_name
2.0.0-p247 :019"> gem
2.0.0-p247 :020"> rmv-v
2.0.0-p247 :021"> help
2.0.0-p247 :022"> quit
2.0.0-p247 :023"> exit
2.0.0-p247 :024"> let me out
2.0.0-p247 :025"> help
2.0.0-p247 :026"> quit
2.0.0-p247 :027"> help
2.0.0-p247 :028"> x = 'something'
2.0.0-p247 :029">
2.0.0-p247 :029 >
SyntaxError: (irb#2):5: syntax error, unexpected tCONSTANT, expecting end-of-input
say_hi "Josh"
^
2.0.0-p247 :029 >
=> #<IRB::Irb: @context=#<IRB::Context:0x8641574>, @signal_status=:IN_EVAL, @scanner=#<RubyLex:0x8640fc0>>
2.0.0-p247 :003 >
IRB::Abort: abort then interrupt!
from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 > ^C
2.0.0-p247 :002 >
vagrant [vagrant]> irb
2.0.0-p247 :001 > my_name = "Christian"
=> "Christian"
2.0.0-p247 :002 > say_hi = "Hi, #{my_name}"
=> "Hi, Christian"
2.0.0-p247 :003 > my_name.chomp
=> "Christian"
2.0.0-p247 :004 > my_name.reverse
=> "naitsirhC"
2.0.0-p247 :005 > my_name.inspect
=> "\"Christian\""
2.0.0-p247 :006 > #!/usr/bin/env ruby days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Saturday", "Sunday"]days.each do|d| puts d end
2.0.0-p247 :007 > !/usr/bin/env ruby days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Saturday", "Sunday"]days.each do|d| puts d end
(irb):7: warning: regex literal in condition
SyntaxError: (irb):7: unknown regexp option - b
(irb):7: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
!/usr/bin/env ruby days = ["Monday", "Tuesday",...
^
(irb):7: syntax error, unexpected tIDENTIFIER, expecting end-of-input
...day", "Saturday", "Sunday"]days.each do|d| puts d end
... ^
from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'
2.0.0-p247 :008 > array.new(10, 'bee')
NameError: undefined local variable or method `array' for main:Object
from (irb):8
from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'
2.0.0-p247 :009 > Array.new(10, 'bee')
=> ["bee", "bee", "bee", "bee", "bee", "bee", "bee", "bee", "bee", "bee"]
2.0.0-p247 :010 > Array.new(10, 'bee', 'mouse', 'cats')
ArgumentError: wrong number of arguments (4 for 0..2)
from (irb):10:in `initialize'
from (irb):10:in `new'
from (irb):10
from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'
2.0.0-p247 :011 > Array.new(3, "cat", "mouse", "bird")
ArgumentError: wrong number of arguments (4 for 0..2)
from (irb):11:in `initialize'
from (irb):11:in `new'
from (irb):11
from /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/irb:13:in `<main>'
2.0.0-p247 :012 > Math.sqrt(1282)
=> 35.805027579936315
2.0.0-p247 :013 > include Math
=> Object
2.0.0-p247 :014 > sqrt 64
=> 8.0
2.0.0-p247 :015 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment