Embed a ruby gosu game to play in a browser - ruby

I have played with some gosu tutorials to create a simple gosu game using my mac. I followed the instructions in https://www.libgosu.org/ruby.html
My question is:
Can a gosu game be set up to run on a website using something like https://github.com/opal/opal-browser using a gem "opal"
Opal compiles the game.rb file but does not add gems. So I get an error, cannot find require file.
I want to set up an index.html page and run the game in a web browser with a button that runs bundle exec ruby game.rb instead of running the file from the console.
This question Ruby: Running Gosu game from a web browser may have asked the same thing but my question is around using Google Native Client tools to solve it.

Related

Running Sinatra within a MacRuby app

I'm new to MacRuby with Xcode but I have what I think (hope) is a simple question. I have a small Ruby Sinatra web app that I want to package as a Mac OS packaged application (.app). The application (however it is packaged) is used to read a specific plist file that is apart of Mac OS X Server and display the results through a specific web port in a browser. I don't know if MacRuby is the way to go, but all I need is a simple GUI that starts and stops the Sinatra web app so that users don't have to fuss with the command line (and hopefully without having to install gems, etc). I'm starting to figure out some of the basics of MacRuby and Xcode 4 but I'm not sure where to place the Sinatra ruby file within the Xcode project or how to start it.
I do know how to run a bash command start the ruby server within the application path but not sure if that's the best way or where to actually put the ruby file.
Please forgive my lack of knowledge of desktop developmentā€”I really only work in the web world. If I can elaborate on any points, let me know.
Control Tower may be your solution:
https://github.com/MacRuby/ControlTower
Part of the macruby project, it does basically what you wish. It's still very new & needs work, but It does function. I have been able to get it to work with sinatra for some test apps but I have yet to try to get any of my actually apps to run thru it (As I am still learning myself)

Ruby browser automation

I want to write ruby script which run browser (for example, firefox), open web-addresses, click links, check/uncheck boxes and other stuff. What gem can i use for that?
Selenium / Selenium Ruby is another option and there's Selenium IDE for scripting Firefox.
"It is implemented as a Firefox extension, and allows you to record,
edit, and debug tests."
Check watir and watir_webdriver which is used for automated web browser testing but it can be used for browser scripting from ruby http://watir.com/
you can use the rb-appscript framework to automate macosx
http://appscript.sourceforge.net/rb-appscript/index.html
Its a ruby framework that uses the applescript interfaces to interact with the macos applications.
I'm not sure if there is a gem you can use to install yet but there is are install instructions in the link above.
there is a nice article at http://www.apeth.com/rbappscript/00intro.html that shows how to replace applescript with ruby using rb-appscript
Check out watir, watir-webdriver or firewatir. It's very easy to use especially if you're just starting out. You can check out this quick tutorial on how to set it up, it's extremely easy.
http://webmites.org/watir-automated-tests-for-everyone/

How to package ruby shoes apps on OSX 10.7

I have been making an app using Ruby Shoes. I am happy with how it turned out and would like to share it with some friends. However, the GUI packager doesn't work in OSX and the Windows packager only seems to make a .shy file. I've been reading around looking for solutions and I don't understand any of them. Can someone clearly explain step-by-step how to package a Ruby Shoes app to say a DMG or an EXE file?
Personally, I prefer to use green_shoes. Green_shoes is a pure ruby gem that you require in your ruby code instead of a program that packages your ruby code. This way, you can use a program such as ocra to make your ruby file into exe. While it is sort of a hack, I feel that it is better than requiring your users to install shoes to run your program.
Check this out.
Compiling/Package a Shoes.app to a standalone Mac.app?
[How?] "By compiling your app and Shoes together. This is what I do with Hackety Hack. Totally works."

How to display content for a ruby game?

I am wanting to do a game in Ruby, but I came across a problem. I am intermediate level in Ruby. I only know of running Ruby through the command line but to make the game I am thinking of similar to Dwarf Fortress would require something more.
I need to be able to use arrow keys and enter to select things. I also need 2 frames displaying, one for the map and one for in-game information.
How do I go about doing this? Would I need to use a GUI or something to that effect. If it can't be a desktop app, that's fine. I have a vague idea of how I could do it in the browser.
Check out the gosu gem which gives you a 2d game engine from www.libgosu.org
gem install gosu
# complete with examples, precompiled for Windows & OS X
gem install texplay
# pixel-based drawing on Gosu images, by banister
gem install chingu
# a library that adds more game logic, by ippa
gem install ruby-opengl
# the standard Ruby OpenGL gem works fine with Gosu to add 3D effects
# (See the included example, or this fine bundle of tutorials by tjbladez. Also note this thread if you have problems installing on Windows)
gem install chipmunk
# a popular physics library with an integration example in the wiki
gem install rmagick
# can be used as a more powerful but harder-to-distribute alternative to TexPlay, example included in Gosu
How about ruby-gl
http://ruby-opengl.rubyforge.org/

Windows (or online) Web Workflow For A Newbie? (rubygems are confusing)

i'm a web designer (front-end developer) who would like to use sass+compass and slim-lang (similar to haml, but more lightweight). if you're unfamiliar, these are all rubygems, which parse code and compile to html and css. That's where my understanding ends.
i've been through a few ruby tutorials, but they're ALL geared towards mac users. sadly, i'm a windows user, and i get but a confusing footnote. i tried installing ruby, but none of the commands would work, so i started looking at other solutions (due to windows' sickening lack of a useful command line).
currently i'm looking into using cloud9 for editing and github for compiling (is that even possible?)... but i don't understand git at all. is this overkill? is there an easy way to do this, or at least some concise explanation of all this? i know i'm not stupid; i just feel like there's some key thing i'm missing here.
(note to self: buy a mac)
tl;dr:
Things I have:
windows
Things I need:
a simple ide to edit code / manage projects
a simple way to compile slim,compass,sass without a headache
Sorry to hear you're having problems. Some things to try:
Install RubyInstaller
In the Windows Start menu locate the Ruby program group and run "Start Command Prompt with Ruby"
At the prompt type gem install compass
You should see something like this:
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
C:\>gem install compass
Fetching: sass-3.1.15.gem (100%)
Fetching: chunky_png-1.2.5.gem (100%)
Fetching: fssm-0.2.8.1.gem (100%)
Fetching: compass-0.11.7.gem (100%)
Successfully installed sass-3.1.15
Successfully installed chunky_png-1.2.5
Successfully installed fssm-0.2.8.1
Successfully installed compass-0.11.7
4 gems installed
Does this work? If so then you're good to go. You'll also need to install Slim: gem install slim. Try following the Compass install documentation from here. The commands for Windows are identical to those for Mac/Linux. If you need some help learning about the Windows command line, there are plenty of tutorials around.
Take a look at Compass.app and Scout if you really don't get on with the command line. I really do recommend getting to grips with the command line, though. It's a very handy skill to possess.
I'd recommend using a simple text editor rather than an IDE. I prefer Sublime Text 2, but Notepad++ or Scite might suit you better. RubyMine is a good IDE, but it's not exactly simple.
Forget Git for now - you don't need it for what you're trying to do (compile Sass and Slim files).
One final parting thought: what you're after doing it roughly equal in difficulty on a Mac, so purchasing one wouldn't, at this stage, make life much easier for you. In the long-run, though, if you get into, say, Rails development seriously, then a Mac would make life easier. If you're simply compiling Sass and Slim, though, no need to switch. The authors have done a great job cross-platform job.

Resources