ideaoforder-fleakr 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. data/.gitignore +3 -0
  2. data/README.rdoc +381 -0
  3. data/Rakefile +73 -0
  4. data/TODO +15 -0
  5. data/VERSION +1 -0
  6. data/fleakr.gemspec +157 -0
  7. data/lib/fleakr.rb +185 -0
  8. data/lib/fleakr/api.rb +8 -0
  9. data/lib/fleakr/api/file_parameter.rb +47 -0
  10. data/lib/fleakr/api/method_request.rb +66 -0
  11. data/lib/fleakr/api/option.rb +175 -0
  12. data/lib/fleakr/api/parameter.rb +35 -0
  13. data/lib/fleakr/api/parameter_list.rb +97 -0
  14. data/lib/fleakr/api/response.rb +35 -0
  15. data/lib/fleakr/api/upload_request.rb +75 -0
  16. data/lib/fleakr/api/value_parameter.rb +36 -0
  17. data/lib/fleakr/core_ext.rb +3 -0
  18. data/lib/fleakr/core_ext/false_class.rb +7 -0
  19. data/lib/fleakr/core_ext/hash.rb +22 -0
  20. data/lib/fleakr/core_ext/true_class.rb +7 -0
  21. data/lib/fleakr/objects.rb +12 -0
  22. data/lib/fleakr/objects/authentication_token.rb +60 -0
  23. data/lib/fleakr/objects/collection.rb +50 -0
  24. data/lib/fleakr/objects/comment.rb +49 -0
  25. data/lib/fleakr/objects/contact.rb +39 -0
  26. data/lib/fleakr/objects/error.rb +22 -0
  27. data/lib/fleakr/objects/group.rb +36 -0
  28. data/lib/fleakr/objects/image.rb +50 -0
  29. data/lib/fleakr/objects/photo.rb +149 -0
  30. data/lib/fleakr/objects/photo_context.rb +49 -0
  31. data/lib/fleakr/objects/search.rb +42 -0
  32. data/lib/fleakr/objects/set.rb +54 -0
  33. data/lib/fleakr/objects/tag.rb +56 -0
  34. data/lib/fleakr/objects/user.rb +103 -0
  35. data/lib/fleakr/support.rb +2 -0
  36. data/lib/fleakr/support/attribute.rb +46 -0
  37. data/lib/fleakr/support/object.rb +111 -0
  38. data/test/fixtures/auth.checkToken.xml +8 -0
  39. data/test/fixtures/auth.getFullToken.xml +8 -0
  40. data/test/fixtures/auth.getToken.xml +8 -0
  41. data/test/fixtures/contacts.getList.xml +7 -0
  42. data/test/fixtures/contacts.getPublicList.xml +7 -0
  43. data/test/fixtures/groups.pools.getPhotos.xml +7 -0
  44. data/test/fixtures/people.findByEmail.xml +6 -0
  45. data/test/fixtures/people.findByUsername.xml +6 -0
  46. data/test/fixtures/people.getInfo.xml +18 -0
  47. data/test/fixtures/people.getPublicGroups.xml +7 -0
  48. data/test/fixtures/people.getPublicPhotos.xml +7 -0
  49. data/test/fixtures/photos.comments.getList.xml +7 -0
  50. data/test/fixtures/photos.getContext.xml +6 -0
  51. data/test/fixtures/photos.getInfo.xml +20 -0
  52. data/test/fixtures/photos.getSizes.xml +10 -0
  53. data/test/fixtures/photos.search.xml +7 -0
  54. data/test/fixtures/photosets.comments.getList.xml +7 -0
  55. data/test/fixtures/photosets.getList.xml +13 -0
  56. data/test/fixtures/photosets.getPhotos.xml +7 -0
  57. data/test/fixtures/tags.getListPhoto.xml +9 -0
  58. data/test/fixtures/tags.getListUser.xml +10 -0
  59. data/test/fixtures/tags.getRelated.xml +9 -0
  60. data/test/test_helper.rb +141 -0
  61. data/test/unit/fleakr/api/file_parameter_test.rb +63 -0
  62. data/test/unit/fleakr/api/method_request_test.rb +94 -0
  63. data/test/unit/fleakr/api/option_test.rb +179 -0
  64. data/test/unit/fleakr/api/parameter_list_test.rb +176 -0
  65. data/test/unit/fleakr/api/parameter_test.rb +34 -0
  66. data/test/unit/fleakr/api/response_test.rb +49 -0
  67. data/test/unit/fleakr/api/upload_request_test.rb +149 -0
  68. data/test/unit/fleakr/api/value_parameter_test.rb +41 -0
  69. data/test/unit/fleakr/core_ext/false_class_test.rb +13 -0
  70. data/test/unit/fleakr/core_ext/hash_test.rb +32 -0
  71. data/test/unit/fleakr/core_ext/true_class_test.rb +13 -0
  72. data/test/unit/fleakr/objects/authentication_token_test.rb +61 -0
  73. data/test/unit/fleakr/objects/comment_test.rb +66 -0
  74. data/test/unit/fleakr/objects/contact_test.rb +84 -0
  75. data/test/unit/fleakr/objects/error_test.rb +21 -0
  76. data/test/unit/fleakr/objects/group_test.rb +46 -0
  77. data/test/unit/fleakr/objects/image_test.rb +81 -0
  78. data/test/unit/fleakr/objects/photo_context_test.rb +80 -0
  79. data/test/unit/fleakr/objects/photo_test.rb +247 -0
  80. data/test/unit/fleakr/objects/search_test.rb +94 -0
  81. data/test/unit/fleakr/objects/set_test.rb +82 -0
  82. data/test/unit/fleakr/objects/tag_test.rb +98 -0
  83. data/test/unit/fleakr/objects/user_test.rb +91 -0
  84. data/test/unit/fleakr/support/attribute_test.rb +126 -0
  85. data/test/unit/fleakr/support/object_test.rb +129 -0
  86. data/test/unit/fleakr_test.rb +186 -0
  87. metadata +195 -0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ /pkg/
2
+ /coverage/
3
+ /doc/
data/README.rdoc ADDED
@@ -0,0 +1,381 @@
1
+ = Fleakr
2
+
3
+ == Description
4
+
5
+ A small, yet powerful, gem to interface with Flickr photostreams
6
+
7
+ == Installation
8
+
9
+ === Stable
10
+
11
+ sudo gem install fleakr
12
+
13
+ === Bleeding Edge
14
+
15
+ sudo gem install reagent-fleakr --source=http://gems.github.com
16
+
17
+ Or ...
18
+
19
+ $ git clone git://github.com/reagent/fleakr.git
20
+ $ cd fleakr
21
+ $ rake gem && sudo gem install pkg/fleakr-<version>.gem
22
+
23
+ == Usage
24
+
25
+ To get started, you'll need to grab an API key from Flickr to at least perform any of
26
+ the non-authenticated, read-only calls. Head on over to the Flickr site to grab one, I'll
27
+ be here when you get back: http://www.flickr.com/services/api/misc.api_keys.html
28
+
29
+ Now that you have your key, you can get things rolling with irb and the fleakr gem:
30
+
31
+ $ irb -r rubygems
32
+ >> require 'fleakr'
33
+
34
+ Then, set your API key (only need to do this once per session):
35
+
36
+ >> Fleakr.api_key = '<your api key here>'
37
+
38
+ === A Brief Tour
39
+
40
+ With just an API key, you have the ability to retrieve a substantial amount of data
41
+ about users, their photosets, photos, contacts, and groups. Let's start by finding a
42
+ user by his username:
43
+
44
+ >> user = Fleakr.user('the decapitator')
45
+ => #<Fleakr::Objects::User:0x692648 @username="the decapitator", @id="21775151@N06">
46
+
47
+ Or by email:
48
+
49
+ >> user = Fleakr.user('user@host.com')
50
+ => #<Fleakr::Objects::User:0x11f484c @username="bckspcr", @id="84481630@N00">
51
+
52
+ Once you have a user, you can find his associated sets:
53
+
54
+ >> user.sets
55
+ => [#<Fleakr::Objects::Set:0x671358 @title="The Decapitator", @description="">,
56
+ #<Fleakr::Objects::Set:0x66d898 @title="londonpaper hijack", ...
57
+
58
+ His individual photos:
59
+
60
+ >> user.photos.first
61
+ => #<Fleakr::Objects::Photo:0x161b024 @title="\"Be Fabulous\"" ... >
62
+
63
+ Or contacts:
64
+
65
+ >> user.contacts.first
66
+ => #<Fleakr::Objects::User:0x19039bc @username=".schill",
67
+ @id="12289718@N00", @icon_farm="1", @icon_server="4">
68
+
69
+ Or his groups if you would like:
70
+
71
+ >> user.groups
72
+ => [#<Fleakr::Objects::Group:0x11f2330 ...,
73
+ #<Fleakr::Objects::Group:0x11f2308 ...
74
+ >> user.groups.first.name
75
+ => "Rural Decay"
76
+ >> user.groups.first.id
77
+ => "14581414@N00"
78
+
79
+ Groups also contain photos:
80
+
81
+ >> user.groups.last.photos.first.title
82
+ => "Welcome To The Machine"
83
+
84
+ When accessing a set, you can also grab all the photos that are in that set:
85
+
86
+ >> user.sets.first
87
+ => #<Fleakr::Objects::Set:0x1195bbc @title="The Decapitator", @id="72157603480986566", @description="">
88
+ >> user.sets.first.photos.first
89
+ => #<Fleakr::Objects::Photo:0x1140108 ... >
90
+ >> user.sets.first.photos.first.title
91
+ => "Untitled1"
92
+
93
+ === Contacts
94
+
95
+ Besides pulling back a given user's public contacts list, you can also retrieve the list of
96
+ contacts for the currently authenticated user (see below about authentication). For example,
97
+ you can retrieve all contacts:
98
+
99
+ >> Fleakr.contacts
100
+ => [#<Fleakr::Objects::Contact:0x111ff84 @username="bryan.ray" ...>]
101
+
102
+ Or just the contacts marked as 'family':
103
+
104
+ >> Fleakr.contacts(:family)
105
+ => [#<Fleakr::Objects::Contact:0x12db42c @username="Grandbob" ...>]
106
+
107
+ Or a specific page of contacts marked as 'friends':
108
+
109
+ >> Fleakr.contacts(:friends, :page => 3, :per_page => 5)
110
+ => [#<Fleakr::Objects::Contact:0x12a6c54 @username="Louise and BCG" ...>]
111
+
112
+ See the documentation for Fleakr.contacts for what options are available.
113
+
114
+ === Photos
115
+
116
+ Each photo object contains metadata about a collection of images, each representing different
117
+ sizes. Once we have a single photo:
118
+
119
+ >> photo = user.photos.first
120
+ => #<Fleakr::Objects::Photo:0x161b024 @title="\"Be Fabulous\"" ... >
121
+
122
+ We can get information about one of the sizes:
123
+
124
+ >> photo.small
125
+ => #<Fleakr::Objects::Image:0x1768f1c @height="172", @size="Small", @width="240",
126
+ @url="http://farm4.static.flickr.com/3250/2924549350_cbc1804258_m.jpg",
127
+ @page="http://www.flickr.com/photos/the_decapitator/2924549350/sizes/s/">
128
+
129
+ Grab the URL for the image itself:
130
+
131
+ >> photo.small.url
132
+ => "http://farm4.static.flickr.com/3250/2924549350_cbc1804258_m.jpg"
133
+
134
+ Or grab the URL for its page on the Flickr site:
135
+
136
+ >> photo.small.page
137
+ => "http://www.flickr.com/photos/the_decapitator/2924549350/sizes/s/"
138
+
139
+ Other sizes are available (:square, :thumbnail, :small, :medium, :large, :original) and
140
+ are accessed in the same way:
141
+
142
+ >> photo.original.url
143
+ => "http://farm4.static.flickr.com/3250/2924549350_1cf67c2d47_o.jpg"
144
+
145
+ === Tags
146
+
147
+ Tags are available for users and photos. Retrieving them is easy:
148
+
149
+ >> user = Fleakr.user('the decapitator')
150
+ >> user.tags
151
+ => [#<Fleakr::Objects::Tag:0x190d5fc @value="ad">,
152
+ #<Fleakr::Objects::Tag:0x1908a20 @value="ads">, ...
153
+ >> user.photos.first.tags
154
+ => [#<Fleakr::Objects::Tag:0x17b1b18 @machine_flag="0", @author_id="21775151@N06", ...
155
+
156
+ All tags have values, but for tags associated with photos there is some additional information:
157
+
158
+ >> tag = user.photos.first.tags.first
159
+ >> tag.id
160
+ => "21729829-3263659141-427098"
161
+ >> tag.raw
162
+ => "decapitator"
163
+ >> tag.value
164
+ => "decapitator"
165
+ >> tag.to_s
166
+ => "decapitator"
167
+ >> tag.machine?
168
+ => false
169
+ >> tag.author
170
+ => #<Fleakr::Objects::User:0x1a149f0 @username="the decapitator", ... >
171
+
172
+ Each tag can also have related tags:
173
+
174
+ >> user.photos.first.tags[1].related.first.related.first.to_s
175
+ => "face"
176
+
177
+ You get the idea - see Fleakr::Objects::Tag for more information.
178
+
179
+ === Comments
180
+
181
+ Similar to tags, photosets and photos can each have comments:
182
+
183
+ >> user.sets.first.comments
184
+ => [#<Fleakr::Objects::Comment:0x19795cc ...
185
+ >> user.photos.first.comments
186
+ => [#<Fleakr::Objects::Comment:0x17bf0b0 @body="Dayum, that's some wishful thinking!" ...
187
+
188
+ All comments have additional information:
189
+
190
+ >> comment = user.photos.first.comments.first
191
+ >> comment.id
192
+ => "21729829-3263659141-72157613553885978"
193
+ >> comment.body
194
+ => "Dayum, that's some wishful thinking!"
195
+ >> comment.to_s
196
+ => "Dayum, that's some wishful thinking!"
197
+ >> comment.url
198
+ => "http://www.flickr.com/photos/the_decapitator/3263659141/#comment72157613553885978"
199
+ >> comment.author
200
+ => #<Fleakr::Objects::User:0x178e3d4 @username="jaspertandy", ... >
201
+
202
+ See Fleakr::Objects::Comment for more information.
203
+
204
+ === Saving Images
205
+
206
+ If a photo interests you, save it down to a directory of your choosing:
207
+
208
+ >> photo.original.save_to('/tmp')
209
+ => #<File:/tmp/2924549350_1cf67c2d47_o.jpg (closed)>
210
+
211
+ Similarly, you can save down entire sets. Just specify the target directory and the size
212
+ of the images you're interested in:
213
+
214
+ >> user.sets.first.save_to('/tmp', :square)
215
+ => [#<Fleakr::Objects::Photo:0x1187a1c @secret="715587b2cb" ...
216
+
217
+ This creates a subdirectory within the target directory based on the set's name and preserves
218
+ the original order of the photos:
219
+
220
+ >> Dir["/tmp/#{user.sets.first.title}/*.jpg"].map
221
+ => ["/tmp/The Decapitator/01_2117922283_715587b2cb_s.jpg",
222
+ "/tmp/The Decapitator/02_2125604584_9c09348fd6_s.jpg",
223
+ "/tmp/The Decapitator/03_2118696542_8af5763bde_s.jpg", ... ]
224
+
225
+ === Searching
226
+
227
+ If you would prefer to just search photos, you can do that with search text:
228
+
229
+ >> photos = Fleakr.search('ponies!!')
230
+ => [#<Fleakr::Objects::Photo:0x11f4e64 @title="hiroshima atomic garden", @id="3078234390">,
231
+ #<Fleakr::Objects::Photo:0x11f4928 @title="PONYLOV", @id="3077360853">, ...
232
+ >> photos.first.title
233
+ => "hiroshima atomic garden"
234
+
235
+ You can also search based on tags:
236
+
237
+ >> photos = Fleakr.search(:tags => 'macro')
238
+ >> photos.first.title
239
+ => "Demure"
240
+ >> photos.first.id
241
+ => "3076049945"
242
+
243
+ Searches can also be scoped to other entities in the system (namely Users and Groups):
244
+
245
+ >> user.groups.first.search('awesome')
246
+ => [#<Fleakr::Objects::Photo:0x18cb4cc @server_id="2012", @id="2181921273",
247
+ @farm_id="3", @title="", @secret="634eda7521">, ...
248
+ >> user.search('serpent')
249
+ => [#<Fleakr::Objects::Photo:0x18a6960 @server_id="41", @id="81370156",
250
+ @farm_id="1", @title="Clear and Serpent Danger", @secret="013091582a">]
251
+
252
+ === Uploading Files
253
+
254
+ Before you can upload files, you need to be able to make authenticated calls to the Flickr
255
+ API. Skip to the next section (Authenticated Calls) for details on how to make this work.
256
+
257
+ Uploading single files is simple:
258
+
259
+ >> Fleakr.upload('/path/to/image.jpg')
260
+ => [#<Fleakr::Objects::Photo:0x217fb54 @updated="1236133594", @server_id="3266", ...>]
261
+
262
+ Notice that the newly-uploaded image is returned. You can further inspect / modify this as
263
+ necessary. The real magic is in uploading multiple files - the upload method takes a file
264
+ glob:
265
+
266
+ >> Fleakr.upload('/path/to/images/*.jpg')
267
+ => [#<Fleakr::Objects::Photo:0x217faa0 ...>,
268
+ #<Fleakr::Objects::Photo:0x212fb18 ...>,
269
+ #<Fleakr::Objects::Photo:0x20e09c8 ...>]
270
+
271
+ You can also set options on the file(s) that you're uploading:
272
+
273
+ >> Fleakr.upload('/path/to/party/images/*.jpg', :viewable_by => :everyone,
274
+ :title => 'Party Pics')
275
+
276
+ The full list of options can be found in the Fleakr::Objects::Photo documentation.
277
+
278
+ === Authenticated Calls
279
+
280
+ While read-only access to the API gets you quite a bit of data, you'll need to generate an
281
+ authentication token if you want access to the more powerful features (like uploading your
282
+ own photos).
283
+
284
+ Assuming you've already applied for a key, go back and make sure you have the right settings
285
+ to get your auth token. Click on the 'Edit key details' link and ensure that:
286
+
287
+ 1. Your application description and notes are up-to-date
288
+ 1. The value for 'Authentication Type' is set to 'Mobile Application'
289
+ 1. The value for 'Mobile Permissions' is set to either 'write' or 'delete'
290
+
291
+ Once this is set, you'll see your Authentication URL on the key details page (it will look
292
+ something like http://www.flickr.com/auth-534525246245). Paste this URL into your browser and
293
+ confirm access to get your mini-token. Now you're ready to make authenticated requests:
294
+
295
+ require 'rubygems'
296
+ require 'fleakr'
297
+
298
+ Fleakr.api_key = 'ABC123'
299
+ Fleakr.shared_secret = 'sekrit' # Available with your key details on the Flickr site
300
+ Fleakr.mini_token = '362-133-214'
301
+
302
+ Fleakr.upload('/path/to/my/photo.jpg')
303
+ Fleakr.token.value # => "34132412341235-12341234ef34"
304
+
305
+ Once you use the mini-token once, it is no longer available. To use the generated auth_token
306
+ for future requests, just set Fleakr.auth_token to the generated value. Similarly, if you have
307
+ an authenticated frob from Flickr (using authentication for desktop applications, for example)
308
+ you can also set <tt>Fleakr.frob</tt> to the frob value returned from the API.
309
+
310
+ === What Went Wrong?
311
+
312
+ Because so much of the underlying API is hidden under the covers, it's often tough to know
313
+ what's really going on when you run into unexpected behavior. To make things easier, you can
314
+ have Fleakr log all of the API traffic. Here's how:
315
+
316
+ Fleakr.logger = Logger.new('/tmp/fleakr.log')
317
+
318
+ Now any calls to the API will log both their request and response data to that file. But be
319
+ warned, this can be pretty verbose by default (especially if you're doing file uploads). To see
320
+ just the requests you need to tune the log level:
321
+
322
+ logger = Logger.new('/tmp/fleakr.log')
323
+ logger.level = Logger::INFO
324
+
325
+ Fleakr.logger = logger
326
+
327
+ Even if something doesn't go wrong, this is a good way to get a sense for when you're making
328
+ API requests.
329
+
330
+ == Contributors
331
+
332
+ While Fleakr started as a labor of love for me, I'm glad that others have been interested
333
+ in this project enough to contribute their ideas and code:
334
+
335
+ * {John Guenin}[http://github.com/johng]
336
+ * {Thomas Olausson}[http://github.com/latompa]
337
+
338
+ Thanks!
339
+
340
+ == Roadmap / TODO
341
+
342
+ === 0.4.x
343
+
344
+ * Implement remaining bits of person and photo-related API calls (read-only)
345
+
346
+ === 0.5.x
347
+
348
+ * Implement asynchronous file upload / replacement w/ ticket checking
349
+ * Provide a better searching interface with ruby-like option syntax
350
+
351
+ === Future
352
+
353
+ * Implement save-able search results (e.g. Fleakr.search('ponies').save_to('/path', :medium))
354
+ * Implement deeper associations for core elements (e.g. tags / etc..)
355
+ * Implement write methods for photos & photosets
356
+ * Implement flickr.places.* portion of API
357
+
358
+ == License
359
+
360
+ Copyright (c) 2008 Patrick Reagan (reaganpr@gmail.com)
361
+
362
+ Permission is hereby granted, free of charge, to any person
363
+ obtaining a copy of this software and associated documentation
364
+ files (the "Software"), to deal in the Software without
365
+ restriction, including without limitation the rights to use,
366
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
367
+ copies of the Software, and to permit persons to whom the
368
+ Software is furnished to do so, subject to the following
369
+ conditions:
370
+
371
+ The above copyright notice and this permission notice shall be
372
+ included in all copies or substantial portions of the Software.
373
+
374
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
375
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
376
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
377
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
378
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
379
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
380
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
381
+ OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,73 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "fleakr"
5
+ gemspec.summary = "A small, yet powerful, gem to interface with Flickr photostreams"
6
+ gemspec.description = "A small, yet powerful, gem to interface with Flickr photostreams"
7
+ gemspec.email = 'reaganpr@gmail.com'
8
+ gemspec.homepage = 'http://sneaq.net'
9
+ gemspec.authors = ["Patrick Reagan", "Mark Dickson"]
10
+ gemspec.add_dependency('hpricot', '>= 0.6.164')
11
+ gemspec.add_dependency('activesupport', '>= 2.0')
12
+ gemspec.add_dependency('loggable', '>= 0.2.0')
13
+ end
14
+ rescue LoadError
15
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
16
+ end
17
+
18
+ # require 'rubygems'
19
+ # require 'rake/gempackagetask'
20
+ # require 'rake/testtask'
21
+ #
22
+ # require 'lib/fleakr/version'
23
+ #
24
+ # spec = Gem::Specification.new do |s|
25
+ # s.name = 'fleakr'
26
+ # s.version = Fleakr::Version.to_s
27
+ # s.has_rdoc = true
28
+ # s.extra_rdoc_files = %w(README.rdoc)
29
+ # s.rdoc_options = %w(--main README.rdoc)
30
+ # s.summary = "A small, yet powerful, gem to interface with Flickr photostreams"
31
+ # s.author = 'Patrick Reagan'
32
+ # s.email = 'reaganpr@gmail.com'
33
+ # s.homepage = 'http://sneaq.net'
34
+ # s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")
35
+ #
36
+ # s.add_dependency('hpricot', '>= 0.6.164')
37
+ # s.add_dependency('activesupport', '>= 2.0')
38
+ # s.add_dependency('loggable', '>= 0.2.0')
39
+ # end
40
+ #
41
+ # Rake::GemPackageTask.new(spec) do |pkg|
42
+ # pkg.gem_spec = spec
43
+ # end
44
+ #
45
+ # Rake::TestTask.new do |t|
46
+ # t.libs << 'test'
47
+ # t.test_files = FileList["test/**/*_test.rb"]
48
+ # t.verbose = true
49
+ # end
50
+ #
51
+ # begin
52
+ # require 'rcov/rcovtask'
53
+ #
54
+ # Rcov::RcovTask.new(:coverage) do |t|
55
+ # t.libs = ['test']
56
+ # t.test_files = FileList["test/**/*_test.rb"]
57
+ # t.verbose = true
58
+ # t.rcov_opts = ['--text-report', "-x #{Gem.path}", '-x /Library/Ruby', '-x /usr/lib/ruby']
59
+ # end
60
+ #
61
+ # task :default => :coverage
62
+ #
63
+ # rescue LoadError
64
+ # warn "\n**** Install rcov (sudo gem install relevance-rcov) to get coverage stats ****\n"
65
+ # task :default => :test
66
+ # end
67
+ #
68
+ # desc 'Generate the gemspec to serve this Gem from Github'
69
+ # task :github do
70
+ # file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
71
+ # File.open(file, 'w') {|f| f << spec.to_ruby }
72
+ # puts "Created gemspec: #{file}"
73
+ # end