Skip to content

Commit aff93fa

Browse files
committed
Improve how gemspec's files are defined
Currently, the gemspec's files are defined by hand, which is error-prone. For example: #1211 This commit uses `Dir.glob` where possible to reduce the risk of that happening again. - Additional files added with this approach: ``` # This should have been added by only captured by this commit lib/rdoc/parser/prism_ruby.rb # These are folders and can be included/ignored either way lib/rdoc/generator/template/darkfish lib/rdoc/generator/template/darkfish/css lib/rdoc/generator/template/darkfish/fonts lib/rdoc/generator/template/darkfish/images lib/rdoc/generator/template/darkfish/js lib/rdoc/generator/template/json_index lib/rdoc/generator/template/json_index/js ``` - Files that are ignored after this change: ``` # They make no difference on documentation generation # Probably can be removed lib/rdoc/generator/template/darkfish/.document lib/rdoc/generator/template/json_index/.document ```
1 parent 9a7ab17 commit aff93fa

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

rdoc.gemspec

+25-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,26 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
3737
s.require_paths = ["lib"]
3838
# for ruby core repository. It was generated by
3939
# `git ls-files -z`.split("\x0").each {|f| puts " #{f.dump}," unless f.start_with?(*%W[test/ spec/ features/ .]) }
40-
s.files = [
40+
NONE_LIB_FILES = [
41+
"CONTRIBUTING.rdoc",
42+
"CVE-2013-0256.rdoc",
43+
"ExampleMarkdown.md",
44+
"ExampleRDoc.rdoc",
45+
"History.rdoc",
46+
"LEGAL.rdoc",
47+
"LICENSE.rdoc",
48+
"README.rdoc",
49+
"RI.md",
50+
"TODO.rdoc",
51+
"exe/rdoc",
52+
"exe/ri",
53+
"man/ri.1",
54+
]
55+
TEMPLATE_FILES = Dir.glob("lib/rdoc/generator/template/**/*")
56+
LIB_FILES = Dir.glob("lib/**/*.{rb,kpeg,ry}")
57+
58+
s.files = (NONE_LIB_FILES + TEMPLATE_FILES + LIB_FILES).uniq
59+
old_files = [
4160
"CONTRIBUTING.rdoc",
4261
"CVE-2013-0256.rdoc",
4362
"ExampleMarkdown.md",
@@ -225,8 +244,11 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
225244
"lib/rdoc/version.rb",
226245
"man/ri.1",
227246
]
228-
# files from .gitignore
229-
s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" << "lib/rdoc/markdown/literals.rb"
247+
puts s.files.count
248+
puts "-------------------"
249+
puts s.files - old_files
250+
puts "-------------------"
251+
puts old_files - s.files
230252

231253
s.rdoc_options = ["--main", "README.rdoc"]
232254
s.extra_rdoc_files += s.files.grep(%r[\A[^\/]+\.(?:rdoc|md)\z])

0 commit comments

Comments
 (0)