1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

rake task for updating sinatra.gemspec files manifest

This commit is contained in:
Ryan Tomayko 2008-09-07 19:08:34 -07:00
parent 6bee4770f0
commit 8c412cf5bf
2 changed files with 23 additions and 1 deletions

View file

@ -52,6 +52,27 @@ file package('.tar.gz') => %w[dist/] + spec.files do |f|
sh "git archive --format=tar HEAD | gzip > #{f.name}" sh "git archive --format=tar HEAD | gzip > #{f.name}"
end 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 ========================================================= # Hanna RDoc =========================================================
# #
# Building docs requires the hanna gem: # Building docs requires the hanna gem:

View file

@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.authors = ["Blake Mizerany"] s.authors = ["Blake Mizerany"]
# git ls-files | grep -v '^\.' # = MANIFEST =
s.files = %w[ s.files = %w[
images/404.png images/404.png
images/500.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.builder
test/views/no_layout/no_layout.haml test/views/no_layout/no_layout.haml
] ]
# = MANIFEST =
s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/} s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}