Rails 3 / PhoneGap: Converting a Rails app into an Phonegap iOS app? - ruby-on-rails

I have a site built on top of Rails. In essence, I want to release a lightweight version of it for the appstore, and I think Phonegap is a good solution w/o writing a full iOS application.
What would be the easiest way to get something like this out of the door? I'm new to PhoneGap and would love if an experience dev could shed some light on how with is done. I feel it would also be a valuable resource for many other Rails devs.
My rails 3 app uses devise for authenication, carrierwave for file processing, amazon S3 for storage, and Heroku for hosting. Can someone give me some basic insight into how all these components are wrapped up and ablwe to be used with PhoneGap?

I'm new to Phonegap too, but I'm exploring the same idea than you and I've found this useful screencast: "PhoneGap + Rails 3 API"
http://vimeo.com/18763953
The idea is that you make an HTML5 client side app that makes calls to a Rails API on the server side.
Here is the code of the screencast demo:
https://github.com/quickleft/kbomb_phonegap_server (Rails API)
https://github.com/quickleft/kbomb_phonegap_client (HTML5 client with
Phonegap).
Hope it helps!

I think it could be relevant to check my phonegap-rails gem gem and my example rails / ember.js App that is exported with Phonegap. It also implements token authentication based on ember-auth and several OAuth strategies on top of Devise.
Currently in de the devel branch: https://github.com/joscas/base_app/tree/devel
Heroku deploy: https://starter-app-staging.herokuapp.com (the desktop version)
The gem exports assets, fixes paths etc. to allow seamless export of single page apps based on a rails backend.

At 37 Signals they rendered their html SERVER SIDE and just created an app wrapper. Here's the article: https://signalvnoise.com/posts/3743-hybrid-sweet-spot-native-navigation-web-content
This is an important difference in most approaches as most will re-develop their front end using a client side framework and it has the potential to save users a bunch of time. The downside is that I've heard rumors you can't get into the iOS app store, but it doesn't seem like they had a problem with it. There's also services like GoNative.io that will wrap your app for you.

A video and code that does something similar to Javi's answer can be found at
Using Phonegap as a native container for a Rails 3 App

Related

How to integrate a Rails application with Angular2 in a single application?

I know there are easy ways to get AngularJS working as the front end of a Ruby on Rails application such as the angularjs-rails gem, but I haven't been able to do the same thing with Angular 2. I know I could just make 2 different applications and just have them work together, but I'd rather have them in 1 app so I can just start the one app and it'll all run and do all the testing in one app at one time.
As no "rails-angular2" gem has been released yet, you can do the integration by yourself following this link: http://programming.sereale.fr/20...
It is an example of integration without npm, but if you want to use npm you may still find a few interesting clues.

Is it possible to use piwik with Rails 4.2 and postgres

I am looking for an open source web analytic for my Rails 4.2 app, so after some research I found that piwik fit my needs. can I use "piwik" with postgresql ? it seems that they only support mysql but I am not sure if it still true at this moment!
also I've found a post about how to integrate it within Rails here but they use piwik_analytics which is a Gem for Ruby on Rails 3.x and may not work with 4.2 !
All the information I've found are a little outdated and I am not sure if there is a way to make it work with my current requirements. any help please ?
Piwik supports only MySQL, that's true
You don't need any gem because Piwik just needs to load some Javascript that needs to be embedded into your layout/views. The Rails app doesn't directly interact with it, only your visitors' browser. Which also means that it shouldn't matter whether it supports Postgres because it will most likely run on another machine as your Rails app.
Edit:
Regarding the gem you mentioned: I looked at it, too, when adding Piwik analytics to my app, but in the end went with writing the few required lines of JS myself.

Rails SCORM LMS

Are there any LMS (hosting SCORM) Rails gems or apps written in Ruby on Rails?
I would be using Articulate to create the SCORM.
Thanks!
There's Canvas LMS. It appears to be under very active development, with the most recent update to master happening yesterday:
https://github.com/instructure/canvas-lms/wiki
http://guides.instructure.com/m/4214/l/41907
I don't have any personal experience with it so I can't comment on its quality.
You can use SCORMCloud to serve the SCORM content from Rails.
There's a github repo that implements some of the API:
https://github.com/aeseducation/scorm-cloud
Just be careful of running rake test there..... it tries to delete all of your courses (not good if its pointed at a prod environment).
My company builds integs for SCORMCloud, our Bright service uses a rails back end a fork of the AES lib (we are planning on recommitting this back onto github soon).
Another option worth exploring will be Fedena. More information about it can be found at http://www.projectfedena.org/ or https://github.com/projectfedena/fedena. I am not sure how it stacks up agains Canvas LMS. But I would love to know about it if someone over here can share.
tags - ror scorm lms

PhoneGap and rails 3: How to interact with a rails 3 app

totally PhoneGap newbie here, but looking to learn the basics of how to interact with a Rails 3 web app using Phonegap.
I'm looking to release a lightweight version of my Rails 3 web app as an iOS app in the appstore. I understand how PhoneGap uses CSS/HTML/JS to work but how do I tie in my Rails 3 app functionality/ruby code. Thanks a lot for any insights.
Your production rails app will live at some domain. Specify a manifest of css, js and templates to be cached locally and distributed with your app. Point your XHRs at your production rails app to fetch data and render everything locally with something like mustache.
A client-side MVC framework like Backbone is useful in this situation.
Read PhoneGap's Get Started Guide.
I'm currently working on a phonegap app integrating with .net. I do all of my interaction with my .net webservice by using xui's xhr call that return/submit either json or xml data.
Refer to the following link to read more on xui and xhr http://xuijs.com/docs/xhr

Distributing Rails Applications as Native Applications

I would like to distribute a rails application as a double clickable application. When someone double clicks on the app, I think that mongrel should be started and then the user's browser should be started and open to something like localhost:3000 I'm trying to work through what I will need to do this, I think I'm going to need to include a copy of rails in the project, and a copy of the gems. Do I need to distribute ruby? Initially I'm looking to target the mac and linux for distribution. Does anyone have any experience packaging rails application like this?
The Application I'd like deploy is a media center server for a user's media. Unfortunately this means I can't have a public server serving out the media. I've built up the server using ruby on rails and rake tasks to import and manage the media. Is there a good way to make this easy for users to install? The idea was with a double clickable application it would be easy for users to bring up and down the server.
I've decided to use jruby and look into packaging the application as a java app.
The ill-fated Joyent Slingshot did exactly that, it allowed you to embed your Rails application as a standalone executable under Windows and Mac. It even provided a simple but straightforward method to allow data synchronization with an online version. Alas, it hasn't seen any activity in a long time.
https://dev.joyent.com/projects/slingshot/wiki/Slingshot
Spiceworks is a desktop-deployed Rails app, or at least it was a couple of years ago. It's a free (ad-supported) download.
Appcelerator Titanium natively supports building client-based/desktop applications using Ruby.
Hey, take a look at shopify and their theme designer app. http://vision.shopify.com/
Is pretty much exactly what your talking about. All they have done is written a stub for both platforms that launches the rails project. You can take a look at the code that checks for the rails project browsing through the vision app package contents.
I agree with the previous posters regarding desktop apps but I find myself writing web apps for the desktop (mostly widgets using Fluid) so I understand the issue. Has anyone had a look at Titanium Desktop from Appcelerator (http://www.appcelerator.com/)? I tried it initially and there was a little fiddling required, but the end result was more or less a desktop app.
If you want to write desktop apps, write desktop apps, if you want to write web apps, write web apps.
In the future, I think MacRuby will provide an excellent way to run web-apps on the desktop (well I mean OS X desktop) - you could in theory, spin up a Rails app and then have a WebView point to the Rails app. Currently, they're still focusing on making MacRuby a first-class citizen of the OS X ecosystem but Rails support is on the roadmap.
MacRuby is also exciting because of the work on the AOT compiler, with which you can compile Ruby code to machine code.

Resources