Mounting a Rack App

64 views
Skip to first unread message

Prateek Dayal

unread,
May 13, 2011, 3:07:19 AM5/13/11
to Jasmine
I am wondering if there is an official way to mount a rack app in
jasmine. I have hacked together something to mount Jammit as a rack
app using the code at https://github.com/railsjedi/jammit/tree/rack_middleware

I have added the code to mount the Jammit Middleware in self.app
method of lib/jasmine/server.rb. However, I had to do a couple of
other hacks to make Jasmine include js files that are not actually
present in the src_dir (the jammit js file is compiled and served on
the fly).

I am wondering if there is a cleaner way of doing all this. I would be
happy to work on an official way to mount rack apps with some help
from the group. Do you think this is a useful feature in the first
place?

Thanks,
Prateek
http://supportbee.com

Rajan Agaskar

unread,
May 19, 2011, 9:00:52 AM5/19/11
to jasmi...@googlegroups.com
I don't fully understand what this would let you do -- this lets you run jasmine tests directly against your jammit-compiled assets?

As far as permitting users to add arbitrary rack apps/paths, absolutely, this is something I would like to see -- I think people would find this very useful.

Do you have a fork with your changes to the jasmine-gem? I've been looking for examples of how people are extending jasmine as we think about how to offer a plugin architecture for extending jasmine.

Thanks!

Rajan


--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To post to this group, send email to jasmi...@googlegroups.com.
To unsubscribe from this group, send email to jasmine-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jasmine-js?hl=en.


Prateek Dayal

unread,
Jun 2, 2011, 5:19:38 AM6/2/11
to jasmi...@googlegroups.com
Hi Rajan,

I am really sorry for the late reply.

On Thu, May 19, 2011 at 6:30 PM, Rajan Agaskar <ra...@pivotallabs.com> wrote:
> I don't fully understand what this would let you do -- this lets you run
> jasmine tests directly against your jammit-compiled assets?

Yes

>
> As far as permitting users to add arbitrary rack apps/paths, absolutely,
> this is something I would like to see -- I think people would find this very
> useful.
>
> Do you have a fork with your changes to the jasmine-gem? I've been looking
> for examples of how people are extending jasmine as we think about how to
> offer a plugin architecture for extending jasmine.

Here it is

https://github.com/prateekdayal/jasmine-gem/commit/05f4f877ddc5b4e20eac126ab41570782b91567c

As you can see, I have made two changes. I added a lib_files function
to include js files that are passed in lib_files directive in
configuration. These files are included even if they are not present
on the disk (unlike src_files)

Also, I mount the rack middleware for Jammit in server.rb. I am using
the middleware from
https://github.com/railsjedi/jammit/tree/rack_middleware

Hope this explains what i am trying to achieve

Prateek

--
Prateek Dayal
Founder & CEO SupportBee
www.supportbee.com

Rajan Agaskar

unread,
Jun 3, 2011, 7:39:14 AM6/3/11
to jasmi...@googlegroups.com
Cool. It's unlikely we will pull this into the current version of jasmine, but I think we're close to releasing an edge jasmine that should make this kind of thing easier to do. Thanks for including a link to your fork -- this helps a lot. I think having jammit support is a great idea, I just want to be cautious about adding it to make sure it doesn't break anyone. 
Reply all
Reply to author
Forward
0 new messages