Hi,

Sub-clasing is interesting idea. But that would mean we needed to provide our own generator.


I am working on a kind of a prototype on this.

Sources with specfile are available here: https://fedorapeople.org/cgit/jackorp/public_git/fedora_darkfish.git/ I also created copr repo that contains the newest build: https://copr.fedorainfracloud.org/coprs/jackorp/fedora_darkfish/packages/

I have been successful with hijacking Rubygems documentation generation via the plugin installed from the copr:

```
[root@33809b4da933 result]# gem install -V --force --document=ri,rdoc c
HEAD https://index.rubygems.org/
200 OK
GET https://index.rubygems.org/info/c
200 OK
GET https://index.rubygems.org/quick/Marshal.4.8/c-0.0.3.gemspec.rz
200 OK
Downloading gem c-0.0.3.gem
GET https://index.rubygems.org/gems/c-0.0.3.gem
Fetching c-0.0.3.gem
200 OK
This is pre_install
/usr/local/share/gems/gems/c-0.0.3/.gitignore
/usr/local/share/gems/gems/c-0.0.3/Gemfile
/usr/local/share/gems/gems/c-0.0.3/LICENSE
/usr/local/share/gems/gems/c-0.0.3/README.md
/usr/local/share/gems/gems/c-0.0.3/Rakefile
/usr/local/share/gems/gems/c-0.0.3/c.gemspec
/usr/local/share/gems/gems/c-0.0.3/lib/c.rb
/usr/local/share/gems/gems/c-0.0.3/lib/c/version.rb
This is post_build
This is post_install
Successfully installed c-0.0.3
Parsing documentation for c-0.0.3
Parsing sources...
100% [ 2/ 2]  lib/c/version.rb
Installing ri documentation for c-0.0.3
Installing fedora documentation for c-0.0.3
Done installing documentation for c after 0 seconds
1 gem installed
[root@33809b4da933 result]# ls -al /usr/local/share/gems/doc/
total 0
drwxr-xr-x. 1 root root  14 Oct 26 09:43 .
drwxr-xr-x. 1 root root 106 Oct 26 09:43 ..
drwxr-xr-x. 1 root root  12 Oct 26 09:43 c-0.0.3
[root@33809b4da933 result]# ls -al /usr/local/share/gems/doc/c-0.0.3/rdoc/*
-rw-r--r--. 1 root root 2533 Oct 26 09:43 /usr/local/share/gems/doc/c-0.0.3/rdoc/C.html -rw-r--r--. 1 root root 2329 Oct 26 09:43 /usr/local/share/gems/doc/c-0.0.3/rdoc/index.html -rw-r--r--. 1 root root 1178 Oct 26 09:43 /usr/local/share/gems/doc/c-0.0.3/rdoc/table_of_contents.html

/usr/local/share/gems/doc/c-0.0.3/rdoc/css:
total 8
drwxr-xr-x. 1 root root 34 Oct 26 09:43 .
drwxr-xr-x. 1 root root 98 Oct 26 09:43 ..
lrwxrwxrwx. 1 root root 82 Oct 26 09:43 fonts.css -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/css/fonts.css lrwxrwxrwx. 1 root root 81 Oct 26 09:43 rdoc.css -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/css/rdoc.css

/usr/local/share/gems/doc/c-0.0.3/rdoc/images:
total 100
drwxr-xr-x. 1 root root 656 Oct 26 09:43 .
drwxr-xr-x. 1 root root  98 Oct 26 09:43 ..
lrwxrwxrwx. 1 root root  83 Oct 26 09:43 add.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/add.png lrwxrwxrwx. 1 root root  88 Oct 26 09:43 arrow_up.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png lrwxrwxrwx. 1 root root  85 Oct 26 09:43 brick.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/brick.png lrwxrwxrwx. 1 root root  90 Oct 26 09:43 brick_link.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/brick_link.png lrwxrwxrwx. 1 root root  83 Oct 26 09:43 bug.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/bug.png lrwxrwxrwx. 1 root root  92 Oct 26 09:43 bullet_black.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png lrwxrwxrwx. 1 root root  99 Oct 26 09:43 bullet_toggle_minus.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png lrwxrwxrwx. 1 root root  98 Oct 26 09:43 bullet_toggle_plus.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png lrwxrwxrwx. 1 root root  84 Oct 26 09:43 date.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/date.png lrwxrwxrwx. 1 root root  86 Oct 26 09:43 delete.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/delete.png lrwxrwxrwx. 1 root root  84 Oct 26 09:43 find.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/find.png lrwxrwxrwx. 1 root root  96 Oct 26 09:43 loadingAnimation.gif -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif lrwxrwxrwx. 1 root root  91 Oct 26 09:43 macFFBgHack.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png lrwxrwxrwx. 1 root root  87 Oct 26 09:43 package.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/package.png lrwxrwxrwx. 1 root root  90 Oct 26 09:43 page_green.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/page_green.png lrwxrwxrwx. 1 root root  95 Oct 26 09:43 page_white_text.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png lrwxrwxrwx. 1 root root  96 Oct 26 09:43 page_white_width.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png lrwxrwxrwx. 1 root root  86 Oct 26 09:43 plugin.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/plugin.png lrwxrwxrwx. 1 root root  84 Oct 26 09:43 ruby.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/ruby.png lrwxrwxrwx. 1 root root  88 Oct 26 09:43 tag_blue.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png lrwxrwxrwx. 1 root root  89 Oct 26 09:43 tag_green.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/tag_green.png lrwxrwxrwx. 1 root root  91 Oct 26 09:43 transparent.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/transparent.png lrwxrwxrwx. 1 root root  86 Oct 26 09:43 wrench.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/wrench.png lrwxrwxrwx. 1 root root  93 Oct 26 09:43 wrench_orange.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png lrwxrwxrwx. 1 root root  84 Oct 26 09:43 zoom.png -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/images/zoom.png

/usr/local/share/gems/doc/c-0.0.3/rdoc/js:
total 20
drwxr-xr-x. 1 root root 118 Oct 26 09:43 .
drwxr-xr-x. 1 root root  98 Oct 26 09:43 ..
lrwxrwxrwx. 1 root root  83 Oct 26 09:43 darkfish.js -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/js/darkfish.js lrwxrwxrwx. 1 root root  87 Oct 26 09:43 navigation.js -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/json_index/js/navigation.js lrwxrwxrwx. 1 root root  81 Oct 26 09:43 search.js -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/darkfish/js/search.js
-rw-r--r--. 1 root root 106 Oct 26 09:43 search_index.js
lrwxrwxrwx. 1 root root  85 Oct 26 09:43 searcher.js -> /usr/share/gems/gems/rdoc-6.4.0/lib/rdoc/generator/template/json_index/js/searcher.js
```

I am afraid we won't dodge monkey patching here due to the lack of parametrization of the documentation generator options.

Following, I can uncomment the following line: https://fedorapeople.org/cgit/jackorp/public_git/fedora_darkfish.git/tree/lib/rubygems_plugin.rb#n24 which would hopefully enable this only when we are in an RPM build. I do not expect this package to be installed outside of an RPM buildroot for a regular user.

There are some debug prints and leftover code, I'll get to the cleanup later, they help me with at least seeing if the
plugin was required and the hooks were registered.

Interestingly enough, I was not successful in monkey patching outside of the Gem hooks (pre_install etc...).

Next possible steps are:
* Patch rdoc with this patch https://fedorapeople.org/cgit/vondruch/public_git/darkfish.git/tree/rdoc-6.4.0-Drop-the-font-URLs-from-css.patch?h=rawhide
  However I am afraid we might break something...

* Require fonts for rdoc and/or add font requires to doc subpackages.
  We can maybe add implicit font requires via some already used macros, but that is just an idea so far.
* Attempt to unbundle fonts from rubygem-rdoc

* And most importantly: have successful rubygem builds that use symlink in the doc subpackage.

Another thing I am concerned about are the symlinks. Maybe we should split the static darkfish template files into a subpackage, add font requires on that, and have -doc subpackages depend on that, so that we don't pull the whole rdoc when we want just the specific static files.

Feedback is welcomed.

Regards,
Jarek
_______________________________________________
ruby-sig mailing list -- ruby-sig@lists.fedoraproject.org
To unsubscribe send an email to ruby-sig-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to