Forum: Ruby Problem with Rake's PackageTask

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-01-21 15:26
Hello!

I'm trying to add packaging to my rakefile. I copied the example code
from 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.
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo (Guest)
on 2006-01-22 11:08
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, 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
10d4acbfdaccb4eee687a428ca00a5d8?d=identicon&s=25 Jim Weirich (weirich)
on 2006-01-23 16:09
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, 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 Weirich
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo (Guest)
on 2006-01-24 20:15
> 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 Weirich

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
This topic is locked and can not be replied to.