# Gem "before" and "after" filters?

**URL:** <https://www.ruby-forum.com/t/gem-before-and-after-filters/72557>\
**Category:** Ruby\
**Created:** [October 18, 2006, 1:39am UTC](https://www.ruby-forum.com/t/gem-before-and-after-filters/72557 "2006-10-18T01:39:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/u/Pau_Garcia_i_Quiles)\
**Post date:** [October 18, 2006, 1:39am UTC](https://www.ruby-forum.com/t/gem-before-and-after-filters/72557/1 "2006-10-18T01:39:05Z")

</div>

Hello,

I am trying to build a gem and I need to do some pre-processing  
(creating a  
file) before I can create my rdoc’s and some cleaning (erasing that  
file)  
after I create it.

Running something before building the gem is easy (just specify it in  
the  
gemspec before the Gem::Specification.new), but how do I run something  
afterwards? (writing the code at the end or after the end of the  
Gem::Specification does not work, because that code is run before the  
gem is  
built)

Thank you.

---

<div class="post-metadata">

**Author:** ![Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@Pau\_Garcia\_i\_Quiles](https://www.ruby-forum.com/u/Pau_Garcia_i_Quiles)\
**Post date:** [October 18, 2006, 1:57am UTC](https://www.ruby-forum.com/t/gem-before-and-after-filters/72557/2 "2006-10-18T01:57:06Z")

</div>

On 10/17/06, Pau Garcia i Quiles [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am trying to build a gem and I need to do some pre-processing (creating a  
> file) before I can create my rdoc’s and some cleaning (erasing that file)  
> after I create it.
> 
> Running something before building the gem is easy (just specify it in the  
> gemspec before the Gem::Specification.new), but how do I run something  
> afterwards? (writing the code at the end or after the end of the  
> Gem::Specification does not work, because that code is run before the gem is  
> built)

Currently, RubyGems does not allow pre/post processing in the  
installation time (this is a security feature), which is when you need  
to have what you’re talking about to happen for local documentation.  
If you’re talking about official documentation, use Rake.

-austin
