views:

671

answers:

4

I wonder when we write a program in PHP, Ruby, or Python, how do we make it easily downloadable and installable by general users like a Win32 app?

and is it possible to make it a Mac app easily too?

+1  A: 

I think your question should be, "How do I write PHP/Ruby/Python apps to be able to be easily downloaded and installed on Windows machines?".

If I write a PHP application to take advantage of a MySQL database I now have to take into consideration (when packaging the app) if the user will install and setup the database themselves or not. Maybe I will use the SQLite database instead to save the user from having to run a database themselves.

So I think the important thing here is not to understand how to package your app so users can download it easily. It's how to create the app to make it as portable as possible.

Peter D
In no way, shape, or form is Ruby a language "designed for the web". Rails != Ruby.
Pesto
I smell a ruby fan boy. I wonder what most people use Ruby for?
Peter D
And BTW voting my answer down due to your personal opinion is wrong.
Peter D
"Personal opinion"? It's fact; Ruby simply isn't a web language. Without Rails or another framework, it doesn't have the tools. That it has found popularity in a web context is very different from being designed for the web. Hey, Apache is written in C. C must be a web language, right?
Pesto
Ruby is a language. Ruby on Rails is its most common use. This fact does not in any way, shape, or form make Ruby a "language designed for the web."
belgariontheking
Peter D: Could I recommend you remove the first paragraph of your answer? Excluding it, you make a very good point - dependancies!
dbr
Ok ok, Fine, fine :P
Peter D
+1  A: 

At least with PHP and Python, I know there are GTK bindings (http://gtk.php.net/ , http://www.pygtk.org/) for Windows (http://www.gtk.org/download-windows.html). Packaging the application in an easily distributable package becomes a little tricky, but it can certainly be done. If you're talking about PHP in the Web App sense, typically, the user will have their environment setup, and all they need to do is unpackage the scripts.

There are other widget bindings for these languages, I'm just listing GTK as a fairly common binding.

Once you have the application setup correctly, it's a relatively simple matter of generating an installer for your application. There are various solutions for this, one of which is NSIS (http://nsis.sourceforge.net/Main_Page) which makes creating installers quite easy. It's scriptable, so there is lots of customization.

drowe
+9  A: 

Ruby

RubyScript2Exe

RubyScript2Exe transforms your Ruby application into a standalone, compressed Windows, Linux or Mac OS X (Darwin) executable.

There's also a decent blog post about it

Another possible option is the Shoes GUI framework, which can create Widows, Linux and OS X executables from your Shoes application.

Python

py2exe

py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.

py2exe is used by BitTorrent, SpamBayes, and thousands more

PHP

Bambalam PHP EXE Compiler/Embedder

Bambalam PHP EXE Compiler/Embedder is a free command line tool to convert PHP applications to standalone Windows .exe applications. The exe files produced are totally standalone, no need for php dlls etc.

and is it possible to make it a Mac app easily too?

Py2App

py2app is a Python setuptools command which will allow you to make standalone application bundles and plugins from Python scripts. py2app is similar in purpose and design to py2exe for Windows.

Also, there is a utility "Build Applet" included with the Developer Tools.. Drag-and-drop a Python script on to it and it becomes a .app. The utility is in /Developer/Applications/Utilities/MacPython 2.5/


Note, all of the above basically take your script, package it up along with a Python interpreter and any dependancies, and on launch run your script. If you use a GUI platform that does not work on Windows, running it through Py2EXE will not make it work!

Also as Peter D mentioned, you need to be careful about dependancies - if your application requires a MySQL database, your users will have to install that separately to use your application, and every library you use will add size to your executables.

dbr
One thing to note with RubyScript2exe is that it will still contain your source code (albeit compressed), which may not meet your needs.
Pesto
A: 

I'm not sure what you are asking, so I'll throw out some general ideas.

I'm a ruby programmer, and JRuby is a great way to run ruby cross platform. You can package it up the same way you package any java program and there are plenty of examples of java apps for windowxs.

You may also want to look into adobe AIR. "The Adobe® AIR™ runtime lets developers use proven web technologies to build rich Internet applications that run outside the browser on multiple operating systems."

jshen