firehoseio / firehose

Build realtime Ruby web applications. Created by the fine folks at Poll Everywhere.
http://firehose.io/
MIT License
727 stars 72 forks source link

Accessing the .js file #34

Closed jscott1989 closed 10 years ago

jscott1989 commented 10 years ago

I want Firehose to sit alongside the rest of my application (which is in Python).

My preferred use of it is for my python app to push updates to firehose, which pushes it to the browsers.

This seems like it would work except that I can't really figure out how to get the .js file needed. Is there a prebuilt version of it anywhere?

bradgessler commented 10 years ago

There's not, just the coffeescript files. Can you use bower from Python? Also, how do you plan to run the server? Separate Ruby process from Python?

jscott1989 commented 10 years ago

Yeah the plan is to run Firehose as a completely separate process.

I currently use bower for other requirements but wasn't able to find a bower firehose file (I found something called "FirehoseJS" and was disappointed :P).

Compiling firehose.js.coffee with the standard coffee-script compiler just gives me:

// Generated by CoffeeScript 1.6.3 (function(){}).call(this);

bradgessler commented 10 years ago

You need to compile the assets with sprockets.

bradgessler commented 10 years ago

I started writing a CLI that can compile on branch https://github.com/polleverywhere/firehose/tree/asset_compiler but stopped short of merging into because Sprockets insists on compiling fingerprinted assets.

You can run it by:

  1. Pull the asset_compiler branch from this repo.
  2. Run bundle && bundle exec bin/firehose assets

The JS file will be in something like firehose-17234ca175a66b84712bc34cae80f9aa.js.

Note that json2.js is included in this bundle. I probably need to make a compiler that excludes dependencies, but for now you can delete it from the JS file.

bradgessler commented 10 years ago

@jscott1989 I'm closing this issue. Please comment how this solution worked out.

jscott1989 commented 10 years ago

Hi, I'm sorry! I forgot to respond to this.

It worked perfectly. This should probably be written down somewhere more permanent as I can't imagine I'm the only one with this requirement.

Thanks for the help @bradgessler :)

bradgessler commented 10 years ago

Excellent! I'll merge this into master, clean it up, and document.