When using the GemPackageTask, one has to build the GemSpec in order
to define the task. For a large project and/or slow machine this
actualy can take a second or so. So everytime I run “rake -T” there’s
a very noticable delay (not to mention wasted CPU cycles). Not sure
what other solutions there might be, but one is to have GemPackageTask
accept the parameters that will build the GemSpec when needed, but not
before. So, instead of
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "Ruby based make-like utility."
s.name = 'rake'
s.files = FileList.new('**/*').to_a
...
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
It could be:
Rake::GemPackageTask.new do |pkg|
pkg.platform = 'ruby'
pkg.summary = "Ruby based make-like utility."
pkg.name = 'rake'
pkg.files.include '**/*'
pkg.need_zip = true
pkg.need_tar = true
end
Note the difference in ‘platform’ and more importantly ‘files’. The
GemPackageTask would work those out and build the GemSpec at runtime
rather then definition time.
When using the GemPackageTask, one has to build the GemSpec in order
to define the task. For a large project and/or slow machine this
actualy can take a second or so.
spec = Gem::Specification.new do |s|
s.files = FileList.new('**/*').to_a
How many files do you have?
I solve this by using a Manifest.txt, that way I know exactly what I
want is included, and nothing I don’t:
s.files = File.read(‘Manifest.txt’).split
Plus the check_manifest task from Hoe to make sure everything is up-
to-date.
Plus the check_manifest task from Hoe to make sure everything is up-
to-date.
What does Hoe do to check the manifest?
The check_manifest task diffs what is on disk against the manifest
and reports the differences, so really Hoe doesn’t check the
manifest, humans do. That is what manifests are for.
I solve this by using a Manifest.txt, that way I know exactly what I
want is included, and nothing I don’t:
It’s not an issue of knowing what is included. It is a matter of
efficency.
Its both. Since I have to verify what I’ve added to the Manifest.txt
and check it in, files won’t mysteriously appear in my releases that
shouldn’t have been there.
s.files = File.read(‘Manifest.txt’).split
Plus the check_manifest task from Hoe to make sure everything is up-
to-date.
What does Hoe do to check the manifest?
A Find.find followed by a diff. If you like the changes, you can
pipe it to patch.
That is obvious. But not the point. Rake doesn’t need to scan these
files every time rake is run, only when the package task is run --and
that’s what I’m suggesting as an improvement to the task. Clearly the
noticablity of this delay and CPU cycle waste is not largely
discernable to those with small projects and/or faster computers, but
why would that disclude an improvement to Rake’s GempackageTask? That
seems to be what you are suggesting.
s.files = File.read(‘Manifest.txt’).split
Plus the check_manifest task from Hoe to make sure everything is up-
to-date.
What does Hoe do to check the manifest?
A Find.find followed by a diff. If you like the changes, you can
pipe it to patch.
The real problem is that GemPackageTask uses the FileList to create a
list of dependencies which is done prior to parsing and running a task
(line 82):
So your spec.files is read every time rake is ran.
This also has a side effect that you can not have your :package task
dependent upon any tasks that are responsible for creating files in the
gem_spec.files array, because the files array is read before any other
tasks are ran.
When using the GemPackageTask, one has to build the GemSpec in order
to define the task. For a large project and/or slow machine this
actualy can take a second or so.
spec = Gem::Specification.new do |s|
s.files = FileList.new('**/*').to_a
How many files do you have?
1,530
I solve this by using a Manifest.txt, that way I know exactly what I
want is included, and nothing I don’t:
It’s not an issue of knowing what is included. It is a matter of
efficency.
s.files = File.read(‘Manifest.txt’).split
Plus the check_manifest task from Hoe to make sure everything is up-
to-date.
What does Hoe do to check the manifest?
Thanks,
T.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.