gem push command makes it incredibly easy to publish your gems… maybe a little too easy. PushSafety is a RubyGems plugin that refuses to push a gem unless it is on a whitelist. Add your open source gems to your whitelist, and keep your private gems safe from accidental pushes.
Create a whitelist file. The default location is
~/.gem_push_safety. Separate gem names with whitespace (e.g. one gem name per line). For example, if you work on open source gems
bar, your file should read
gem pushas normal. If you try to push a gem that is not in your whitelist, it gives an error.
You can use a different file for the whitelist; see
gem help push once you have installed PushSafety.
You must have ruby and rubygems installed.
PushSafety has been tested on x86-linux (debian squeeze) with:
ruby-1.8.7-p358 and rubygems 1.8.17
ruby-1.9.3-p125 and rubygems 1.8.17
ruby-2.0.0-p0 and rubygems 2.0.3
PushSafety has not yet been tested on Windows.
gem install push_safety
To get the source and development depencies:
git clone git://github.com/jdleesmiller/push_safety.git cd push_safety bundle
To run the tests:
0.0.2 – 2013-04-02
fix for compatibility with ruby 2.0.0; tested on 1.8.7, 1.9.3 and 2.0.0
(The MIT License)
Copyright © 2013 John Lees-Miller
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.