From 8559a79837330201f5720a021877796803223028 Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Thu, 11 Mar 2010 03:11:28 -0800 Subject: [PATCH] clean up gemspec generation --- Rakefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index b5555c0..45c6d00 100644 --- a/Rakefile +++ b/Rakefile @@ -39,21 +39,18 @@ end # GEMSPEC =================================================================== file 'rocco.gemspec' => FileList['{lib,test,bin}/**','Rakefile'] do |f| - # read version from tilt.rb version = File.read('lib/rocco.rb')[/VERSION = '(.*)'/] && $1 - # read spec file and split out manifest section + date = Time.now.strftime("%Y-%m-%d") spec = File. read(f.name). sub(/s\.version\s*=\s*'.*'/, "s.version = '#{version}'") parts = spec.split(" # = MANIFEST =\n") - # 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") - spec.sub!(/s.date = '.*'/, "s.date = '#{Time.now.strftime("%Y-%m-%d")}'") + spec.sub!(/s.date = '.*'/, "s.date = '#{date}'") File.open(f.name, 'w') { |io| io.write(spec) } - puts "updated #{f.name}" + puts "#{f.name} #{version} (#{date})" end