Options for distribution of an offline Ruby on Rails application - ruby-on-rails

I am developing an application in using Ruby on Rails, mostly as an excuse to learn the language.
This is not intended to be a web-based application - and perhaps I have chosen the wrong language, but...
My understanding is, that in order to run an instance of this application on somebody else's computer, they would need to install ruby on rails, and a webserver (or webrick, perhaps), as well as my application code.
I am just curious if there are any other options for distributing my application as a standalone app, or perhaps just a simple way to package up a web browser and ROR together with my app for a simple, one-step install?

I have personally never needed to do this. But, I have ran across this tutorial http://www.erikveen.dds.nl/distributingrubyapplications/rails.html that I think will be helpful. The tutorial covers how to actually convert a rails app into a standalone exe file.

Note, Slingshot appears to be a dead project (see comments). I'll leave this answer here for historical purposes and the off-chance that it comes back
Joyent's Slingshot might be a good bet.
Joyent Slingshot allows developers to deploy Rails applications like a standard desktop application, which work online and offline (with synchronization), have drag and drop, and interact with all the other desktop applications.
With Joyent Slingshot:
Create a hybrid Web/desktop application
Synchronize online and offline data
Use the same code for online and offline application(s)
Deploy and update your application easily
Drag into and out of application
Here are some further links to help with your evaluation and/or to help you get started:
Introducing Joyent Slingshot
Basic application walkthrough
Slingshot wiki

The way most people ship ruby programs, including Rails webapps, as a standalone exe is via rubyscript2exe. They describe how to package a Rails application at http://www.erikveen.dds.nl/distributingrubyapplications/rails.html. Ruby, Rails, and all the associated libraries will be included in the EXE file.
As others mentioned, Ruby is not necessarily Rails and if you really want an easy way to write a distributable GUI application in Ruby, Shoes is an excellent place to start looking.

Gears on Rails maybe?

You could always consider compiling your Ruby to JVM byte-code (via JRuby) or .NET byte-code (via IronRuby) to distribute to people who have those virtual machines and don't want to install a Ruby runtime.
You might want to check out Shoes for building desktop applications in Ruby. Rails really is tuned for building websites.

You can include Ruby on Rails by freezing it to the version of Rails you want to use in your project. They call this Freezing. The user will not have to install Rails to use your application. You can do this with any library you use in your project. If the project uses a library, just place it under the Vendor folder in your project. Then use a tool similar to what #Josh answered with to package it.
You will need a web server to run the project though. There is no way around this. Ruby on Rails is just like ASP.NET in this regard, in that it is a server side framework. The server runs the code and outputs the HTML to the browser by using the Rails framework.
Unfortunately, you may have picked the wrong framework to do what you want. Instead of Ruby on Rails, you may want to check out Shoes, which is a framework for developing GUI applications using Ruby.

You do not specifically say whether it is supposed to be a GUI application or not. From the other answers, I would guess so.
Therefore, you need to clarify what your goals are. RoR is a specialized framework for web applications. If your goal is to learn RoR, I'd say to get yourself some inexpensive web hosting and make yourself an app. If your goal is to learn Ruby, not necessarily Rails, then Shoes, IronRuby, JRuby, MacRuby and others may be good options to look at.

Related

Ruby on rails making an app for smartphone

I want to build an app that use in the backend Ruby on Rails. However my problem comes in the lack of information i found on it. My goals is not just to create a website but an application that interacts with it, like my android facebook app when pressing menu I get button like logout and so on.
I am wondering if their exists tutorial on how to build an application but using rails or should i scrap my entire website and do it in php. I am looking for guide and tutorial. Thanks in advance
You can build an app on any platform and make it interact with your Rails-based server using HTTP requests (like AJAX).
You can send information back and forth using JSON or XML; you would probably need to make a new set of actions for the app to use.
There is no reason to use PHP. ever.
A little unclear from your original question, but if you are looking to create a mobile app using Ruby (and a structure similar to Ruby on Rails) then you may be interested in Rhomobile. It is a cross-platform mobile application framework that uses Ruby for its backend code, and follows a structure similar to (older) Ruby on Rails versions.
From what I understand of your problem, you want to use the robustness of Ruby to develop a native app (not just another app that mirrors a website).
The best thing I know of for this is RubyMotion. The bummer is the cost ($200). But then you would get to accomplish your task.

Rails Ruby Gems vs Pure Development When Generating A Rich Blog

Some ruby gems like jekyll, toto and webby offer out of the box blog-type integration into your ruby app. Another way of developing a rich web blog-type application is to build and model the application yourself using pure ruby and rails practices. (e.g creating an Article and User model). The first offers out of the box features the 2nd option offers more customization and control.
In people's experience on Stack Overflow, which would be the best route and what would people consider when making the decision to use a gem out of the box versus going alone?
All of the gems you mentioned take static, markdown/textile/etc files and turn them into HTML websites. They take different approaches to it, with jekyll spitting out the finished website for hosting, toto doing the converting and routing on request, and webby doing the same as jekyll mostly.
If you're using Rails, it's important to note that none of these will integrate into your application well. They're built to more-or-less operate on their own.
Generally speaking, if a gem has the functionality you need, use it. They are not equivalent to plugins you find for Wordpress and Drupal where they are typically low-quality, buggy, poorly documented, etc. More often than not, gems simply add a couple modules that you can integrate into your application how you like.
On the other hand, a basic blog is pretty quick and simple in Rails, especially considering you've got a handy walkthrough guide straight from the Rails documentation on how to do it.
If you're new to Rails and want tight integration with your app, it's probably best to bake your own blog features.
This will take some time to do, but its worth it to learn how things really work.
If you're more seasoned, just look at the gem's API and documentation and decide if it does what you want it to do and if you're comfortable with how to integrate it. If so, it'll save you time.
One other consideration: who will be using the blog? Is it for internal use, and programmers will be the ones updating it? If that's the case, then you can make it very easy by not worrying about a lot of aesthetic polish in the back-end. Conversely, if you're making an app that includes a blogging component for the general public you might want it to feel more polished. In this case a gem might save you a lot of time.
It depends on your application.

What exactly is Ruby on Rails?

I've looked up plenty of information on Rails, but I still can't say I'm quite sure of what it is. If I'm developing a web app, what functionality would I get that I couldn't from html/js/php? Would every project benefit from rails, or do you need a certain goal in mind?
Ruby on Rails is a web application framework. Technically there isn't anything that Rails can do that HTML/JS/PHP can do. The point of Rails it to make developing websites easier, faster, and hopefully more maintainable. If you are familiar with PHP, then Rails is somewhat equivalent to Symfony, Kohana or Yii.
I'd recommend trying out some of these tutorials if you haven't already.
Rails for Zombies - you won't even have to setup rails on your machine
Ruby on Rails tutorial book
Railscasts - for once you get more into it
Ruby on Rails is a web framework built for programmer productivity and happiness. It's built on top of the Ruby language which means you get access to all the cool libraries ("gems") other people have written such as file upload libraries and ones that interact with web services such as AWS.
You use HTML and JavaScript with it just like you would in every other web framework out there. The difference? It's not built on top of a hack of a language such as PHP. Good Ruby code is elegant and very readable, and you will find this out in your usage of the framework.
The Getting Started guide explains it very well: http://guides.rubyonrails.org/getting_started.html.
What it is is a framework. It's a set of APIs, a toolkit if you may, to build web applications.
Ruby is a programming language like Python, Perl, C, C++, Java, C#, PHP etc. It's closer to Perl and Python than to other due to its interpretive nature (a scripting language if you may).
RubyOnRails is a framework built on top of Ruby to build web apps. Arguably like Servlets is used to build web apps on Java or .Net is used on C#, or Django on Python or CakePHP on PHP etc. It's an amalgamation of APIs, code generation tools, testing code etc put together.
It's popular because of it's elegance, it's choice of following conventions over configuration (you write less config code or glue code). Once you get the hang of it, there is less ceremony involved before you get from idea in your head to working production application with RubyOnRails (popularly referred to as Rails).

When Rails require mod_rails, what about Django, TurboGears, Symfony, CakePHP? Can they deploy using mod_python and mod_php?

When Rails applications seem hard to deploy (or used to be), what about Django, TurboGears, Symfony, CakePHP -- can they be simply deployed using mod_python or mod_php? Actually, won't it need something like a mod_django so that the code can run in a "Django" environment? (Just like Rails' script/console or Rails 3's rails console)
Django applications can certainly be deployed with minimum fuss using mod_python.
That said, experienced people will tell you to use the more lightweight and efficient mod_wsgi instead of mod_python. This too can be done with minimum effort. I have done it on multiple occasions and app deployment was always the least of my worries.
Update
#Rebus has it right:
mod_python is not being actively developed anymore, use mod_wsgi
There are a number of ways to deploy a Django site. See the Django Docs or the Django book. As mentioned mod_python is dead and mod_wsgi is the recommended method. Another method which has been making more noise lately is gunicorn. You can see Eric Holscher's blog post about how easy the deployment can be with it.
For CakePHP if you have a standard PHP installation, you probably, at most, only need to load mod_rewrite. This module is often included in the build, though.

What is the limit of Sinatra?

I've been learning the Ruby web framework Sinatra lately, and I'm finding it great to use. Most of the articles and blogs I have read about it seem to assume that it is good only for small websites, or 'tiny' web-apps. Is this true? Can a complete web application be built in Sinatra, or is Ruby on Rails the way to go?
You could, in theory, build an entire web application using Sinatra, and it would offer you more precision control than Ruby on Rails would.
That said, it also removes all of the nice features ruby on rails gives you, such as the Model-View-Controller architecture.
If you're looking to build a web application with database interaction, I strongly advise you use Ruby on Rails.
If you're looking to build a very simple API or something that just takes some data and throws it up onto Twitter or something, go ahead and use Sinatra.
There is no reason that it couldn't be used to build an enterprise website. It's fast and intuitive. Two key things in building a larger web application. While it does lack many of the features of Rails, I am yet to run into a road block.
I personally like the slim nature of Sinatra. It embraces routing instead of making it a headache.
I usually find myself wrestling with Rails, whereas I configure Sinatra to my liking.
As for database interaction, mongo_mapper + Sinatra works very well.

Resources