# New gem to showcase JRuby

**URL:** <https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668>\
**Category:** JRuby\
**Created:** [August 3, 2010, 8:10pm UTC](https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668 "2010-08-03T20:10:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluetrust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Post date:** [August 3, 2010, 8:10pm UTC](https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668/1 "2010-08-03T20:10:18Z")

</div>

Hi all,

I just released a gem that provides a nice little example of how to  
take advantage of JRuby’s ability to use a Java library when it makes  
sense. It’s not exactly a masterpiece, but it does demonstrate some  
techniques that might be useful to other gem authors who are  
interested in taking advantage of the JRuby platform when building  
Ruby libraries around Java.

The gem is called yuicompressor. It’s a Ruby wrapper for Yahoo!'s  
JavaScript and CSS compression library. The RubyGems page is  
[yuicompressor | RubyGems.org | your community gem host](http://rubygems.org/gems/yuicompressor) and the source is on my GitHub  
account at [GitHub - mjackson/yuicompressor: A YUI JavaScript and CSS compressor wrapper for Ruby and JRuby](http://github.com/mjijackson/yuicompressor).

Any feedback would be greatly appreciated. It is my first attempt at  
working with JRuby, so you may find something that could be done  
better.

Enjoy,

Michael

–  
Michael J.

> **[WebMD - Better information. Better health.](http://mjijackson.com)**
>
> The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...

@mjijackson

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![bluetrust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Post date:** [August 3, 2010, 9:22pm UTC](https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668/2 "2010-08-03T21:22:21Z")

</div>

This would be really sweet as a rake task to add as part of creating a  
war  
file for deploying to an app server. We use YUI-compressor now in a  
Java  
only app and really love it. Another cool feature would be able to have  
a  
rails app automatically serve (and cache) the compressed Javascript and  
CSS  
in production, but just have the uncompressed served in Dev.

For anyone that uses something like JSMin, we found that YUI compressor  
consistently yields higher compression levels and is completely safe. I  
don’t think they’ve had to fix a bug in like 2 years.

Joe

---

<div class="post-metadata">

**Author:** ![bluetrust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Post date:** [August 3, 2010, 9:24pm UTC](https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668/3 "2010-08-03T21:24:42Z")

</div>

Awesome… already created a Cap task to compress for production.  
Saves me a step.

On Tue, Aug 3, 2010 at 3:21 PM, Joseph A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Joe
> 
> > interested in taking advantage of the JRuby platform when building
> > 
> > To unsubscribe from this list, please visit:
> > 
> > Â Â [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![bluetrust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Post date:** [August 4, 2010, 7:09am UTC](https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668/4 "2010-08-04T07:09:28Z")

</div>

One comment from me: don’t use autoload. It seems like it should work  
well, but ultimately it introduces a subtle thread-safety issue into  
your library.

The rest looks pretty good at a glance 🙂 A nice example of how easy  
it is to use Java libs from Ruby!

On Tue, Aug 3, 2010 at 1:09 PM, Michael J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> JavaScript and CSS compression library. The RubyGems page is

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![bluetrust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Post date:** [August 4, 2010, 2:02pm UTC](https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668/5 "2010-08-04T14:02:16Z")

</div>

Thanks for the feedback. I’d never heard of this thread safety issue  
before now. Care to elaborate?

–  
Michael J.

> **[WebMD - Better information. Better health.](https://mjijackson.com/)**
>
> The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...

@mjijackson

On Tue, Aug 3, 2010 at 11:08 PM, Charles Oliver N.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > I just released a gem that provides a nice little example of how to
> > 
> > [http://mjijackson.com](http://mjijackson.com)
> 
> * * *
> 
> To unsubscribe from this list, please visit:
> 
> [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![bluetrust](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Post date:** [August 4, 2010, 6:59pm UTC](https://www.ruby-forum.com/t/new-gem-to-showcase-jruby/192668/6 "2010-08-04T18:59:08Z")

</div>

This thread talks about it and also in the thread someone mentions the  
other big thread on it from ruby-core mailing list:

[http://www.ruby-forum.com/topic/172385](http://www.ruby-forum.com/topic/172385)

-Tom

On Wed, Aug 4, 2010 at 7:01 AM, Michael J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On Tue, Aug 3, 2010 at 11:08 PM, Charles Oliver N.
> 
> > > account at [GitHub - mjackson/yuicompressor: A YUI JavaScript and CSS compressor wrapper for Ruby and JRuby · GitHub](http://github.com/mjijackson/yuicompressor).  
> > > Michael J.
> 
> [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

–  
blog: [http://blog.enebo.com](http://blog.enebo.com) twitter: tom\_enebo  
mail: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```
