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'
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)

View File

@ -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