The 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 foo and bar, your file should read
Use gem push as 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 (Ubuntu 10.10) with Ruby 1.8.7p299 and rubygems 1.3.7
x86-linux (rvm) with Ruby 1.9.2p0 (2010-08-18 revision 29036) and rubygems 1.3.7
PushSafety has not yet been tested on Windows.
sudo gem install push_safety
To get the source and development depencies:
git clone git://github.com/jdleesmiller/push_safety.git cd push_safety gem build push_safety.gemspec sudo gem install push_safety-X.X.X.gem --development
where X.X.X is the current version.
(The MIT License)
Copyright © 2010 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.