Permalink
Browse files

rake task for updating sinatra.gemspec files manifest

  • Loading branch information...
1 parent 6bee477 commit 8c412cf5bf5c618265131a9d72dbc403c64fd59b @rtomayko rtomayko committed Sep 8, 2008
Showing with 23 additions and 1 deletion.
  1. +21 −0 Rakefile
  2. +2 −1 sinatra.gemspec
View
21 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:
View
3 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/}

0 comments on commit 8c412cf

Please sign in to comment.