# Problem with Rake's PackageTask

**URL:** <https://www.ruby-forum.com/t/problem-with-rakes-packagetask/63714>\
**Category:** Ruby\
**Created:** [January 21, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/problem-with-rakes-packagetask/63714 "2006-01-21T15:26:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [January 21, 2006, 3:26pm UTC](https://www.ruby-forum.com/t/problem-with-rakes-packagetask/63714/1 "2006-01-21T15:26:36Z")

</div>

Hello!

I’m trying to add packaging to my rakefile. I copied the example code  
from [http://rake.rubyforge.org/classes/Rake/PackageTask.html](http://rake.rubyforge.org/classes/Rake/PackageTask.html), that’s it:

require ‘rake/packagetask’

Rake::PackageTask.new(“rake”, “1.2.3”) do |p|  
p.need\_tar = true  
p.package\_files.include(“lib/\*\*/\*.rb”)  
end

but when I run rake --tasks, there are still no tasks related to  
packaging. I googled for a while and I can’t solve this puzzle. Please  
help.

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [January 22, 2006, 11:08am UTC](https://www.ruby-forum.com/t/problem-with-rakes-packagetask/63714/2 "2006-01-22T11:08:18Z")

</div>

Leo – wrote:

> Hello!
> 
> I’m trying to add packaging to my rakefile. I copied the example code  
> from [http://rake.rubyforge.org/classes/Rake/PackageTask.html](http://rake.rubyforge.org/classes/Rake/PackageTask.html), that’s it:
> 
> require ‘rake/packagetask’
> 
> Rake::PackageTask.new(“rake”, “1.2.3”) do |p|  
> p.need\_tar = true  
> p.package\_files.include(“lib/\*\*/\*.rb”)  
> end
> 
> but when I run rake --tasks, there are still no tasks related to  
> packaging. I googled for a while and I can’t solve this puzzle. Please  
> help.

The correct link is  
[http://rake.rubyforge.org/classes/Rake/PackageTask.html](http://rake.rubyforge.org/classes/Rake/PackageTask.html)

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [January 23, 2006, 4:09pm UTC](https://www.ruby-forum.com/t/problem-with-rakes-packagetask/63714/3 "2006-01-23T16:09:40Z")

</div>

Leo – wrote:

> Hello!
> 
> I’m trying to add packaging to my rakefile. I copied the example code  
> from [http://rake.rubyforge.org/classes/Rake/PackageTask.html](http://rake.rubyforge.org/classes/Rake/PackageTask.html), that’s it:
> 
> require ‘rake/packagetask’
> 
> Rake::PackageTask.new(“rake”, “1.2.3”) do |p|  
> p.need\_tar = true  
> p.package\_files.include(“lib/\*\*/\*.rb”)  
> end
> 
> but when I run rake --tasks, there are still no tasks related to  
> packaging. I googled for a while and I can’t solve this puzzle. Please  
> help.

With your rake file, I get:

$ rake --tasks  
(in C:/Documents and Settings/BA2828/My Documents/pgm/ruby/pkgtask)  
rake clobber\_package # Remove package products  
rake package # Build all the packages  
rake repackage # Force a rebuild of the package files

–  
– Jim W.

---

<div class="post-metadata">

**Author:** ![leopardus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f9ae1b/32.png) [@leopardus](https://www.ruby-forum.com/u/leopardus)\
**Post date:** [January 24, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/problem-with-rakes-packagetask/63714/4 "2006-01-24T20:15:06Z")

</div>

> With your rake file, I get:
> 
> $ rake --tasks  
> (in C:/Documents and Settings/BA2828/My Documents/pgm/ruby/pkgtask)  
> rake clobber\_package # Remove package products  
> rake package # Build all the packages  
> rake repackage # Force a rebuild of the package files
> 
> –  
> – Jim W.

Thanks for the inspiration! I double checked my code and found my silly  
silly mistake. I put package tasks inside another (empty) task. Shame on  
me!

desc ‘Build entire site’  
task :build =\> [:copy\_images, :copy\_stylesheets, :generate\_html] do

# Package tasks

Rake::PackageTask.new(“webdesign”, “0.1”) do |p|  
p.need\_zip = true  
p.package\_files.include(‘conf’)  
end

end

Now I feel like many different kind of idiots 🙂

## Problem solved.

Leo
