Showing posts with label Ruby. Show all posts
Showing posts with label Ruby. Show all posts

Thursday, December 11, 2014

SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/

Make sure you use latest rvm:
rvm get stable
Then you can do two things:
  1. Update certificates:
    rvm osx-ssl-certs update all
  2. Update rubygems:
    rvm rubygems latest


OR

gem sources -r https://rubygems.org
gem sources -a http://rubygems.org  

Sunday, April 7, 2013

Ruby toolbox

Friday, March 15, 2013

Essential Ruby reading

http://net.tutsplus.com/articles/web-roundups/essential-ruby-rails-3-reading-3/

Thursday, February 14, 2013

Rubymotion

A framework to develop for iPad and iPhone.
www.rubymotion.com

Sunday, September 2, 2012

RVM cheat sheets

Source: http://cheat.errtheblog.com/s/rvm/

RVM home page: https://rvm.beginrescueend.com

Install RVM
------------

See https://rvm.beginrescueend.com/rvm/install/

bash -s stable < <(curl -s \
https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Update RVM
----------

    rvm get stable

In case of problems try first with development version
(maybe it's already fixed):

    rvm get head

Very old installations might not support those update methods, just run the
installer and reopen your terminal.

List known rubies
-----------------

    rvm list known


Install Ruby dependencies
-------------------------

Follow instructions from:

    rvm requirements

Install Ruby
------------

    rvm install 1.9.3                # Latest known patch level
    rvm install 1.9.3 -j 3           # Parallel compile, set to # of CPU cores
    rvm install 1.9.3 --patch falcon # Use a patch (falcon for performance)
    rvm install 1.9.2-p318           # Patchlevel 318
    rvm install rbx --1.9            # Rubinius with 1.9 mode set as default

List all rubies and gemsets
---------------------------

    rvm list         # List rubies only
    rvm list gemsets # List rubies and gemsets
    rvm gemset list  # List gemsets for current ruby

Selecting Ruby for work
-----------------------

    rvm system                 # For system ruby, with fallback to default 
    rvm use jruby              # For current session only
    rvm use --default 1.9.3    # For current and new sessions
    rvm use --ruby-version rbx # For current session and this project

RVM will automatically use a ruby and gemset when you `cd` to a project
directory.

Read more on project files:

- https://rvm.beginrescueend.com/workflow/projects/#ruby-versions

Using ruby and gems
-------------------

After selecting Ruby work as usual:

    ruby -v
    gem install haml
    haml

Temporarily selecting another Ruby or gemset
--------------------------------------------

    rvm 1.8.7 do gem install rspec      # in the given ruby
    rvm 1.8.7,1.9.2 do gem install haml # in this two rubies
    rvm @global do gem install gist     # in @global gemset of current ruby

Gemsets
-------

RVM by default allows creating multiple environments for one ruby - called
*gemsets*.

Gemsets can be specified together with ruby name using gemsets separator(@):

- ruby-1.9.3-p125@my-project

During installation of Ruby, RVM creates two gemsets:

- default - automatically selected when no @gemset specified: rvm use 1.9.3
- global  - super gemset, inherited by all other gemsets for the given ruby

Working with gemsets:

    rvm use 1.8.7                   # use the ruby to manage gemsets for
    rvm gemset create project_name  # create a gemset
    rvm gemset use project_name     # use a gemset in this ruby
    rvm gemset list                 # list gemsets in this ruby
    rvm gemset delete project_name  # delete a gemset
    rvm 1.9.1@other_project_name    # use another ruby and gemset
    rvm 1.9.3@_project --create     # use and create gemset if not existing

Install RVM for all users
--------------------------

Discouraged; make sure to read http://rvm.beginrescueend.com/rvm/installation/

More help ?
-----------

A lot of resources is available:

- in your terminal: `rvm help`
- https://rvm.beginrescueend.com/
- IRC #rvm @ freenode - http://webchat.freenode.net/?channels=#rvm

Saturday, May 5, 2012

Rails ExecJS::RuntimeError

(With the help of www.railszilla.com)

If you’re riding Ruby on Rails V3.11 and get the error

get rails ExecJS::RintimeError

Then try installing the V8 Javascript interpreter into Ruby.
Just edit your Gemfile and add

gem 'therubyracer'

then execute the famous
bundle install

This has also several advantages, such like:
  • Evaluate Javascript from with in Ruby
  • Embed your Ruby objects into the Javascript world
  • Manipulate JavaScript objects and call JavaScript functions from Ruby
  • API compatible with the The Ruby Rhino

Friday, May 4, 2012

Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 crashes with “Symbol not found: _ruby_threadptr_data_type”


download linecache19 and ruby-debug-base19 from RubyForge:

% curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
% curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem


compile the two gems

% gem install linecache19-0.5.13.gem
Building native extensions.  This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed...
% gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0Building native extensions.  This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed...


update your Gemfile

# file: Gemfile
...
group :development do
  gem 'linecache19', '0.5.13'
  gem 'ruby-debug-base19', '0.11.26'
  gem 'ruby-debug19', :require => 'ruby-debug'
end

bundle install and test the debugger

% bundle installFetching source index for http://rubygems.org/
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
% irb
irb(main):001:0> require 'ruby-debug'
=> true
irb(main):002:0> debugger
$SANDBOX/usr/lib/ruby/1.9.1/irb/context.rb:166
@last_value = value(rdb:1) p 'hooray'
"hooray"

Ruby-debug fork:
https://github.com/cldwalker/debugger

Discussions:
http://stackoverflow.com/questions/9122232/how-do-i-install-ruby-debug-in-ruby-1-9-3-rails-3-2-1
http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
http://dirk.net/2010/04/17/ruby-debug-with-ruby-19x-and-rails-3-on-rvm
http://stackoverflow.com/questions/7054948/ruby-debug19-on-ruby-1-9-3-preview1

Powered by Blogger.