mongoid-grid_fs 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzI1NDRlODVhMWVmODUwZmNlNGQzYmQ3NmZmYWM3MzNlYWQ4ZWZjMA==
5
- data.tar.gz: !binary |-
6
- ZGFiNDQ5YWIwMzZiN2JmZjllYzYyODQyODAyNTY0OTQ0YzE0MWNlMg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- OTYyNWQ0ZTEzZmM4ZTYwZWUyOTc4NWE4NGEyNzE1MDJiOTMzMTkzNDQxNTEz
10
- OGMwMGNhYzQ5ZmQ0NTAxOThiY2FkYTZiZmY2YjZhYzFjMmEyMGQ5NGQwMWJk
11
- NGI3YWEzZTEyMTA3OWFlZGM2OTJmOGJlYjk4YjZhOTZkZWE5Y2M=
12
- data.tar.gz: !binary |-
13
- YWUxMjcwMGRkY2EzYTI2Njk3MzgyYTRlNDg5MmJhMjVmNDRiNzllODQwNzlm
14
- ZDI4ZmIwOWE0MmZhNjgzZDBiOGQ4YTZkODU2NWRlMDQwN2IwZDUyOThkNmJh
15
- MDg2ZTZjNWIyN2E5MjA4MGM5MTc5NmZkY2IwZWQzZDZlMjk5NjI=
2
+ SHA1:
3
+ metadata.gz: 50ce3ab62fcedb405803f4d0559206c7b62fedf9
4
+ data.tar.gz: f8d76bda2fed5f76abd57d97a3f797237a302488
5
+ SHA512:
6
+ metadata.gz: 36a7ad8f5c12467c5f8cd8b074de01aa6cf7ce1a193a08269386749ca40fd6303483a228c94c3567b42560004b00902241309deba5818908723cf79f276c80cb
7
+ data.tar.gz: 346ce4a4b25578d1acf2aec839dede4a4c01f131d1854919a020896132b2cef13245691c675fe7e206964cba99193501da8166626548c0e0056318940ae79866
data/README.md CHANGED
@@ -54,3 +54,16 @@ it has the following features:
54
54
  <%= image_tag :src => file.data_uri %>
55
55
 
56
56
  ````
57
+
58
+ CONTRIBUTING
59
+ ------------
60
+
61
+ ```
62
+ $ bundle
63
+ $ rake test
64
+ ```
65
+
66
+ LICENSE
67
+ -------
68
+
69
+ This is licensed under the Ruby License: http://www.ruby-lang.org/en/about/license.txt
data/Rakefile CHANGED
@@ -1,481 +1,11 @@
1
- task :license do
2
- open('LICENSE', 'w'){|fd| fd.puts "Ruby"}
3
- end
4
-
5
- task :default do
6
- puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
7
- end
8
-
9
- task :test do
10
- run_tests!
11
- end
12
-
13
- namespace :test do
14
- task(:unit){ run_tests!(:unit) }
15
- task(:functional){ run_tests!(:functional) }
16
- task(:integration){ run_tests!(:integration) }
17
- end
18
-
19
- def run_tests!(which = nil)
20
- which ||= '**'
21
- test_dir = File.join(This.dir, "test")
22
- test_glob ||= File.join(test_dir, "#{ which }/**_test.rb")
23
- test_rbs = Dir.glob(test_glob).sort
24
-
25
- div = ('=' * 119)
26
- line = ('-' * 119)
27
-
28
- test_rbs.each_with_index do |test_rb, index|
29
- testno = index + 1
30
- #command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
31
- command = "#{ This.ruby } -I ./lib -I ./test/lib #{ test_rb }"
32
-
33
- puts
34
- say(div, :color => :cyan, :bold => true)
35
- say("@#{ testno } => ", :bold => true, :method => :print)
36
- say(command, :color => :cyan, :bold => true)
37
- say(line, :color => :cyan, :bold => true)
38
-
39
- system(command)
40
-
41
- say(line, :color => :cyan, :bold => true)
42
-
43
- status = $?.exitstatus
44
-
45
- if status.zero?
46
- say("@#{ testno } <= ", :bold => true, :color => :white, :method => :print)
47
- say("SUCCESS", :color => :green, :bold => true)
48
- else
49
- say("@#{ testno } <= ", :bold => true, :color => :white, :method => :print)
50
- say("FAILURE", :color => :red, :bold => true)
51
- end
52
- say(line, :color => :cyan, :bold => true)
53
-
54
- exit(status) unless status.zero?
55
- end
56
- end
57
-
58
-
59
- task :gemspec do
60
- ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
61
- ignore_directories = ['pkg']
62
- ignore_files = ['test/log']
63
-
64
- shiteless =
65
- lambda do |list|
66
- list.delete_if do |entry|
67
- next unless test(?e, entry)
68
- extension = File.basename(entry).split(%r/[.]/).last
69
- ignore_extensions.any?{|ext| ext === extension}
70
- end
71
- list.delete_if do |entry|
72
- next unless test(?d, entry)
73
- dirname = File.expand_path(entry)
74
- ignore_directories.any?{|dir| File.expand_path(dir) == dirname}
75
- end
76
- list.delete_if do |entry|
77
- next unless test(?f, entry)
78
- filename = File.expand_path(entry)
79
- ignore_files.any?{|file| File.expand_path(file) == filename}
80
- end
81
- end
82
-
83
- lib = This.lib
84
- object = This.object
85
- version = This.version
86
- files = shiteless[Dir::glob("**/**")]
87
- executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
88
- #has_rdoc = true #File.exist?('doc')
89
- test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
90
- summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
91
- description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
92
- license = object.respond_to?(:license) ? object.license : "Ruby"
93
-
94
- if This.extensions.nil?
95
- This.extensions = []
96
- extensions = This.extensions
97
- %w( Makefile configure extconf.rb ).each do |ext|
98
- extensions << ext if File.exists?(ext)
99
- end
100
- end
101
- extensions = [extensions].flatten.compact
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
102
3
 
103
- if This.dependencies.nil?
104
- dependencies = []
105
- else
106
- case This.dependencies
107
- when Hash
108
- dependencies = This.dependencies.values
109
- when Array
110
- dependencies = This.dependencies
111
- end
112
- end
113
-
114
- if license.nil? && test(?s, 'LICENSE')
115
- license = IO.binread('LICENSE')
116
- end
117
-
118
- template =
119
- if test(?e, 'gemspec.erb')
120
- Template{ IO.read('gemspec.erb') }
121
- else
122
- Template {
123
- <<-__
124
- ## <%= lib %>.gemspec
125
- #
126
-
127
- Gem::Specification::new do |spec|
128
- spec.name = <%= lib.inspect %>
129
- spec.version = <%= version.inspect %>
130
- spec.platform = Gem::Platform::RUBY
131
- spec.summary = <%= lib.inspect %>
132
- spec.description = <%= description.inspect %>
133
- spec.license = <%= license.inspect %>
134
-
135
- spec.files =\n<%= files.sort.pretty_inspect %>
136
- spec.executables = <%= executables.inspect %>
137
-
138
- spec.require_path = "lib"
139
-
140
- spec.test_files = <%= test_files.inspect %>
141
-
142
- <% dependencies.each do |lib_version| %>
143
- spec.add_dependency(*<%= Array(lib_version).flatten.inspect %>)
144
- <% end %>
145
-
146
- spec.extensions.push(*<%= extensions.inspect %>)
147
-
148
- spec.rubyforge_project = <%= This.rubyforge_project.inspect %>
149
- spec.author = <%= This.author.inspect %>
150
- spec.email = <%= This.email.inspect %>
151
- spec.homepage = <%= This.homepage.inspect %>
152
- end
153
- __
154
- }
155
- end
156
-
157
- Fu.mkdir_p(This.pkgdir)
158
- gemspec = "#{ lib }.gemspec"
159
- open(gemspec, "w"){|fd| fd.puts(template)}
160
- This.gemspec = gemspec
161
- end
162
-
163
- task :gem => [:clean, :gemspec] do
164
- Fu.mkdir_p(This.pkgdir)
165
- before = Dir['*.gem']
166
- cmd = "gem build #{ This.gemspec }"
167
- `#{ cmd }`
168
- after = Dir['*.gem']
169
- gem = ((after - before).first || after.first) or abort('no gem!')
170
- Fu.mv(gem, This.pkgdir)
171
- This.gem = File.join(This.pkgdir, File.basename(gem))
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "lib"
6
+ t.libs << "test"
7
+ t.pattern = "test/**/*_test.rb"
8
+ t.verbose = false
172
9
  end
173
10
 
174
- task :readme do
175
- samples = ''
176
- prompt = '~ > '
177
- lib = This.lib
178
- version = This.version
179
-
180
- Dir['sample*/*'].sort.each do |sample|
181
- samples << "\n" << " <========< #{ sample } >========>" << "\n\n"
182
-
183
- cmd = "cat #{ sample }"
184
- samples << Util.indent(prompt + cmd, 2) << "\n\n"
185
- samples << Util.indent(`#{ cmd }`, 4) << "\n"
186
-
187
- cmd = "ruby #{ sample }"
188
- samples << Util.indent(prompt + cmd, 2) << "\n\n"
189
-
190
- cmd = "ruby -e'STDOUT.sync=true; exec %(ruby -I ./lib #{ sample })'"
191
- samples << Util.indent(`#{ cmd } 2>&1`, 4) << "\n"
192
- end
193
-
194
- template =
195
- if test(?e, 'README.erb')
196
- Template{ IO.read('README.erb') }
197
- else
198
- Template {
199
- <<-__
200
- NAME
201
- #{ lib }
202
-
203
- DESCRIPTION
204
-
205
- INSTALL
206
- gem install #{ lib }
207
-
208
- SAMPLES
209
- #{ samples }
210
- __
211
- }
212
- end
213
-
214
- open("README", "w"){|fd| fd.puts template}
215
- end
216
-
217
-
218
- task :clean do
219
- Dir[File.join(This.pkgdir, '**/**')].each{|entry| Fu.rm_rf(entry)}
220
- end
221
-
222
-
223
- task :release => [:clean, :gemspec, :gem] do
224
- gems = Dir[File.join(This.pkgdir, '*.gem')].flatten
225
- raise "which one? : #{ gems.inspect }" if gems.size > 1
226
- raise "no gems?" if gems.size < 1
227
-
228
- cmd = "gem push #{ This.gem }"
229
- puts cmd
230
- puts
231
- system(cmd)
232
- abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
233
-
234
- cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.gem }"
235
- puts cmd
236
- puts
237
- system(cmd)
238
- abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
239
- end
240
-
241
-
242
-
243
-
244
-
245
- BEGIN {
246
- # support for this rakefile
247
- #
248
- $VERBOSE = nil
249
-
250
- require 'ostruct'
251
- require 'erb'
252
- require 'fileutils'
253
- require 'rbconfig'
254
- require 'pp'
255
-
256
- # fu shortcut
257
- #
258
- Fu = FileUtils
259
-
260
- # pkg dir
261
- #
262
- Dir.chdir(File.dirname(__FILE__))
263
-
264
- # config object
265
- #
266
- class Cfg < ::Hash
267
- def method_missing(method, *args, &block)
268
- method = method.to_s
269
- case method
270
- when /=$/
271
- key = method.chomp('=')
272
- value = args.shift
273
- self[key] = value
274
- when /\?$/
275
- key = method.chomp('?')
276
- self.key?(key)
277
- when /\!$/
278
- key = method.chomp('!')
279
- self[key] = !!self[key]
280
- else
281
- key = method
282
- if args.empty? && block.nil?
283
- if has_key?(key)
284
- self[key]
285
- else
286
- nil
287
- #raise IndexError, key
288
- end
289
- else
290
- value =
291
- case
292
- when args.size > 0
293
- args.shift
294
- when block
295
- block.call
296
- end
297
- self[key] = value
298
- end
299
- end
300
- end
301
-
302
- def eval(string)
303
- instance_eval(string)
304
- end
305
- end
306
-
307
- # cache a bunch of stuff about this rakefile/environment
308
- #
309
- This = Cfg.new
310
-
311
- This.file = File.expand_path(__FILE__)
312
- This.dir = File.dirname(This.file)
313
- This.pkgdir = File.join(This.dir, 'pkg')
314
-
315
- # load config iff present
316
- #
317
- This.eval(IO.binread('config.rb')) if test(?s, 'config.rb')
318
-
319
- # grok lib
320
- #
321
- unless This.lib?
322
- lib = ENV['LIB']
323
- unless lib
324
- lib = File.basename(Dir.pwd)
325
- end
326
- This.lib = lib
327
- end
328
-
329
- # load lib
330
- #
331
- $LOAD_PATH.unshift('./lib')
332
- Kernel.require(This.lib)
333
-
334
- # grok the lib's object
335
- #
336
- unless This.object?
337
- unless This.name?
338
- This.name = File.basename(This.lib).split('_').each{|s| s.capitalize }.join('')
339
- end
340
- This.object = eval(This.name)
341
- else
342
- if This.object.is_a?(String)
343
- This.object = eval(This.object)
344
- unless This.name?
345
- This.name = This.object.name
346
- end
347
- end
348
- end
349
-
350
- # grok version
351
- #
352
- unless This.version?
353
- if This.object.respond_to?(:version)
354
- This.version = This.object.send(:version)
355
- end
356
- end
357
- abort 'no version' unless This.version?
358
-
359
- # see if dependencies are exported by the module
360
- #
361
- if This.object.respond_to?(:dependencies)
362
- This.dependencies = This.object.dependencies
363
- else
364
- This.dependencies = []
365
- end
366
-
367
- # set some reasonable defaults
368
- #
369
- {
370
-
371
- :synopsis => "#{ This.name } kicks the ass",
372
- :rubyforge_project => 'codeforpeople',
373
- :author => "Ara T. Howard",
374
- :email => "ara.t.howard@gmail.com",
375
- :homepage => "https://github.com/ahoward/#{ This.lib }"
376
-
377
- }.each do |key, val|
378
- unless This.send("#{ key }?")
379
- This.send("#{ key }=", val)
380
- end
381
- end
382
-
383
- # discover full path to this ruby executable
384
- #
385
- c = Config::CONFIG
386
- bindir = c["bindir"] || c['BINDIR']
387
- ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
388
- ruby_ext = c['EXEEXT'] || ''
389
- ruby = File.join(bindir, (ruby_install_name + ruby_ext))
390
- This.ruby = ruby
391
-
392
- # some utils
393
- #
394
- module Util
395
- def indent(s, n = 2)
396
- s = unindent(s)
397
- ws = ' ' * n
398
- s.gsub(%r/^/, ws)
399
- end
400
-
401
- def unindent(s)
402
- indent = nil
403
- s.each_line do |line|
404
- next if line =~ %r/^\s*$/
405
- indent = line[%r/^\s*/] and break
406
- end
407
- indent ? s.gsub(%r/^#{ indent }/, "") : s
408
- end
409
- extend self
410
- end
411
-
412
- # template support
413
- #
414
- class Template
415
- def initialize(&block)
416
- @block = block
417
- @template = block.call.to_s
418
- end
419
- def expand(b=nil)
420
- ERB.new(Util.unindent(@template)).result((b||@block).binding)
421
- end
422
- alias_method 'to_s', 'expand'
423
- end
424
- def Template(*args, &block) Template.new(*args, &block) end
425
-
426
- # colored console output support
427
- #
428
- This.ansi = {
429
- :clear => "\e[0m",
430
- :reset => "\e[0m",
431
- :erase_line => "\e[K",
432
- :erase_char => "\e[P",
433
- :bold => "\e[1m",
434
- :dark => "\e[2m",
435
- :underline => "\e[4m",
436
- :underscore => "\e[4m",
437
- :blink => "\e[5m",
438
- :reverse => "\e[7m",
439
- :concealed => "\e[8m",
440
-
441
- :black => "\e[30m",
442
- :red => "\e[31m",
443
- :green => "\e[32m",
444
- :yellow => "\e[33m",
445
- :blue => "\e[34m",
446
- :magenta => "\e[35m",
447
- :cyan => "\e[36m",
448
- :white => "\e[37m",
449
-
450
- :on_black => "\e[40m",
451
- :on_red => "\e[41m",
452
- :on_green => "\e[42m",
453
- :on_yellow => "\e[43m",
454
- :on_blue => "\e[44m",
455
- :on_magenta => "\e[45m",
456
- :on_cyan => "\e[46m",
457
- :on_white => "\e[47m"
458
- }
459
- def say(phrase, *args)
460
- options = args.last.is_a?(Hash) ? args.pop : {}
461
- options[:color] = args.shift.to_s.to_sym unless args.empty?
462
- keys = options.keys
463
- keys.each{|key| options[key.to_s.to_sym] = options.delete(key)}
464
-
465
- color = options[:color]
466
- bold = options.has_key?(:bold)
467
-
468
- parts = [phrase]
469
- parts.unshift(This.ansi[color]) if color
470
- parts.unshift(This.ansi[:bold]) if bold
471
- parts.push(This.ansi[:clear]) if parts.size > 1
472
-
473
- method = options[:method] || :puts
474
-
475
- Kernel.send(method, parts.join)
476
- end
477
-
478
- # always run out of the project dir
479
- #
480
- Dir.chdir(This.dir)
481
- }
11
+ task :default => :test