[Ruby] hoe and Manifest.txt

Aaron Patterson aaron_patterson at speakeasy.net
Sat Oct 28 12:25:20 PDT 2006


Hi,

I've started converting all of my projects to Hoe, but the Manifest.txt
file kind of bugs me.  I don't want to update it every time I add a file
to my package.  Does anyone see anything wrong with programmatically
determining which files should be released?

For example, when I create a new Hoe object I could do this:
  Hoe.new("blah", "1.0.0") do |p|
    ...
    p.files  = (Dir.glob("{bin,lib,doc}/**/*").delete_if {|item|
      item.include?(".svn") } << Dir.glob("*.txt")).flatten
    ...
  end

Then I don't need to remember to update Manifest.txt.  Below is my patch
that gives hoe this functionality.

Index: lib/hoe.rb
===================================================================
--- lib/hoe.rb	(revision 91)
+++ lib/hoe.rb	(working copy)
@@ -103,7 +103,7 @@
     (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
   FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
 
-  attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :rdoc_pattern, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version
+  attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :rdoc_pattern, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version, :files
 
   def initialize(name, version)
     self.name = name
@@ -176,7 +176,11 @@
         s.send "#{msg}=", val
       end
 
-      s.files = File.read("Manifest.txt").split
+      if files
+        s.files = files
+      else
+        s.files = File.read("Manifest.txt").split
+      end
       s.executables = s.files.grep(/bin/) { |f| File.basename(f) }
 
       s.bindir = "bin"

-- 
Aaron Patterson
http://tenderlovemaking.com/


More information about the Ruby mailing list