Project

highlander

0.01
No release in over 3 years
Low commit activity in last 3 years
The highlander spec ensures that only one instance of the current process is running. If you try to run the same Ruby program again it will raise a RuntimeError instead.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.11
 Project Readme

Description

A gem that ensures only one instance of your main script is running. In short, there can be only one.

Installation

gem install highlander

Adding the trusted cert

gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/highlander/MacLeod/certs/djberg96_pub.pem)

Synopsis

require 'highlander' # This should be the -first- thing in your code.
# Your code here

# Meanwhile, back on the command line...

# First attempt, works. Assume it's running in the background.
ruby your_script.rb

# Second attempt while the first instance is still running, fails.
ruby your_script.rb # => RuntimeError 

Notes

Simply requiring the highlander gem ensures that only one instance of that script cannot be started again. If you try to start it again it will raise a RuntimeError.

Known Issues

If you start your program, modify it while its running, and run it again then this library will not work.

Acknowledgements

Ara Howard for ideas.

License

Apache-2.0

Copyright

(C) 2010-2022 Daniel J. Berger All Rights Reserved.

Warranty

This package is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.

Author

Daniel J. Berger