anonymizer 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ test/*
data/Rakefile CHANGED
@@ -1,12 +1,30 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
- require 'echoe'
4
-
5
- Echoe.new('anonymizer', '0.1.0') do |p|
6
- p.description = "Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like."
7
- p.url = "http://github.com/kjkosmatka/anonymizer"
8
- p.author = "Kristopher J. Kosmatka"
9
- p.email = "kk4@medicine.wisc.edu"
10
- p.ignore_pattern = ["test/out*"]
11
- p.development_dependencies = []
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gemspec|
7
+ gemspec.name = "anonymizer"
8
+ gemspec.summary = "Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like."
9
+ gemspec.description = "Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like."
10
+ gemspec.email = "kk4@medicine.wisc.edu"
11
+ gemspec.homepage = "http://github.com/brainmap/anonymizer"
12
+ gemspec.authors = ["Kristopher J. Kosmatka"]
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
12
17
  end
18
+
19
+
20
+
21
+
22
+
23
+ #Echoe.new('anonymizer', '0.1.0') do |p|
24
+ # p.description = "Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like."
25
+ # p.url = "http://github.com/kjkosmatka/anonymizer"
26
+ # p.author = "Kristopher J. Kosmatka"
27
+ # p.email = "kk4@medicine.wisc.edu"
28
+ # p.ignore_pattern = ["test/out*"]
29
+ # p.development_dependencies = []
30
+ #end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
Binary file
data/anonymizer.gemspec CHANGED
@@ -1,66 +1,62 @@
1
- --- !ruby/object:Gem::Specification
2
- name: anonymizer
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- platform: ruby
6
- authors:
7
- - Kristopher J. Kosmatka
8
- autorequire:
9
- bindir: bin
10
- cert_chain: []
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
11
5
 
12
- date: 2009-08-13 02:00:00 -05:00
13
- default_executable: anonymize_data.rb
14
- dependencies: []
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{anonymizer}
8
+ s.version = "0.1.1"
15
9
 
16
- description: Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like.
17
- email: kk4@medicine.wisc.edu
18
- executables:
19
- - anonymize_data.rb
20
- extensions: []
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Kristopher J. Kosmatka"]
12
+ s.date = %q{2009-12-10}
13
+ s.default_executable = %q{anonymize_data.rb}
14
+ s.description = %q{Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like.}
15
+ s.email = %q{kk4@medicine.wisc.edu}
16
+ s.executables = ["anonymize_data.rb"]
17
+ s.extra_rdoc_files = [
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ "Manifest",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "anonymizer-0.1.0.gem",
27
+ "anonymizer.gemspec",
28
+ "bin/anonymize_data.rb",
29
+ "doc/classes/Anonymizer.html",
30
+ "doc/classes/Anonymizer.src/M000003.html",
31
+ "doc/classes/Anonymizer.src/M000004.html",
32
+ "doc/classes/Anonymizer.src/M000005.html",
33
+ "doc/classes/Array.html",
34
+ "doc/classes/Array.src/M000001.html",
35
+ "doc/classes/Array.src/M000002.html",
36
+ "doc/created.rid",
37
+ "doc/files/bin/anonymize_data_rb.html",
38
+ "doc/files/lib/anonymizer_rb.html",
39
+ "doc/fr_class_index.html",
40
+ "doc/fr_file_index.html",
41
+ "doc/fr_method_index.html",
42
+ "doc/index.html",
43
+ "doc/rdoc-style.css",
44
+ "lib/anonymizer.rb"
45
+ ]
46
+ s.homepage = %q{http://github.com/brainmap/anonymizer}
47
+ s.rdoc_options = ["--charset=UTF-8"]
48
+ s.require_paths = ["lib"]
49
+ s.rubygems_version = %q{1.3.5}
50
+ s.summary = %q{Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like.}
21
51
 
22
- extra_rdoc_files:
23
- - bin/anonymize_data.rb
24
- - lib/anonymizer.rb
25
- - README.rdoc
26
- files:
27
- - anonymizer.gemspec
28
- - bin/anonymize_data.rb
29
- - lib/anonymizer.rb
30
- - Manifest
31
- - Rakefile
32
- - README.rdoc
33
- has_rdoc: true
34
- homepage: http://github.com/kjkosmatka/anonymizer
35
- licenses:
36
- post_install_message:
37
- rdoc_options:
38
- - --line-numbers
39
- - --inline-source
40
- - --title
41
- - Anonymizer
42
- - --main
43
- - README.rdoc
44
- require_paths:
45
- - lib
46
- required_ruby_version: !ruby/object:Gem::Requirement
47
- requirements:
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: "0"
51
- version:
52
- required_rubygems_version: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: "1.2"
57
- version:
58
- requirements: []
52
+ if s.respond_to? :specification_version then
53
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
+ s.specification_version = 3
59
55
 
60
- rubyforge_project: anonymizer
61
- rubygems_version: 1.3.5
62
- signing_key:
63
- specification_version: 2
64
- summary: Anonymizes a collection of files and/or directories for interrater reliabiliy analyses and the like.
65
- test_files: []
56
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
57
+ else
58
+ end
59
+ else
60
+ end
61
+ end
66
62
 
@@ -0,0 +1,227 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Anonymizer</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Anonymizer</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/anonymizer_rb.html">
59
+ lib/anonymizer.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000004">anonymize</a>&nbsp;&nbsp;
90
+ <a href="#M000003">new</a>&nbsp;&nbsp;
91
+ <a href="#M000005">record_to</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+ <div id="attribute-list">
107
+ <h3 class="section-bar">Attributes</h3>
108
+
109
+ <div class="name-list">
110
+ <table>
111
+ <tr class="top-aligned-row context-row">
112
+ <td class="context-item-name">anonymizations</td>
113
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
114
+ <td class="context-item-desc">
115
+ a hash, the keys are the original filepaths, the values are the
116
+ corresponding anonymized names
117
+
118
+ </td>
119
+ </tr>
120
+ <tr class="top-aligned-row context-row">
121
+ <td class="context-item-name">destination_dir</td>
122
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
123
+ <td class="context-item-desc">
124
+ a string, the directory to which all of the anoymizations and the key
125
+ should be copied
126
+
127
+ </td>
128
+ </tr>
129
+ <tr class="top-aligned-row context-row">
130
+ <td class="context-item-name">filepaths</td>
131
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
132
+ <td class="context-item-desc">
133
+ an array of strings, the paths to the items to be anonymized
134
+
135
+ </td>
136
+ </tr>
137
+ </table>
138
+ </div>
139
+ </div>
140
+
141
+
142
+
143
+ <!-- if method_list -->
144
+ <div id="methods">
145
+ <h3 class="section-bar">Public Class methods</h3>
146
+
147
+ <div id="method-M000003" class="method-detail">
148
+ <a name="M000003"></a>
149
+
150
+ <div class="method-heading">
151
+ <a href="Anonymizer.src/M000003.html" target="Code" class="method-signature"
152
+ onclick="popupCode('Anonymizer.src/M000003.html');return false;">
153
+ <span class="method-name">new</span><span class="method-args">(filepaths)</span>
154
+ </a>
155
+ </div>
156
+
157
+ <div class="method-description">
158
+ <p>
159
+ Creates a <a href="Anonymizer.html#M000003">new</a> instance with an array
160
+ of filepaths (strings) A <a href="Anonymizer.html#M000003">new</a> set of
161
+ anaonymizations will be created automatically at initialization. If you
162
+ want to reshuffle the anonymizations you can call <a
163
+ href="Anonymizer.html#M000004">anonymize</a> at any time afterward.
164
+ </p>
165
+ </div>
166
+ </div>
167
+
168
+ <h3 class="section-bar">Public Instance methods</h3>
169
+
170
+ <div id="method-M000004" class="method-detail">
171
+ <a name="M000004"></a>
172
+
173
+ <div class="method-heading">
174
+ <a href="Anonymizer.src/M000004.html" target="Code" class="method-signature"
175
+ onclick="popupCode('Anonymizer.src/M000004.html');return false;">
176
+ <span class="method-name">anonymize</span><span class="method-args">()</span>
177
+ </a>
178
+ </div>
179
+
180
+ <div class="method-description">
181
+ <p>
182
+ Reshuffles the anonymized names
183
+ </p>
184
+ </div>
185
+ </div>
186
+
187
+ <div id="method-M000005" class="method-detail">
188
+ <a name="M000005"></a>
189
+
190
+ <div class="method-heading">
191
+ <a href="Anonymizer.src/M000005.html" target="Code" class="method-signature"
192
+ onclick="popupCode('Anonymizer.src/M000005.html');return false;">
193
+ <span class="method-name">record_to</span><span class="method-args">(destination_dir, options = {})</span>
194
+ </a>
195
+ </div>
196
+
197
+ <div class="method-description">
198
+ <p>
199
+ Copies the collection of files/directories to the destination directory
200
+ using the current anonymized names. Records the anonymizations in a
201
+ keymap.yml file.
202
+ </p>
203
+ <h3>Options</h3>
204
+ <p>
205
+ :inclue_csv =&gt; true &#8212; writes the csv format keymap in addition to
206
+ the yaml
207
+ </p>
208
+ <p>
209
+ :keymap_name =&gt; &quot;basename&quot; &#8212; uses an alternate file
210
+ basename for the keymap files (the default is &quot;keymap&quot;)
211
+ </p>
212
+ </div>
213
+ </div>
214
+
215
+
216
+ </div>
217
+
218
+
219
+ </div>
220
+
221
+
222
+ <div id="validator-badges">
223
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
224
+ </div>
225
+
226
+ </body>
227
+ </html>
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>new (Anonymizer)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/anonymizer.rb, line 15</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">filepaths</span>)
15
+ <span class="ruby-ivar">@filepaths</span> = <span class="ruby-identifier">filepaths</span>
16
+ <span class="ruby-ivar">@anonymizations</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
17
+ <span class="ruby-identifier">anonymize</span>
18
+ <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>anonymize (Anonymizer)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/anonymizer.rb, line 22</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">anonymize</span>
15
+ <span class="ruby-identifier">keys</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@filepaths</span>)
16
+ <span class="ruby-identifier">idx</span> = <span class="ruby-value">0</span>
17
+ <span class="ruby-identifier">ndigits</span> = (<span class="ruby-constant">Math</span>.<span class="ruby-identifier">log10</span>(<span class="ruby-ivar">@filepaths</span>.<span class="ruby-identifier">length</span>)<span class="ruby-operator">+</span><span class="ruby-value">1</span>).<span class="ruby-identifier">floor</span>
18
+ <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">empty?</span>
19
+ <span class="ruby-ivar">@anonymizations</span>[<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">pick!</span>] = <span class="ruby-node">&quot;%0#{ndigits}d&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">idx</span>
20
+ <span class="ruby-identifier">idx</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
21
+ <span class="ruby-keyword kw">end</span>
22
+ <span class="ruby-keyword kw">end</span></pre>
23
+ </body>
24
+ </html>