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.
This commit is contained in:
Yorick Peterse 2014-04-29 20:39:20 +02:00
parent 579c0499ed
commit 59dae873e4
2 changed files with 13 additions and 8 deletions

View File

@ -8,17 +8,23 @@ GEMSPEC = Gem::Specification.load('oga.gemspec')
LEXER_OUTPUT = 'lib/oga/xml/lexer.rb' LEXER_OUTPUT = 'lib/oga/xml/lexer.rb'
PARSER_OUTPUT = 'lib/oga/xml/parser.rb' PARSER_OUTPUT = 'lib/oga/xml/parser.rb'
GENERATED_FILES = [ CLEAN.include(
'coverage', 'coverage',
'yardoc', 'yardoc',
LEXER_OUTPUT, LEXER_OUTPUT,
PARSER_OUTPUT, PARSER_OUTPUT,
'benchmark/fixtures/big.xml' 'benchmark/fixtures/big.xml'
] )
GENERATED_FILES.each do |file| FILE_LIST = FileList.new(
CLEAN << file if File.exist?(file) 'checkum/**/*.*',
end 'doc/**/*.*',
'lib/**/*.*',
'LICENSE',
'MANIFEST',
'*.gemspec',
'README.md'
)
Dir['./task/*.rake'].each do |task| Dir['./task/*.rake'].each do |task|
import(task) import(task)

View File

@ -1,7 +1,6 @@
desc 'Generates the MANIFEST file' desc 'Generates the MANIFEST file'
task :manifest do task :manifest do
generated = GENERATED_FILES.map { |path| File.expand_path(path) } files = FILE_LIST.to_a.sort
files = (`git ls-files`.split("\n") | generated).sort
handle = File.open(File.expand_path('../../MANIFEST', __FILE__), 'w') handle = File.open(File.expand_path('../../MANIFEST', __FILE__), 'w')
handle.write(files.join("\n")) handle.write(files.join("\n"))