Permalink
Browse files

Fixed doc

  • Loading branch information...
Andrew Cantino
Andrew Cantino committed Oct 1, 2009
1 parent 16f4ab6 commit 5e275d2472a937b2423bbf371fb8330220f03219
Showing with 10 additions and 5 deletions.
  1. +2 −2 README.rdoc
  2. +7 −2 lib/my_obfuscate.rb
  3. +1 −1 my_obfuscate.gemspec
View
@@ -36,8 +36,8 @@ Make an obfuscator.rb script:
:invite_requests => :truncate,
:relationships => {
- :account_id => { :type => :string, :length => 8, :chars => DatabaseDumpObfuscator::NUMBER_CHARS },
- :code => { :type => :string, :length => 8, :chars => DatabaseDumpObfuscator::USERNAME_CHARS }
+ :account_id => { :type => :string, :length => 8, :chars => MyObfuscate::NUMBER_CHARS },
+ :code => { :type => :string, :length => 8, :chars => MyObfuscate::USERNAME_CHARS }
}
})
obfuscator.obfuscate(STDIN, STDOUT)
View
@@ -1,6 +1,7 @@
-# This can parse mysqldump outputs when the dumps have option -c, which includes column names in the insert statements.
require 'jcode'
+# Class for obfuscating MySQL dumps. This can parse mysqldump outputs when using the -c option, which includes
+# column names in the insert statements.
class MyObfuscate
attr_accessor :config
@@ -9,12 +10,16 @@ class MyObfuscate
USERNAME_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_" + NUMBER_CHARS
SENSIBLE_CHARS = USERNAME_CHARS + '+-=[{]}/?|!@#$%^&*()`~'
+ # Make a new MyObfuscate object. Pass in a configuration structure to define how the obfuscation should be
+ # performed. See the README.rdoc file for more information.
def initialize(configuration = {})
@config = configuration
end
- # We assume that every INSERT INTO line occupies one line in the file, with no internal linebreaks.
+ # Read an input stream and dump out an obfuscated output stream. These streams could be StringIO objects, Files,
+ # or STDIN and STDOUT.
def obfuscate(input_io, output_io)
+ # We assume that every INSERT INTO line occupies one line in the file, with no internal linebreaks.
input_io.each do |line|
if regex_result = INSERT_REGEX.match(line)
table_name = regex_result[1].to_sym
View
@@ -5,7 +5,7 @@
Gem::Specification.new do |s|
s.name = %q{my_obfuscate}
- s.version = "0.2.0"
+ s.version = "0.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Andrew Cantino", "Dave Willett", "Mike Grafton", "Mason Glaves"]

0 comments on commit 5e275d2

Please sign in to comment.