# Checking for other extensions and gems

**URL:** <https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580>\
**Category:** Radiant CMS\
**Created:** [October 29, 2007, 6:05am UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580 "2007-10-29T06:05:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [October 29, 2007, 6:05am UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580/1 "2007-10-29T06:05:26Z")

</div>

I’m writing an extension that depends on shards. I’d like to check for  
it and raise a useful error message when my extension is initialized.

Any suggestions as to the best way to do that?

-Chris

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [October 29, 2007, 6:11am UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580/2 "2007-10-29T06:11:17Z")

</div>

raise ‘blah requires the installation of the Shards extension’ unless  
defined?(ShardsExtension)

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [October 29, 2007, 2:33pm UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580/3 "2007-10-29T14:33:39Z")

</div>

Check for the existence of the Shards module:

raise “The Shards extension is required and must be loaded first!”  
unless defined?(Shards)

Sean

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [October 30, 2007, 10:29am UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580/4 "2007-10-30T10:29:39Z")

</div>

And be sure that your extension loads after shards…

```
/AITOR
```

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [October 30, 2007, 3:20pm UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580/5 "2007-10-30T15:20:33Z")

</div>

Aitor Garay-Romero wrote:

> ```
> And be sure that your extension loads after shards....
> 
> ```

What is the mechanism for forcing extension load order?

-Chris

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [October 30, 2007, 5:23pm UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580/6 "2007-10-30T17:23:54Z")

</div>

Also, in environment.rb, you can add this:

config.extensions = [:shards, :all]

That will load shards first, then any other extensions. The :all is a  
placeholder so you can load extensions at the end, too.

Sean

---

<div class="post-metadata">

**Author:** ![mahadewa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9e8a1a/32.png) [@mahadewa](https://www.ruby-forum.com/u/mahadewa)\
**Post date:** [October 30, 2007, 3:29pm UTC](https://www.ruby-forum.com/t/checking-for-other-extensions-and-gems/118580/7 "2007-10-30T15:29:26Z")

</div>

Search this list, it has been discussed in the past.

Fast solution: they load in “alphabetic order”, so “00\_extension”  
will  
load before “01\_extension”.

```
/AITOR
```
