Skip to content

Instantly share code, notes, and snippets.

@adelevie
Created September 26, 2016 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adelevie/0a534cecfd969f700754322dbfb61a4c to your computer and use it in GitHub Desktop.
Save adelevie/0a534cecfd969f700754322dbfb61a4c to your computer and use it in GitHub Desktop.
➜ ruby-throwaway fake-ruby
irb(main):001:0> puts "hello"
hello
=> nil
irb(main):002:0> exit
➜ ruby-throwaway fake-ruby ruby --version
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-linux]
➜ ruby-throwaway touch hello.rb
➜ ruby-throwaway echo puts "hello" >> hello.rb
➜ ruby-throwaway fake-ruby ruby hello.rb
hello.rb:1:in `<main>': undefined local variable or method `hello' for main:Object (NameError)
➜ ruby-throwaway nano hello.rb
➜ ruby-throwaway fake-ruby ruby hello.rb
hello
➜ ruby-throwaway fake-ruby bundle init
Writing new Gemfile to /usr/src/myapp/Gemfile
➜ ruby-throwaway ls
Gemfile hello.rb
➜ ruby-throwaway nano Gemfile
➜ ruby-throwaway
➜ ruby-throwaway sudo nano Gemfile
[sudo] password for adelevie:
➜ ruby-throwaway nano hello.rb
➜ ruby-throwaway fake-ruby ruby hello.rb
Could not find gem 'pry' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
➜ ruby-throwaway fake-ruby bundle install && ruby hello.rb
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Installing coderay 1.1.1
Installing method_source 0.8.2
Installing slop 3.6.0
Using bundler 1.13.1
Installing pry 0.10.4
Bundle complete! 1 Gemfile dependency, 5 gems now installed.
Bundled gems are installed into /usr/local/bundle.
zsh: command not found: ruby
➜ ruby-throwaway fake-ruby ruby hello.rb
Your bundle is locked to coderay (1.1.1), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of coderay (1.1.1) has removed it. You'll need to update your bundle to a different version of coderay (1.1.1) that hasn't been removed in order to install.
Run `bundle install` to install missing gems.
alias fake-ruby='docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp ruby:2.1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment