Run a Ruby command prompt in a browser - ruby

I've written a game in Ruby. Currently the only way to interact with it is with a CLI. It's packaged up as a gem.
I would like to put it on a website, for people to use. How would I go about that?
To clarify, I want a browser window that has a command prompt (like http://tryruby.org), that loads my gem first. I'm familiar with Heroku which I presume is the avenue of choice for this?

Related

Ruby Script to Runnable File

I'm a programming newb trying to send a Ruby script/mini-game thing to his teacher that can be ran by doubleclick. JRuby seems like a possible solution, as does Warbler, but I can't seem to figure either of those out. It doesn't have to be a specific filetype if it can be run without the terminal, just by clicking on it. Another possible solution is creating a shell script that runs the file as shown here, but I think that only works if you tell the computer running the script that it can be doubleclicked. It may even be possible to run by doing something in the Ruby file itself, but I am too inexperienced to know.
Thanks in advance for your answers!
When you say that only works if you tell the computer running the script that it can be doubleclicked, that isn't entirely true. If you email the file by itself, it might have its permissions removed, but if you package it up into a zip, then you're teacher shouldn't need to run chmod again.
Anyway, I'm not sure about the windows support for this approach (Ruby programmers tend to use Unix systems like OSX or Linux).
To make a cross platform executable, take a look at this question, which links to some packages such as "Ruby Ship"

Ruby/Tk in a browser

Is there a quick and easy way to make a ruby/Tk script run in a browser? I wrote a handy-dandy little ruby/tk script to do stuff. A friend saw it and said that his friends would love to use it, but they are extremely non-technical and cannot handle installing ruby (even though I showed him how simple it is). What he wants is for me to give him a link that someone can click on a browser and magically make the tool run.
I've looked around and get the impression that it cannot be done. 'it just does not work that way'. But I have not seen a clear 'NO' . I see things on how to get ruby to run in a browser, but not the Tk part. I also looked at rubyscript2exe but get the impression that it was abandoned.
No, you can't directly run Ruby in the browser like that.
There are websites such as RubyFiddle which let you run short snippets. What they're actually doing is executing the code remotely then displaying the result.
Because this code is actually being executed remotely, there's no way of running something interactive (like a TK UI) with it. There are some services which give you a hosted Ruby environment with working Terminal, but even these aren't going to work with a TK UI.
This section of Ruby Gems https://www.ruby-toolbox.com/categories/packaging_to_executables has a good list of all the tools available to package Ruby apps for distribution though, so you might be able to send them a simple installer to allow them to use it locally?
I've had a lot of success doing this with https://github.com/larsch/ocra/ which is actively maintained.

How to script keyboard clicks in a browser on a mac

The title says it all. I'm trying to script keyboard clicks in the browser (preferably Chrome). It's simple, from the current page I want to tab through 5 elements, then click enter, then repeat.
Right now I'm using a trial of the mac App "Fake" but it seems overly complicated for what I'm trying to do. I'm new to Macs and having trouble figuring out the simplest way to accomplish this. Any suggestions?
I'd take a look at Sikuli. It has a lot of things in its favor:
Comes with a nice starter IDE (or, you can write scripts in your own editor)
You can write Sikuli scripts in Jython, which is nice if you already know (or want to learn) Python
There's a Java API too, should you want to use pure Java
Sikuli's ability to do fuzzy matching of screenshots can be surprisingly robust
Scripts can be run from the command line once you grow out of the IDE (or want to plug the scripts into a continuous integration system)

How would you go about making an online IRB that runs in the browser

Im wondering how to go about creating an online IRB that runs in the browser. I have an idea to include an irb console in my blog and give the option for users to send code blocks in my tutorials directly into the irb console so they can play around with it.
_Why did this previously, but of course it is gone now: Cached Version
TryRuby is still available here, with source code at GitHub.
Well, you could use the sandbox that _why created. But you'll need to be able to patch your ruby and it seems to only work on ruby 1.8.5 .
That's insanely dangerous. Don't do this. You expose your system to all sorts of vulnerabilities when you allow users to execute arbitrary Ruby code.
Anyway there are some client-side Ruby implementations in JavaScript/Flash. Take a look at HotRuby.
I would suspect you run Ruby in a sandbox to prevent "bad" commands being run.

Is there a free/open source wget-like Windows program with graphical progress?

I am writing a WiX-based installer for our software. I need to download some non-trivial dependencies (like Sql Server Express 2008), then install them.
I could just use wget, but having the console open to show progress could be very confusing for non-technical people. Instead, I have been looking for a program that works just like wget, but shows its progress in a very simple window with the name of the file and the progress.
If I could show a small message that would be fantastic, but just having the GUI progress is the main thing.
I would even be interested in an existing program that almost does this, which I could recompile to add whatever I need. Since this is in an installer, it can't depend on .Net or anything else that needs installing to work.
Is anyone aware of such a program?
Why not to get wget sources and remove console output from there?
Since I did not find such a program, I wrote one. I used the latest libcurl available for Windows.
The code is not beautiful, and the program is not feature-complete, but it does what I need it to do: download from http:// while displaying a simple, attractive Window.
The titlebar is customizeable on the command-line, and I intend to allow window positioning too.
The project is hosted on google code: http://code.google.com/p/installerget/

Resources