Playing sound in Ruby 1.9.2 on Windows 7? - ruby

When I follow this tutorial on Ruby 1.9.2 on Win 7, I get this error:
Is there a simpler way to play a sound? (specifically, wav)

The problem is that you're using Ruby 1.9.2 and the binary gem for win32-sound, the binary, has not been compiled or made compatible with Ruby 1.9.x, only Ruby 1.8
You can skip this using the RubyInstaller DevKit downloadable from RubyInstaller website.
Please follow the instructions from the DevKit page to complete the installation. Also note that to install win32-sound, you will need to change the command for the gem installation.
First:
gem list win32
gem list windows
Uninstall all the win32- and windows gems
Then:
gem install win32-sound --platform=ruby
That should install and compile a binary compatible with your installed Ruby.
Hope that helps

Related

How do I find which versions of ruby, gem and bundler are compatible?

I am using puppet to install ruby 1.9.3 as the system ruby on an Ubuntu Trusty Vagrant container. I also install Bundler. I am told that "gem" is installed as part of the installation of ruby.
How do I know which versions of gem go with this version of ruby?
How do I know which versions of bundler go with this version of ruby?
Here is a fragment of puppet code:
$other_reqs = [
...
'ruby1.9.3',
'ruby-bundler',
'rubygems-integration',
...
]
package{ $other_reqs: ensure => 'installed'} -> Package['percona-toolkit']
The package declaration will default to using apt-get to download packages. Clearly the line with 'ruby1.9.3' will get the 1.9.3 version of ruby. It also installed gem 1.8.23. Is this a compatible version of gem? How do I know?
The line with 'ruby-bundler' installed Bundler version 1.3.5. Is this a compatible version of Bundler? Or should I indicate a specific version in my requirements array? Where ought I look to find this information?
It might be helpful if you indicate the problem, or what you're trying to do. Nevertheless:
gem is a command that is built-in in ruby from 1.9+, so whatever comes installed with Ruby should be fine.
bunlder is a RubyGem, normally installed by doing gem install bundler. You can specify the version by doing gem install -v <version>. Either it gets installed correctly or you get an error. Can you install bundler doing that?
And lastly, unless you need it for a specific reason, 1.9 is very old :)

Updating Ruby to 2.0.0 using Pik

After installing pik and changing my Ruby version to 2.0.0, bundler no long works properly
C:\Users\Me\Documents\Work Projects\Application>bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Installing atomic (1.1.14)
Gem::InstallError: The 'atomic' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing atomic (1.1.14), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.14'` succeeds before bundling.
Installing the devkit from Ruby Installer sort of defeats the reason why I went to the trouble of installing pik. How can I fix this, so that in the future, I can easily update ruby using pik and still have everything working?
I had the same problem - if you follow the instructions listed (ie installing devkit and following their directions [they don't actually tell you to use rubyinstaller]), you'll be fine. Also make sure that during the init phase of the Devkit instructions that it doesn't miss any of your ruby installations.
A note though, it seems that pik can't specify the x64 version of 2.0.0, so you may run into problems if that's the case. In the end I had to use the rubyinstaller for the x64 version of ruby, and then ran the x64 version of the devkit.
Hope this helps.
I think Josh' answer is probably right, but I actually installed Ubuntu as a VM in the end, just so I could use RVM.
RVM is a thousand times better than Pik, and it installs the DevKit. It's so good it's genuinely worth installing Ubuntu just so you can use it.

How to install a ruby gem on windows 7

Sorry to ask such a basic question. I'm trying to install tiny_tds as explain on this page. I've tried $ gem install tiny_tds, I'm getting error: Syntaxt error, unexpected $undefined. If I remove $, the error becomes undefined local variable or methos "tiny_tds". I don't know where to start to install a gem. I'm using the ruby command prompt.
Thanks for helping
I guess you should try railsinstaller for windows that includes rubygems. Then gem install tiny_tds in the command prompt.
You need to download the Ruby installer depending on you systems settings (32 or 64 bit) and the ruby development kit in order to run command lines. Here is a link to the installer and a simple guide for installing the DevKit for ruby on windows (this one is to make jekyll run on windows, jekyll is other ruby gem):
Ruby Installer:
http://rubyinstaller.org/downloads/
Devkit configuration:
http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html

Which Ruby Version for Watir on Windows?

What version of Ruby should I be using on a windows environment?
I'm trying to use Watir on 1.9 and it does not work. Will work on 1.8.6.
Any recomendations on which version to use and reasons why Watir does not work on 1.9
Watir.com recommends using Ruby 1.8.6-26. I have not tried it, but there is a fork of Watir that claims to be compatible with Ruby 1.9:
http://github.com/vapir/vapir
I use this one and it works:
>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
There's no "correct" version. 1.8.6, 1.8.7 and 1.9.1 are all officially "recommended", which is not much help!
When 1.8.x gems don't work with 1.9.x under Windows, it's often the case that the gem - or one of its dependencies - includes a compiled element (a DLL, usually named with a .so extension) and that this component hasn't yet been compiled against mingw32, which is the standard for Ruby 1.9, whereas 1.8.6 and previous versions were compiled with the (old) MS Visual C.
Looking at the watir gem, I see it includes win32ole.so, which could be the problem. I'm not sure why that should have been necessary - it's part of the installed set for Windows. Perhaps the developers needed to ensure a fixed stable version so they forced a particular version rather than use the one from the library. Or maybe they fixed something? Dunno.
Beyond that, watir also depends on win32-api and nokogiri, both of which installed mswin32 versions on my machine and will need to have mingw32 versions to work with 1.9.
Not having a 1.9 instance to hand, I can't quickly tell if these versions exist.
Try looking for a mingw32 version of win32ole.so (probably somewhere like [ruby-dir]/lib/ruby/1.9/i386-mingw32) and putting it in place of the one used by watir.
It's best to use the mingw versions of Ruby as supplied with the RubyInstaller. The older mswin32 versions of Ruby are considered legacy. Some gems need to be compiled from source (RedCloth being a good example) and for this you'll need to install the DevKit; however, watir doesn't need anything to be compiled - all of its gem dependencies come pre-compiled with mingw32 extensions (nokogiri and win32-api).
You can install multiple versions of Ruby (including JRuby and IronRuby) on Windows using Pik. Once you've installed the Pik gem, you can easily install new versions of ruby by issuing commands such as pik install ruby 1.9.1 or pik install jruby. You can even do pik install devkit to install the DevKit for all installed copies of Ruby. Documentation and lots of examples of use can be found here.
To allow Watir (and FireWatir) to run on ruby 1.9.2
install devkit and follow procedures listed here : http://rubyinstaller.org/downloads/ Ruby Installer at GitHub
gem uninstall win32-api
gem install win32-api --platform=ruby

Installing FxRuby on Windows

Simple question: How to install FxRuby on windows.
I have installed ruby 1.9 using one click installer from http://rubyinstaller.org/
Just open up command prompt and type:
gem install fxruby
It will then be installed and ready to use. To use it in your applications, just place:
require 'fox16'
at the top of your file.
In 1.9.2 it is included in Windows package so no gem download needed.
It does not appear in the gem list though, buts it's there.
As of 1.6.20, installation can be performed using gem install fxruby:
Release notes for 1.6.20

Resources