Create a ruby script installer for Linux OS - ruby

I wrote an application using ruby and I want to create an installer for that. I'm using Linux as OS.
I know there's the ruby script setup.rb written by Minero Aoki, but It's a bit harsh to understand by reading the source code and I'd like to write my own setup.rb. This is my final objective.
This is the first time that I try to write an installer and I don't know how to start. I carried out some research on Google but I can't find what I'm really looking for.
Can anyone suggest me any books or manual where I can learn to put the files on the right place (or whatever the installers do on Linux OS)? To put it better I would like to learn the basics of "how to install source code" in Linux systems and then apply the theory to try to install my ruby scripts.
Any suggestion is accepted.

Why don't you write a gem for it ? This is the best packaging system we know for ruby and you can just distribute a .gem file that can be installed with a simple gem command.
Check http://guides.rubygems.org/make-your-own-gem

Related

Where can I compile my ruby code?

I started programming on ruby at codecademy but where can I compile my codes on doing a website?
When I was making some lessons on C I used codeblocks to run codes. I know any text editor can run a HTML code. So what about ruby?
Thank you.
I'll take a stab at answering the question that I think you're asking, but I'm not 100% sure here.
Ruby is an interpreted language (what does that mean? Not a whole lot nowadays. If you'd like a more in depth discussion on the distinction or lack thereof between interpreting vs compiling, read Jorg's comments below). To execute ruby code, you'll need to install ruby. Fortunately for you, this is freely available on any major platform. If you're on something unix-y (eg, linux or mac), I'd strongly recommend installing ruby via something like rvm or rbenv. If you're on windows, you can either go the cygwin route and pretend it's a unix-y environment, or there are prebuilt installers out there. Googling 'install ruby' should have some sites that can help you at or near the top of the search results.

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."

I need a way to run Haskell code without any install on a Mac

I enjoy developing in Haskell, but am presently confronted with a challenge. At my place of education, I don't have administrative rights on my account. I want to debug/test while there. I need a way to run Haskell code without installing haskell-platform or ghci or anything else requiring of an administrative level of privilege. For instance, a web site which will run haskell code (abeit limited to not include file access of course) or a java utility (or standalone .app, though java is preferred due to the nature of the "parental controls"), or something else I haven't thought of. Source or compiled Java, Flash, and source code in Ruby or Python are preferred to native code. This is on Mac OS X 10.6, for reference.
You can install GHC without admin privileges, but you'll have to build from source. Check out the Building on MacOS X for more details.
Essentially, like any other open-source project, you can compile code and install it, generally, anywhere on your filesystem like into a folder in your home folder (I often use the ~/.local folder for that purpose).
As the linked page mentions, you can also use MacPorts and install it to any place you can write to. Once MacPorts is installed you can install GHC.
EDIT
As pointed out by Carl in the comments below, you don't need to build from source. Just grab the binary tarball from http://www.haskell.org/ghc/download_ghc_7_4_1#binaries.
In addition to all the other ideas, several companies will rent you virtual (cloud) linux servers for a few cents an hour. You have root on those and can install whatever you want, then freeze the image until you need it again.
Normally this might not be advantageous over a local solution if you can make one work, but a possible extra benefit would be that your work can stay on a single "computer" which you could access while sitting in front of any variety of modern PC that might be available to you on a given day.
An alternative not only for Haskell is http://ideone.com/
For the website option, TryHaskell will hardly cut it, it's way to limited.
codepad, OTOH, is more liberal, and should be of more use.
But honestly the bindist option is the best one, clearly!
If you truly can't install anything, then there's
http://tryhaskell.org/ -- like GHCi, but you can't load modules, which means not only that you can't use many standard functions (say, the functions in Data.List), but also that you can't use certain language features (like user-defined algebraic data types).
I also remember a hpaste-style site which executes its code -- and allows you to have private pastes -- but I can't remember it at the moment. Edit: I was thinking of http://codepad.org/ -- thanks #Mog
Try http://hiji.tinyrocket.se/ It is a haskell interpreter written using javascript.
http://ghc.io/ GHC.IO is a version of the Haskell interactive interpreter, ghci, that runs online in a web browser.
You just need to install homebrew, which you can do without root rights if you do so in your home directory. You can then brew install cabal-install
which will automatically install cabal and ghc, or brew install stack to install stack.
There is a web-based interpreter for Haskell at http://tryhaskell.org/. However, it may not provide enough functionality for your requirements.

How can I create debian package (*.deb) from ruby application written with qt4?

I found a lot of tutorials how to build application with Ruby and Qt, but i have no idea how anybody else will be able to run it! I am using Ubuntu 11.10, ruby 1.9.2 with rvm and:
rbqtapi -v output "QtRuby 2.0.5 using Qt-4.7.4"
P.S. I have no idea how to build *.deb, it will be my first desktop app, not web.
please have a look on http://shoesrb.com/ this is the best way I heard off for writing GUI apps.
Shoes has now not it's greatest time, but we put our best time to make it better, give it a try and someone will help you.
In case you are in need of assistance just ask as question on #shoes IRC channel on freenode servers.
If you're sold on QT, then you will need your users to install all the support libraries for QT (and anything else), then you can upload a rubygem to rubygems.org for your users to download.
Once, they've installed the support libraries, you'd only need to update your rubygem, which is fairly quick and easy for updates.
You may also wan to look at visualruby. It uses GTK. Then you'd install the GTK libraries instead of the QT ones.
http://www.visualruby.net
As far as .deb packages go, I tried to research the same thing with little success. The rubygems packaging system is designed to distribute ruby programs, so it is the best way to go. Also, you'll need to install different support libraries for different platforms. If you look at visualruby's install page, you can see how to install GTK for Linux and Windows.
Good Luck.

Can I switch versions of Ruby dynamically using RVM?

I'm working on building a GUI for my checkers implementation. I'm utilizing a GUI framework that only works with Ruby 1.8, yet my game engine, which I have packaged as a gem, only works with Ruby 1.9.
I can't change the code for the GUI framework and reworking my game engine to make it compatible with 1.8 is undesirable, to say the least.
I'm using RVM though, and it looks like you can write RVM scripts to change Ruby versions on the fly.
Does anyone have any experience with that or what the script might look like?
You could run it in two processes. Give the GUI a 1.8 process and talk to it via a shared db or an API on the other side. That's how I'd do it. The good part about that is you can have on online version of your game as well because other clients will be able to talk to it as well.
You can't run one app with two versions of Ruby. How do you imagine this?
RVM has an ability to automatically change current ruby when you cd into a directory. Just create in that directory a file called .rvmrc with content like
rvm use 1.8.7

Resources