Skip to content
RubyGems plugin for replacing Windows batch files used in Gems with executables with same name.
Ruby C
Find file

README.rdoc

gem-exefy

code

github.com/bosko/gem-exefy

bugs

github.com/bosko/gem-exefy/issues

DESCRIPTION:

GemExefy is RubyGems plugin aimed to replace batch files (.bat) with executables with the same name. This gem will work only on RubyInstaller Ruby installation and it requires RubyInstaller DevKit.

Reason for such replaceming batch files with executable stubs is twofold. When execution of batch file is interrupted with Ctrl-C key combination, user is faced with the confusing question

“Terminate batch job (Y/N)?”

which is avoided after replacement.

Second reason is appearance of processes in Task manager (or Process Explorer). In the case of batch files all processes are visible as ruby.exe. In order to distinguish between them, program arguments must be examined. In addition, having one process name makes it hard to define firewall rules. Having executable versions instead of batch files will facilitate process identification in task list as well as defining firewall rules. Moreover it makes it possible to create selective firewall rules for different Ruby gems. Installing Ruby applications as Windows services should be also much easer when executable stub is used instead of batch file.

How does it work?

If GemExefy is installed prior to other gems installation it will automatically install executable stub instead of each batch file that is normally created during gem installation. GemExefy enables replacement for existing gems too. Either all or one by one gem can be processed. Finally GemExefy can revert all changes and return all batch files instead of executable stubs if needed.

FEATURES/PROBLEMS:

  • No known problems at the moment

SYNOPSIS:

Exefying single gem:

C:\> gem exefy <gem_name>

Exefying all installed gems on the system:

C:\> gem exefy --all

Reverting batch file for single gem:

C:\> gem exefy <gem_name> --revert

Reverting batch files for all previously processed gems:

C:\> gem exefy --all --revert

REQUIREMENTS:

  • RubyInstaller Ruby version

  • RubyInstaller's DevKit

INSTALL:

  • gem install gem-exefy

DEVELOPERS:

After checking out the source, run:

$ rake newb

This task will install any missing dependencies, run the tests/specs, and generate the RDoc.

GemExefy searches following directories for batch files

  • Gem.bindir

  • Gem.path

Since Gem::path array contains directories pointing to the top level directory and executables are saved in the Gem#bindir folder, GemExefy concatenates directory from Gem.path with value of Gem#bindir (bin directory defined in the target Gem) and name from Gem#executables array with .bat extension. If such file is found it is replaced with corresponding executable file with same name and .exe extension.

LICENSE:

(The MIT License)

Copyright © 2012 Boško Ivanišević

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.