From 59dae873e43b8f5f9be242f82d147f61759d9fe7 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 29 Apr 2014 20:39:20 +0200 Subject: [PATCH] Don't rely on Git for generating the MANIFEST. When using Git the resulting Gem will contain far too many useless files. For example, the profile/ and spec/ directories are not needed when building Gems. --- Rakefile | 16 +++++++++++----- task/manifest.rake | 5 ++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index 925b87b..0c48773 100644 --- a/Rakefile +++ b/Rakefile @@ -8,17 +8,23 @@ GEMSPEC = Gem::Specification.load('oga.gemspec') LEXER_OUTPUT = 'lib/oga/xml/lexer.rb' PARSER_OUTPUT = 'lib/oga/xml/parser.rb' -GENERATED_FILES = [ +CLEAN.include( 'coverage', 'yardoc', LEXER_OUTPUT, PARSER_OUTPUT, 'benchmark/fixtures/big.xml' -] +) -GENERATED_FILES.each do |file| - CLEAN << file if File.exist?(file) -end +FILE_LIST = FileList.new( + 'checkum/**/*.*', + 'doc/**/*.*', + 'lib/**/*.*', + 'LICENSE', + 'MANIFEST', + '*.gemspec', + 'README.md' +) Dir['./task/*.rake'].each do |task| import(task) diff --git a/task/manifest.rake b/task/manifest.rake index 146dc02..da68f93 100644 --- a/task/manifest.rake +++ b/task/manifest.rake @@ -1,8 +1,7 @@ desc 'Generates the MANIFEST file' task :manifest do - generated = GENERATED_FILES.map { |path| File.expand_path(path) } - files = (`git ls-files`.split("\n") | generated).sort - handle = File.open(File.expand_path('../../MANIFEST', __FILE__), 'w') + files = FILE_LIST.to_a.sort + handle = File.open(File.expand_path('../../MANIFEST', __FILE__), 'w') handle.write(files.join("\n")) handle.close