Skip to content

Instantly share code, notes, and snippets.

@sanemat
Created April 17, 2012 23:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanemat/2409916 to your computer and use it in GitHub Desktop.
Save sanemat/2409916 to your computer and use it in GitHub Desktop.
Offline mobile app has great potential.
This is manuscript. Slide is below:
http://www.slideshare.net/sanemat/20120421igniteofflinemobileapphasgreatpotential-12593614
ignite style
--
I talk about gaps / craps between two rack applications.
Asset pipeline and rack-offline.
I don't solve this, yet.
So I bring my question this time.
If you know the de facto solution, or the alternative way, Please tell me.
Or let's hack together!
--
Please image a situation, you use mobile application.
Suddenly you get message:
"NETWORK ERROR! PLEASE TRY AGAIN LATER!"
You think:
My editing data is lost?
Usually this is saved on draft area, but sometimes you lost data.
--
Mobile app has many pros.
I don't mention those.
I talk about major these cons.
I want to use apps without taking care of network!
Some technologies solve this.
--
We met html5 cache manifest.
We declair cache manifest file.
Then web browser read this and store files which is not changed.
But if you list up those manually, you get tired of this.
--
We met rack-offline.
Details you can reffer is on railscast episodes at 247 and 248.
In summary, you make simple CRUD application with jQuery.
The application becomes offline one with rack-offline and jquery-offline.
--
This is rack-offline.
This creates cache manifest file automaticaly.
This gathers static contents from public directory.
rack-offline detects file modification, then this refleshes manifest's hash.
In development environment, this hash changes when you reload every time.
--
This is jquery-offline.
You create app with jQuery.getJSON.
Then you change getJSON method to jQuery.retrieveJSON.
This uses local storage.
--
This stores serialized sending data to local storage.
If server is down, but this app acts as nothing error.
Mergeing remote data and local one.
Send items background when network recover.
--
I meet after rails3.1 and Asset Pipeline
You write application.js by this comment like syntax.
//= require jquery
//= require jquery_ujs
//= require_tree .
This is sprockets manifest.
--
I listed here are good parts.
Then I fall gaps between rack-offline and asset pipeline!
Keyword is sprockets.
I don't understand enough about sprockets yet.
--
This is rails console.
asset pipeline bases on sprockets.
sprockets resolves file path and gathers and merges.
For example, app/assets, lib/assets, vendor/assets, and include rubygems path.
Very exciting.
--
html5 cache manifest requires all files, if you want to cache.
rack-offline seek and write hash under public directory.
Except sprockets, rack-offline doesn't know what files exist.
--
About pre-process engine.
Tilt pre-process through evaluating files.
For example, js.erb, html.haml.
Then, How to detect "modify"?
--
This is my temporary solution.
I gather files only assets directory only application root.
I can't detect other file modification.
In production environment, rails compiles each javascript to application.js.
So it's ok. ok? I don't think so.
--
I posted this question to rubyonrails-talk.
But I have no response ;)
Do I post this to stackoverflow?
Where is better?
--
This slide is out of date!
I found keyword "sprockets".
I'll read rack-offline and sprockets' test code and implimentation code.
I think this is the shortest way.
I feel this a bit hard. Not too hard.
--
About the alternative way.
Is this grunt or watchr or guard's solution area?
Or essentially offline app is client side solution?
Except for cache manifest.
But asset pipeline is rails area, I think.
--
Making mobile application is fun!
This is exciting area!
I love this.
Mobile "Offline" application is more confortable, convinient.
This is potential.
--
Let's see on a giant's shoulder!
Reinventing the wheel is no worth.
So please tell me this solution, or the alternative way.
And we enjoy happy life!
Let's ride on!
--
But if still gap exists, then let's cover!
Are you interested in offline application?
Let's talk with me and hack together!
@sanemat
----
はじめの15-30秒で
このLTが呼びかけと質問であること 誰か教えてよ!であること
asset-pipelineとrack-offlineのconflict
言及したい
@ha1t
Copy link

ha1t commented Apr 18, 2012

ちょうどhtml5 cache manifestについて興味を持っていたので勉強になります。

  • 48: rack-offline detects file modification, then this refleshs manifest's hash.

refleshs -> refreshesでしょうか?

@sanemat
Copy link
Author

sanemat commented Apr 18, 2012

@ha1t
直しました! ありがとうございます!
https://gist.github.com/2409916/a4af0e0c6065bd103e6dc55e8fd8d2b6f077d7fc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment