From 8c412cf5bf5c618265131a9d72dbc403c64fd59b Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Sun, 7 Sep 2008 19:08:34 -0700 Subject: [PATCH] rake task for updating sinatra.gemspec files manifest --- Rakefile | 21 +++++++++++++++++++++ sinatra.gemspec | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index f1ffc8ed..bf4785aa 100644 --- a/Rakefile +++ b/Rakefile @@ -52,6 +52,27 @@ file package('.tar.gz') => %w[dist/] + spec.files do |f| sh "git archive --format=tar HEAD | gzip > #{f.name}" end +# Gemspec Helpers ==================================================== + +file 'sinatra.gemspec' => FileList['{lib,test,images}/**','Rakefile'] do |f| + # read spec file and split out manifest section + spec = File.read(f.name) + parts = spec.split(" # = MANIFEST =\n") + fail 'bad spec' if parts.length != 3 + # determine file list from git ls-files + files = `git ls-files`. + split("\n"). + sort. + reject{ |file| file =~ /^\./ }. + map{ |file| " #{file}" }. + join("\n") + # piece file back together and write... + parts[1] = " s.files = %w[\n#{files}\n ]\n" + spec = parts.join(" # = MANIFEST =\n") + File.open(f.name, 'w') { |io| io.write(spec) } + puts "updated #{f.name}" +end + # Hanna RDoc ========================================================= # # Building docs requires the hanna gem: diff --git a/sinatra.gemspec b/sinatra.gemspec index 04699feb..cbd9c6ce 100644 --- a/sinatra.gemspec +++ b/sinatra.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.authors = ["Blake Mizerany"] - # git ls-files | grep -v '^\.' + # = MANIFEST = s.files = %w[ images/404.png images/500.png @@ -58,6 +58,7 @@ Gem::Specification.new do |s| test/views/no_layout/no_layout.builder test/views/no_layout/no_layout.haml ] + # = MANIFEST = s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}