# Call a task of a namespace from an other task

**URL:** <https://www.ruby-forum.com/t/call-a-task-of-a-namespace-from-an-other-task/106854>\
**Category:** Ruby\
**Created:** [June 14, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/call-a-task-of-a-namespace-from-an-other-task/106854 "2007-06-14T18:07:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![StSSSSphane\_Wirtel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9fc348/32.png) [@StSSSSphane\_Wirtel](https://www.ruby-forum.com/u/StSSSSphane_Wirtel)\
**Post date:** [June 14, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/call-a-task-of-a-namespace-from-an-other-task/106854/1 "2007-06-14T18:07:23Z")

</div>

Hi all,

I try to call a task of a namespace from an other task !

Exemple:

ReleaseDirectory = File.join( “d:”, “release” )

namespace :release do  
task :create do  
mkdir\_p ReleaseDirectory, QUIET  
end  
end

namespace :kernel do  
task :compile do  
end

```
task :release => [????] do
end

```

end

“???” What can I put ? I would like to use the task “:create” of the  
namespace “:release”. Is there a way to resolve my problem ?

Thanks

Stephane W.

---

<div class="post-metadata">

**Author:** ![StSSSSphane\_Wirtel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9fc348/32.png) [@StSSSSphane\_Wirtel](https://www.ruby-forum.com/u/StSSSSphane_Wirtel)\
**Post date:** [June 14, 2007, 6:17pm UTC](https://www.ruby-forum.com/t/call-a-task-of-a-namespace-from-an-other-task/106854/2 "2007-06-14T18:17:30Z")

</div>

Ok, I found a solution but I don’t know if it’s a good solution.

I put the namespace :release in a variable.

Example:

releaseNs = namespace :release do  
task :create do  
mkdir\_p ReleaseDirectory  
end  
end

namespace :kernel do  
task :compile do  
end

```
task :release => [releaseNs[:create] ] do
end

```

end

What do you think of this solution ?

---

<div class="post-metadata">

**Author:** ![StSSSSphane\_Wirtel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9fc348/32.png) [@StSSSSphane\_Wirtel](https://www.ruby-forum.com/u/StSSSSphane_Wirtel)\
**Post date:** [June 14, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/call-a-task-of-a-namespace-from-an-other-task/106854/3 "2007-06-14T20:11:27Z")

</div>

On 6/14/07, Stéphane Wirtel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all,
> 
> I try to call a task of a namespace from an other task !

Well, you’re not strictly “calling” the task. You’re making it a  
dependency.

> namespace “:release”. Is there a way to resolve my problem ?  
> task :release =\> ‘release:create’ do

---

<div class="post-metadata">

**Author:** ![StSSSSphane\_Wirtel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9fc348/32.png) [@StSSSSphane\_Wirtel](https://www.ruby-forum.com/u/StSSSSphane_Wirtel)\
**Post date:** [June 15, 2007, 8:56am UTC](https://www.ruby-forum.com/t/call-a-task-of-a-namespace-from-an-other-task/106854/4 "2007-06-15T08:56:44Z")

</div>

Bob S. a écrit :

> On 6/14/07, Stéphane Wirtel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Hi all,
> > 
> > I try to call a task of a namespace from an other task !
> 
> Well, you’re not strictly “calling” the task. You’re making it a dependency  
> yes, sorry.

a dependency.

Do you think that my previous mail is a good solution ?
