Skip to content

Commit

Permalink
Improve how gemspec's files are defined
Browse files Browse the repository at this point in the history
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
    ```
  • Loading branch information
st0012 committed Nov 22, 2024
1 parent 9a7ab17 commit b83411c
Showing 1 changed file with 5 additions and 176 deletions.
181 changes: 5 additions & 176 deletions rdoc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
s.require_paths = ["lib"]
# for ruby core repository. It was generated by
# `git ls-files -z`.split("\x0").each {|f| puts " #{f.dump}," unless f.start_with?(*%W[test/ spec/ features/ .]) }
s.files = [
NONE_LIB_FILES = [
"CONTRIBUTING.rdoc",
"CVE-2013-0256.rdoc",
"ExampleMarkdown.md",
Expand All @@ -50,183 +50,12 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
"TODO.rdoc",
"exe/rdoc",
"exe/ri",
"lib/rdoc.rb",
"lib/rdoc/code_object/alias.rb",
"lib/rdoc/code_object/anon_class.rb",
"lib/rdoc/code_object/any_method.rb",
"lib/rdoc/code_object/attr.rb",
"lib/rdoc/code_object/class_module.rb",
"lib/rdoc/code_object.rb",
"lib/rdoc/code_objects.rb",
"lib/rdoc/comment.rb",
"lib/rdoc/code_object/constant.rb",
"lib/rdoc/code_object/context.rb",
"lib/rdoc/code_object/context/section.rb",
"lib/rdoc/cross_reference.rb",
"lib/rdoc/encoding.rb",
"lib/rdoc/erb_partial.rb",
"lib/rdoc/erbio.rb",
"lib/rdoc/code_object/extend.rb",
"lib/rdoc/generator.rb",
"lib/rdoc/generator/darkfish.rb",
"lib/rdoc/generator/json_index.rb",
"lib/rdoc/generator/markup.rb",
"lib/rdoc/generator/pot.rb",
"lib/rdoc/generator/pot/message_extractor.rb",
"lib/rdoc/generator/pot/po.rb",
"lib/rdoc/generator/pot/po_entry.rb",
"lib/rdoc/generator/ri.rb",
"lib/rdoc/generator/template/darkfish/.document",
"lib/rdoc/generator/template/darkfish/_footer.rhtml",
"lib/rdoc/generator/template/darkfish/_head.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml",
"lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml",
"lib/rdoc/generator/template/darkfish/class.rhtml",
"lib/rdoc/generator/template/darkfish/css/fonts.css",
"lib/rdoc/generator/template/darkfish/css/rdoc.css",
"lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf",
"lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf",
"lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf",
"lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf",
"lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf",
"lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf",
"lib/rdoc/generator/template/darkfish/images/add.png",
"lib/rdoc/generator/template/darkfish/images/arrow_up.png",
"lib/rdoc/generator/template/darkfish/images/brick.png",
"lib/rdoc/generator/template/darkfish/images/brick_link.png",
"lib/rdoc/generator/template/darkfish/images/bug.png",
"lib/rdoc/generator/template/darkfish/images/bullet_black.png",
"lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png",
"lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png",
"lib/rdoc/generator/template/darkfish/images/date.png",
"lib/rdoc/generator/template/darkfish/images/delete.png",
"lib/rdoc/generator/template/darkfish/images/find.png",
"lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif",
"lib/rdoc/generator/template/darkfish/images/macFFBgHack.png",
"lib/rdoc/generator/template/darkfish/images/package.png",
"lib/rdoc/generator/template/darkfish/images/page_green.png",
"lib/rdoc/generator/template/darkfish/images/page_white_text.png",
"lib/rdoc/generator/template/darkfish/images/page_white_width.png",
"lib/rdoc/generator/template/darkfish/images/plugin.png",
"lib/rdoc/generator/template/darkfish/images/ruby.png",
"lib/rdoc/generator/template/darkfish/images/tag_blue.png",
"lib/rdoc/generator/template/darkfish/images/tag_green.png",
"lib/rdoc/generator/template/darkfish/images/transparent.png",
"lib/rdoc/generator/template/darkfish/images/wrench.png",
"lib/rdoc/generator/template/darkfish/images/wrench_orange.png",
"lib/rdoc/generator/template/darkfish/images/zoom.png",
"lib/rdoc/generator/template/darkfish/index.rhtml",
"lib/rdoc/generator/template/darkfish/js/darkfish.js",
"lib/rdoc/generator/template/darkfish/js/search.js",
"lib/rdoc/generator/template/darkfish/page.rhtml",
"lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml",
"lib/rdoc/generator/template/darkfish/servlet_root.rhtml",
"lib/rdoc/generator/template/darkfish/table_of_contents.rhtml",
"lib/rdoc/generator/template/json_index/.document",
"lib/rdoc/generator/template/json_index/js/navigation.js",
"lib/rdoc/generator/template/json_index/js/searcher.js",
"lib/rdoc/code_object/ghost_method.rb",
"lib/rdoc/i18n.rb",
"lib/rdoc/i18n/locale.rb",
"lib/rdoc/i18n/text.rb",
"lib/rdoc/code_object/include.rb",
"lib/rdoc/known_classes.rb",
"lib/rdoc/markdown.kpeg",
"lib/rdoc/markdown/entities.rb",
"lib/rdoc/markdown/literals.kpeg",
"lib/rdoc/markup.rb",
"lib/rdoc/markup/attr_changer.rb",
"lib/rdoc/markup/attr_span.rb",
"lib/rdoc/markup/attribute_manager.rb",
"lib/rdoc/markup/attributes.rb",
"lib/rdoc/markup/blank_line.rb",
"lib/rdoc/markup/block_quote.rb",
"lib/rdoc/markup/document.rb",
"lib/rdoc/markup/formatter.rb",
"lib/rdoc/markup/hard_break.rb",
"lib/rdoc/markup/heading.rb",
"lib/rdoc/markup/include.rb",
"lib/rdoc/markup/indented_paragraph.rb",
"lib/rdoc/markup/list.rb",
"lib/rdoc/markup/list_item.rb",
"lib/rdoc/markup/paragraph.rb",
"lib/rdoc/markup/parser.rb",
"lib/rdoc/markup/pre_process.rb",
"lib/rdoc/markup/raw.rb",
"lib/rdoc/markup/regexp_handling.rb",
"lib/rdoc/markup/rule.rb",
"lib/rdoc/markup/table.rb",
"lib/rdoc/markup/to_ansi.rb",
"lib/rdoc/markup/to_bs.rb",
"lib/rdoc/markup/to_html.rb",
"lib/rdoc/markup/to_html_crossref.rb",
"lib/rdoc/markup/to_html_snippet.rb",
"lib/rdoc/markup/to_joined_paragraph.rb",
"lib/rdoc/markup/to_label.rb",
"lib/rdoc/markup/to_markdown.rb",
"lib/rdoc/markup/to_rdoc.rb",
"lib/rdoc/markup/to_table_of_contents.rb",
"lib/rdoc/markup/to_test.rb",
"lib/rdoc/markup/to_tt_only.rb",
"lib/rdoc/markup/verbatim.rb",
"lib/rdoc/code_object/meta_method.rb",
"lib/rdoc/code_object/method_attr.rb",
"lib/rdoc/code_object/mixin.rb",
"lib/rdoc/code_object/normal_class.rb",
"lib/rdoc/code_object/normal_module.rb",
"lib/rdoc/options.rb",
"lib/rdoc/parser.rb",
"lib/rdoc/parser/c.rb",
"lib/rdoc/parser/changelog.rb",
"lib/rdoc/parser/markdown.rb",
"lib/rdoc/parser/rd.rb",
"lib/rdoc/parser/ripper_state_lex.rb",
"lib/rdoc/parser/ruby.rb",
"lib/rdoc/parser/ruby_tools.rb",
"lib/rdoc/parser/simple.rb",
"lib/rdoc/parser/text.rb",
"lib/rdoc/rd.rb",
"lib/rdoc/rd/block_parser.ry",
"lib/rdoc/rd/inline.rb",
"lib/rdoc/rd/inline_parser.ry",
"lib/rdoc/rdoc.rb",
"lib/rdoc/code_object/require.rb",
"lib/rdoc/ri.rb",
"lib/rdoc/ri/driver.rb",
"lib/rdoc/ri/formatter.rb",
"lib/rdoc/ri/paths.rb",
"lib/rdoc/ri/store.rb",
"lib/rdoc/ri/task.rb",
"lib/rdoc/rubygems_hook.rb",
"lib/rdoc/servlet.rb",
"lib/rdoc/code_object/single_class.rb",
"lib/rdoc/stats.rb",
"lib/rdoc/stats/normal.rb",
"lib/rdoc/stats/quiet.rb",
"lib/rdoc/stats/verbose.rb",
"lib/rdoc/store.rb",
"lib/rdoc/task.rb",
"lib/rdoc/text.rb",
"lib/rdoc/token_stream.rb",
"lib/rdoc/tom_doc.rb",
"lib/rdoc/code_object/top_level.rb",
"lib/rdoc/version.rb",
"man/ri.1",
]
# files from .gitignore
s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" << "lib/rdoc/markdown/literals.rb"
TEMPLATE_FILES = Dir.glob("lib/rdoc/generator/template/**/*")
LIB_FILES = Dir.glob("lib/**/*.{rb,kpeg,ry}")

s.files = (NONE_LIB_FILES + TEMPLATE_FILES + LIB_FILES).uniq

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

0 comments on commit b83411c

Please sign in to comment.