No commit activity in last 3 years
No release in over 3 years
Dumps anonymized database contents to .yml files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.1.0
~> 1.1.0
~> 3.2
~> 2.11.0

Runtime

= 0.2.3
 Project Readme

YamlDb::Anonymizer

Dumps anonymized database contents to a YAML file. This is useful if you want to develop Rails applications with near-live data from your server. Based on yaml_db.

(c) 2012 by Thomas Hollstegge

Installation

Add this line to your application's Gemfile:

gem 'yaml_db_anonymizer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install yaml_db_anonymizer

Usage

  • Specify the database fields to anonymize, e.g. in config/initializers/yaml_db_anonymizer.rb:
YamlDb::Anonymizer.define do
  table :users
    remove :encrypted_password
    replace :name, with: 'John Doe'
    replace :phone, with: ->(phone) { phone.to_s[0..-3] + '***' }
  end

  table :logs do
    truncate
  end
end
  • Run rake db:data:dump_anonymized on your server. This creates an anonymized dump in db/data.yml

  • Copy db/data.yml to your local machine

  • Run rake db:data:load on your local machine.

Todo

  • Provide capistrano integration

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT License. Copyright 2012 by Thomas Hollstegge