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/}