Ruby & Yun

Install Ruby:

opkg update
opkg install ruby
opkg install ruby-gems
opkg install ruby-core

Test Hello world:

nano hello-world.rb
puts 'Hello world'
ruby hello-world.rb
Hello world

I really like Ruby and I have used it for several years but last year I reluctantly gave it up and switched to Python because Python is much more likely to exist on a PC "out-of-thebox" so it is far more likely to find people with some knowledge of it, or with the ability to run code that might post in the Forum.

The fact that you have to write this Thread sort of proves the point - Python comes as standard.

Also, it is very much easier to write a Python app that can be given to "Granny" to run on her PC without any external dependencies apart from Python itself. For example, PySerial can be included with the source code but the Ruby equivalent has to be installed as a GEM - and Granny won't know how to do that, or won't want the trouble.

JRuby (Ruby on Java) does solve the cross-platform problem but it is not as convenient as Python and the delay when you start a JRuby program will try the patience of a saint during the development process.

I have come to the conclusion that the Python "team" have a much more practical world view. The best example is the development of Rails without anyone bothering to write the link to make it work with Apache. That came much later.

If these practical problems were solved I would return to Ruby tomorrow.

...R

And python has good and light web framework, Bottle, which I think is easy to understand (and Im new to python).

The Sinatra web framework for Ruby is similar to Bottle (or should that be the other way round? I don’t know which came first).

…R

Hi everyone, i need to use Ruby because i found a rb script that i must use to solve a problem with my Samsung remote aircon :slight_smile:

This script create a socket and connect to samsung website to get a token. Then it connects with the aircon using this token via local ip and the aircon execute the command because trust the connection.

So, I installed ruby with

opkg update
opkg install ruby
opkg install ruby-gems
opkg install ruby-core

and with

opkg install ruby-cgi (i don’t kwow if is necessary)

My problem is a “require” function that generate error:
the script:

require 'rubygems'
#require "bundler/setup"
require './lib/samsung'

....

the error:

/usr/lib/ruby/1.9/rubygems/custom_require.rb:36:in `require': cannot load such file -- nokogiri (LoadError)
	from /usr/lib/ruby/1.9/rubygems/custom_require.rb:36:in `require'
	from /mnt/sda1/samsung/lib/samsung.rb:1:in `<top (required)>'
	from /usr/lib/ruby/1.9/rubygems/custom_require.rb:36:in `require'
	from /usr/lib/ruby/1.9/rubygems/custom_require.rb:36:in `require'
	from example-direct.rb:3:in `<main>'

can someone help me ?