D19334: redo service menu ruby helpers from ground up more or less

Harald Sitter noreply at phabricator.kde.org
Tue Feb 26 12:48:40 GMT 2019


sitter created this revision.
Herald added a project: Dolphin.
Herald added a subscriber: kfm-devel.
sitter requested review of this revision.

REVISION SUMMARY
  - apply ruby community style guidelines
  - full rewrite fixing, among other things:
    - inefficient/unreadable String#end_with reimplementation
    - inefficient use of Kernel.system (forked shell to fork a shell)
    - inefficient/unreadable Dir.glob reimplementation
    - inefficient File initialization for single chmod
    - invocation conditions are now actually readable
    - invocation conditions now also force +x on argless scripts, not just scripts that need arguments
    - repetitive conditions are now expressed as loops on argument arrays
    - mime detection now uses xdg-mime instead of file (xdg-mime internally may fall back to mime but will prefer higher level tools such as kmimetypefinder5; giving better results overall)
    - return values of "backtick forks" are now checked and will produce suitable errors on stderr
    - fail now takes a log_msg argument which is printed to stderr. this is in addition to the error raised as notification for the user, as that is unfortunately not so useful for diagnostics
    - overall error handling and logging of problem causes is much improved
  - add license headers. the original code was actually fairly exhaustive, so this really should have had a header to begin with. the code was originally introduced in svn r1045663 on Nov 6 14:56:35 2009 UTC
  - add blackbox tests. in the interest of keeping the scripts actually simple scripts (as opposed to a bunch of classes used by even simpler scirpts) they are now also covered by test rigging which runs them as scripts (again, as opposed to individual unit testing of distinct units)
    - the tests optionally can use simplecov to gather coverage metrics
    - also wired up to ctest so it actually gets run
  
  structurally there is actually a fair amount of overlap between the two
  scripts, but again, in the interest of keeping things simple I think it's
  better to live with that instead of refactoring a shared library out of
  it and then use heavy-duty meta-programming

REPOSITORY
  R318 Dolphin

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D19334

AFFECTED FILES
  src/settings/services/servicemenudeinstallation
  src/settings/services/servicemenuinstallation
  src/settings/services/test/service_menu_deinstallation_test.rb
  src/settings/services/test/service_menu_installation_test.rb
  src/settings/services/test/test_helper.rb
  src/settings/services/test/test_run.rb
  src/tests/CMakeLists.txt

To: sitter
Cc: kfm-devel, alexde, feverfew, spoorun, navarromorales, firef, andrebarros, emmanuelp, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20190226/d1b8c4b2/attachment.htm>


More information about the kfm-devel mailing list