uid_attribute 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +8 -2
  2. data/Gemfile +3 -0
  3. data/LICENSE +20 -20
  4. data/README.rdoc +37 -37
  5. data/Rakefile +14 -38
  6. data/doc/UidAttribute.html +258 -0
  7. data/doc/UidAttribute/ClassMethods.html +194 -0
  8. data/doc/created.rid +3 -0
  9. data/doc/images/brick.png +0 -0
  10. data/doc/images/brick_link.png +0 -0
  11. data/doc/images/bug.png +0 -0
  12. data/doc/images/bullet_black.png +0 -0
  13. data/doc/images/bullet_toggle_minus.png +0 -0
  14. data/doc/images/bullet_toggle_plus.png +0 -0
  15. data/doc/images/date.png +0 -0
  16. data/doc/images/find.png +0 -0
  17. data/doc/images/loadingAnimation.gif +0 -0
  18. data/doc/images/macFFBgHack.png +0 -0
  19. data/doc/images/package.png +0 -0
  20. data/doc/images/page_green.png +0 -0
  21. data/doc/images/page_white_text.png +0 -0
  22. data/doc/images/page_white_width.png +0 -0
  23. data/doc/images/plugin.png +0 -0
  24. data/doc/images/ruby.png +0 -0
  25. data/doc/images/tag_green.png +0 -0
  26. data/doc/images/wrench.png +0 -0
  27. data/doc/images/wrench_orange.png +0 -0
  28. data/doc/images/zoom.png +0 -0
  29. data/doc/index.html +57 -0
  30. data/doc/js/darkfish.js +116 -0
  31. data/doc/js/jquery.js +32 -0
  32. data/doc/js/quicksearch.js +114 -0
  33. data/doc/js/thickbox-compressed.js +10 -0
  34. data/doc/lib/uid_attribute/version_rb.html +54 -0
  35. data/doc/lib/uid_attribute_rb.html +56 -0
  36. data/doc/rdoc.css +763 -0
  37. data/lib/uid_attribute.rb +51 -22
  38. data/lib/uid_attribute/version.rb +5 -0
  39. data/spec/spec.opts +4 -0
  40. data/spec/spec_helper.rb +25 -0
  41. data/spec/uid_attribute_spec.rb +71 -0
  42. data/uid_attribute.gemspec +15 -43
  43. metadata +93 -50
  44. data/VERSION.yml +0 -5
  45. data/test/uid_attribute_test.rb +0 -25
data/.gitignore CHANGED
@@ -1,2 +1,8 @@
1
- rdoc
2
- coverage
1
+ .*.swp
2
+ *.gem
3
+ .bundle
4
+ coverage/
5
+ coverage.data
6
+ Gemfile.lock
7
+ pkg/*
8
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+ gemspec
3
+
data/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2010 [Paul Belt]
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
- of the Software, and to permit persons to whom the Software is furnished to do
8
- so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
20
-
1
+ Copyright (c) 2010 [Paul Belt]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
20
+
data/README.rdoc CHANGED
@@ -1,37 +1,37 @@
1
- = UidAttribute -- Globally Unique Identifiable Attributes
2
-
3
- machina to automatically generate UUIDs upon object instantiation.
4
-
5
-
6
- == Example
7
-
8
- require File.join(File.dirname(__FILE__),'lib','uid_attribute')
9
-
10
- class MyObject
11
- include UIDAttribute
12
-
13
- attr_accessor :uid
14
- uid_attribute :uid # this is optional e.g. to change the UID attribute
15
- end
16
-
17
- puts MyObject.new.uid
18
- # => 4981a86e-239c-45dd-b4b3-283c435fb8ad
19
-
20
- == Use case
21
-
22
- Some projects are confined by regulations (or requirements) that demand data can not be used to identify individuals. In such cases data must be scrubbed i.e. identifiable object names must be removed before unauthorized users can see said data. For example, when a developer needs to recreate a bug on their own system that was reported by a customer using customer-specific data.
23
-
24
- One method to do this is to use globally unique identifiers within the system to identify any given object.
25
-
26
- == Installation
27
-
28
- % script/plugin install git://github.com/belt/uid_attribute.git
29
-
30
- == License
31
-
32
- Copyright (c) 2010 [Paul Belt], released under the MIT license
33
-
34
- == Support
35
-
36
- http://github.com/belt/uid_attribute
37
-
1
+ = UIDAttribute -- Globally Unique Identifiable Attributes
2
+
3
+ machina to automatically generate UUIDs upon object instantiation.
4
+
5
+
6
+ == Example
7
+
8
+ require File.join(File.dirname(__FILE__),'lib','uid_attribute')
9
+
10
+ class MyObject
11
+ include UIDAttribute
12
+
13
+ attr_accessor :uid
14
+ uid_attribute :uid # this is optional e.g. to change the UID attribute
15
+ end
16
+
17
+ puts MyObject.new.uid
18
+ # => 4981a86e-239c-45dd-b4b3-283c435fb8ad
19
+
20
+ == Use case
21
+
22
+ Some projects are confined by regulations (or requirements) that demand data can not be used to identify individuals. In such cases data must be scrubbed i.e. identifiable object names must be removed before unauthorized users can see said data. For example, when a developer needs to recreate a bug on their own system that was reported by a customer using customer-specific data.
23
+
24
+ One method to do this is to use globally unique identifiers within the system to identify any given object.
25
+
26
+ == Installation
27
+
28
+ % gem install uid_attribute
29
+
30
+ == License
31
+
32
+ Copyright (c) 2010 [Paul Belt], released under the MIT license
33
+
34
+ == Support
35
+
36
+ http://github.com/belt/uid_attribute
37
+
data/Rakefile CHANGED
@@ -1,42 +1,18 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- desc 'Test the uid_attribute plugin.'
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.libs << 'test'
12
- t.pattern = 'test/**/*_test.rb'
13
- t.verbose = true
14
- end
15
-
16
- desc 'Generate documentation for the uid_attribute plugin.'
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
18
- rdoc.rdoc_dir = 'rdoc'
19
- rdoc.title = 'UidAttribute'
20
- rdoc.options << '--line-numbers' << '--inline-source'
21
- rdoc.rdoc_files.include('README')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
23
- end
1
+ require 'bundler/gem_tasks'
24
2
 
25
3
  begin
26
- require 'jeweler'
27
- Jeweler::Tasks.new do |gemspec|
28
- gemspec.name = 'uid_attribute'
29
- gemspec.summary = 'machina to automatically generate UUIDs upon object instantiation.'
30
- gemspec.description = "Some projects are confined by regulations (or requirements) that demand data can not be used to identify individuals. In such cases data must be scrubbed i.e. identifiable object names must be removed before unauthorized users can see said data. For example, when a developer needs to recreate a bug on their own system that was reported by a customer using customer-specific data.\n\nOne method to do this is to use globally unique identifiers within the system to identify any given object."
31
- gemspec.email = 'Paul Belt'
32
- gemspec.authors = ['Paul Belt']
33
- gemspec.homepage = 'http://github.com/belt/uid_attribute'
34
- gemspec.extra_rdoc_files = ['README.rdoc']
35
- gemspec.rdoc_options = ['--charset=UTF-8']
36
- gemspec.add_dependency('uuidtools', '>= 2.1.1')
37
- gemspec.rubyforge_project = 'uid_attribute'
4
+ require 'cover_me'
5
+ namespace :cover_me do
6
+ desc 'rcov-esque report for ruby-1.9.x'
7
+ task :report do
8
+ # we expect this to fail
9
+ begin
10
+ Rake::Task['spec'].invoke
11
+ rescue => e
12
+ end
13
+
14
+ CoverMe.complete!
15
+ end
38
16
  end
39
- rescue LoadError
40
- puts "Jeweler not available. Install it with: gem install jeweler"
41
- end
17
+ rescue LoadError; end
42
18
 
@@ -0,0 +1,258 @@
1
+ <?xml version="1.0" encoding="US-ASCII"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta content="text/html; charset=US-ASCII" http-equiv="Content-Type" />
7
+
8
+ <title>Module: UIDAttribute</title>
9
+
10
+ <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
11
+
12
+ <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
+ <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
+
17
+ </head>
18
+ <body id="top" class="module">
19
+
20
+ <div id="metadata">
21
+ <div id="home-metadata">
22
+ <div id="home-section" class="section">
23
+ <h3 class="section-header">
24
+ <a href="./index.html">Home</a>
25
+ <a href="./index.html#classes">Classes</a>
26
+ <a href="./index.html#methods">Methods</a>
27
+ </h3>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="file-metadata">
32
+ <div id="file-list-section" class="section">
33
+ <h3 class="section-header">In Files</h3>
34
+ <div class="section-body">
35
+ <ul>
36
+
37
+ <li><a href="./lib/uid_attribute/version_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
+ class="thickbox" title="lib/uid_attribute/version.rb">lib/uid_attribute/version.rb</a></li>
39
+
40
+ <li><a href="./lib/uid_attribute_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
41
+ class="thickbox" title="lib/uid_attribute.rb">lib/uid_attribute.rb</a></li>
42
+
43
+ </ul>
44
+ </div>
45
+ </div>
46
+
47
+
48
+ </div>
49
+
50
+ <div id="class-metadata">
51
+
52
+
53
+
54
+
55
+
56
+ <!-- Namespace Contents -->
57
+ <div id="namespace-list-section" class="section">
58
+ <h3 class="section-header">Namespace</h3>
59
+ <ul class="link-list">
60
+
61
+ <li><span class="type">MODULE</span> <a href="UIDAttribute/ClassMethods.html">UIDAttribute::ClassMethods</a></li>
62
+
63
+ </ul>
64
+ </div>
65
+
66
+
67
+
68
+ <!-- Method Quickref -->
69
+ <div id="method-list-section" class="section">
70
+ <h3 class="section-header">Methods</h3>
71
+ <ul class="link-list">
72
+
73
+ <li><a href="#method-i-has_uid_accessors-3F">#has_uid_accessors?</a></li>
74
+
75
+ <li><a href="#method-i-set_uid">#set_uid</a></li>
76
+
77
+ </ul>
78
+ </div>
79
+
80
+
81
+
82
+ </div>
83
+
84
+ <div id="project-metadata">
85
+
86
+
87
+
88
+ <div id="classindex-section" class="section project-section">
89
+ <h3 class="section-header">Class/Module Index
90
+ <span class="search-toggle"><img src="./images/find.png"
91
+ height="16" width="16" alt="[+]"
92
+ title="show/hide quicksearch" /></span></h3>
93
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
94
+ <fieldset>
95
+ <legend>Quicksearch</legend>
96
+ <input type="text" name="quicksearch" value=""
97
+ class="quicksearch-field" />
98
+ </fieldset>
99
+ </form>
100
+
101
+ <ul class="link-list">
102
+
103
+ <li><a href="./UIDAttribute.html">UIDAttribute</a></li>
104
+
105
+ <li><a href="./UIDAttribute/ClassMethods.html">UIDAttribute::ClassMethods</a></li>
106
+
107
+ </ul>
108
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
109
+ </div>
110
+
111
+
112
+ </div>
113
+ </div>
114
+
115
+ <div id="documentation">
116
+ <h1 class="module">UIDAttribute</h1>
117
+
118
+ <div id="description" class="description">
119
+
120
+ <p><a href="UIDAttribute.html">UIDAttribute</a> version</p>
121
+
122
+ </div><!-- description -->
123
+
124
+
125
+
126
+
127
+ <div id="5Buntitled-5D" class="documentation-section">
128
+
129
+
130
+
131
+
132
+
133
+ <!-- Constants -->
134
+ <div id="constants-list" class="section">
135
+ <h3 class="section-header">Constants</h3>
136
+ <dl>
137
+
138
+ <dt><a name="VERSION">VERSION</a></dt>
139
+
140
+ <dd class="description"></dd>
141
+
142
+
143
+ </dl>
144
+ </div>
145
+
146
+
147
+
148
+
149
+ <!-- Methods -->
150
+
151
+ <div id="public-instance-method-details" class="method-section section">
152
+ <h3 class="section-header">Public Instance Methods</h3>
153
+
154
+
155
+ <div id="set_uid-method" class="method-detail ">
156
+ <a name="method-i-set_uid"></a>
157
+
158
+
159
+
160
+ <div class="method-heading">
161
+ <span class="method-callseq">set_uid</span>
162
+
163
+ <span class="method-click-advice">click to toggle source</span>
164
+
165
+ </div>
166
+
167
+
168
+
169
+ <div class="method-description">
170
+
171
+ <p>set :uid_attribute</p>
172
+
173
+
174
+
175
+ <div class="method-source-code" id="set_uid-source">
176
+ <pre>
177
+ <span class="ruby-comment"># File lib/uid_attribute.rb, line 61</span>
178
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">set_uid</span>
179
+ <span class="ruby-identifier">klass</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>
180
+ <span class="ruby-identifier">has_uid_accessors?</span>
181
+
182
+ <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">uid_object</span> <span class="ruby-operator">?</span> <span class="ruby-constant">UUIDTools</span><span class="ruby-operator">::</span><span class="ruby-constant">UUID</span>.<span class="ruby-identifier">md5_create</span>(<span class="ruby-constant">UUIDTools</span><span class="ruby-operator">::</span><span class="ruby-constant">UUID_OID_NAMESPACE</span>, <span class="ruby-keyword">self</span>.<span class="ruby-identifier">inspect</span>) <span class="ruby-operator">:</span>
183
+ <span class="ruby-constant">UUIDTools</span><span class="ruby-operator">::</span><span class="ruby-constant">UUID</span>.<span class="ruby-identifier">random_create</span>.<span class="ruby-identifier">to_s</span>
184
+
185
+ <span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{klass.uid_attr}=&quot;</span>, <span class="ruby-identifier">uid</span>)
186
+ <span class="ruby-keyword">end</span></pre>
187
+ </div><!-- set_uid-source -->
188
+
189
+ </div>
190
+
191
+
192
+
193
+
194
+ </div><!-- set_uid-method -->
195
+
196
+
197
+ </div><!-- public-instance-method-details -->
198
+
199
+ <div id="protected-instance-method-details" class="method-section section">
200
+ <h3 class="section-header">Protected Instance Methods</h3>
201
+
202
+
203
+ <div id="has_uid_accessors-3F-method" class="method-detail ">
204
+ <a name="method-i-has_uid_accessors-3F"></a>
205
+
206
+
207
+
208
+ <div class="method-heading">
209
+ <span class="method-callseq">has_uid_accessors?</span>
210
+
211
+ <span class="method-click-advice">click to toggle source</span>
212
+
213
+ </div>
214
+
215
+
216
+
217
+ <div class="method-description">
218
+
219
+ <p>raises errors unless the including class has a setter and getter for
220
+ Klass.uid_attr</p>
221
+
222
+
223
+
224
+ <div class="method-source-code" id="has_uid_accessors-3F-source">
225
+ <pre>
226
+ <span class="ruby-comment"># File lib/uid_attribute.rb, line 78</span>
227
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">has_uid_accessors?</span>
228
+ <span class="ruby-identifier">klass</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>
229
+ <span class="ruby-identifier">uid_attr</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">uid_attr</span>
230
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;dev.error: #{klass}.respond_to?(:#{uid_attr}) == false&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">uid_attr</span>)
231
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;dev.error: #{klass}.respond_to?(:#{uid_attr}=) == false&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">&quot;#{uid_attr}=&quot;</span>)
232
+ <span class="ruby-keyword">end</span></pre>
233
+ </div><!-- has_uid_accessors-3F-source -->
234
+
235
+ </div>
236
+
237
+
238
+
239
+
240
+ </div><!-- has_uid_accessors-3F-method -->
241
+
242
+
243
+ </div><!-- protected-instance-method-details -->
244
+
245
+ </div><!-- 5Buntitled-5D -->
246
+
247
+
248
+ </div><!-- documentation -->
249
+
250
+ <div id="validator-badges">
251
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
252
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
253
+ Rdoc Generator</a> 2</small>.</p>
254
+ </div>
255
+
256
+ </body>
257
+ </html>
258
+