wand 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 John Nunemaker
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ = wand
2
+
3
+ Mime-Type gem with fallback to unix file command. Never use this when path/filename is user input as there is no escaping.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 John Nunemaker. See LICENSE for details.
@@ -0,0 +1,43 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ require File.dirname(__FILE__) + '/lib/wand'
5
+
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |gem|
9
+ gem.name = 'wand'
10
+ gem.summary = gem.description = 'Mime-Type gem with fallback to unix file command'
11
+ gem.email = 'nunemaker@gmail.com'
12
+ gem.homepage = 'http://github.com/jnunemaker/wand'
13
+ gem.authors = ['John Nunemaker']
14
+ gem.version = Wand::Version
15
+
16
+ gem.add_dependency 'mime-types'
17
+ gem.add_development_dependency 'shoulda'
18
+ gem.add_development_dependency 'yard'
19
+ end
20
+ Jeweler::GemcutterTasks.new
21
+ rescue LoadError
22
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ end
24
+
25
+ require 'rake/testtask'
26
+ Rake::TestTask.new(:test) do |test|
27
+ test.libs << 'lib' << 'test'
28
+ test.ruby_opts << '-rubygems'
29
+ test.pattern = 'test/**/test_*.rb'
30
+ test.verbose = true
31
+ end
32
+
33
+ task :test => :check_dependencies
34
+ task :default => :test
35
+
36
+ begin
37
+ require 'yard'
38
+ YARD::Rake::YardocTask.new
39
+ rescue LoadError
40
+ task :yardoc do
41
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
42
+ end
43
+ end
@@ -0,0 +1,21 @@
1
+ require 'mime/types'
2
+
3
+ module Wand
4
+ Version = '0.1'
5
+
6
+ def self.wave(path)
7
+ type = MIME::Types.type_for(path)[0].to_s
8
+ type = `#{executable} --mime --brief #{path}`.split(';')[0] if type.nil? || type == ''
9
+ type = nil if type =~ /cannot\sopen/
10
+ type
11
+ end
12
+
13
+ def self.executable
14
+ return @executable if defined?(@executable)
15
+ @executable ||= `which file`.chomp
16
+ end
17
+
18
+ def self.executable=(path)
19
+ @executable = path
20
+ end
21
+ end
Binary file
@@ -0,0 +1,150 @@
1
+ <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" > <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
2
+ <defs >
3
+ <font id="AvantGardeITCbyBT-Demi" horiz-adv-x="961" ><font-face
4
+ font-family="AvantGarde Bk BT"
5
+ units-per-em="2048"
6
+ panose-1="2 11 7 2 2 2 2 2 2 4"
7
+ ascent="1657"
8
+ descent="-483"
9
+ alphabetic="0" />
10
+ <missing-glyph horiz-adv-x="748" d="M68 0V1365H612V0H68ZM136 68H544V1297H136V68Z" />
11
+ <glyph unicode=" " glyph-name="space" horiz-adv-x="596" />
12
+ <glyph unicode="!" glyph-name="exclam" horiz-adv-x="627" d="M440 397H184V1456H440V397ZM440 0H184V274H440V0Z" />
13
+ <glyph unicode="&quot;" glyph-name="quotedbl" horiz-adv-x="643" d="M395 1436H559V879H395V1436ZM86 1436H250V879H86V1436Z" />
14
+ <glyph unicode="#" glyph-name="numbersign" horiz-adv-x="1575" d="M709 852L618 598H874L965 852H709ZM735 1460H926L772 1024H1022L1178 1460H1368L1214 1024H1505L1446 852H1153L1063 600H1372L1311 428H1004L848 -6H657L813 428H561L403 -6H213L369 428H70L131
15
+ 600H428L518 852H203L264 1024H580L735 1460Z" />
16
+ <glyph unicode="$" glyph-name="dollar" horiz-adv-x="1190" d="M416 452Q419 358 464 310T594 262Q671 262 717 312T764 444Q764 520 725 561T535 649Q354 703 272 795T190 1034Q190 1183 268 1287T492 1438V1657H729V1436Q860 1402 932 1306T1012 1061H762Q759
17
+ 1123 716 1162T606 1202Q530 1202 484 1158T438 1042Q438 1015 446 996T473 961Q517 925 645 892Q717 873 756 860Q895 812 969 713T1044 475Q1044 304 964 189T729 25V-238H492V12Q328 51 239 165T148 453L416 452Z" />
18
+ <glyph unicode="%" glyph-name="percent" horiz-adv-x="1796" d="M90 1126Q90 1198 117 1263T197 1380Q248 1431 312 1458T449 1485Q521 1485 586 1458T702 1380Q754 1329 781 1264T809 1126Q809 1054 782 989T702 872Q652 822 587 795T449 768Q377 768 313 795T197
19
+ 872Q145 924 118 989T90 1126ZM281 1126Q281 1056 329 1009T449 961Q520 961 568 1008T616 1126Q616 1197 568 1245T449 1294Q378 1294 330 1246T281 1126ZM1208 1485H1370L592 -31H430L1208 1485ZM1178 330Q1178 259 1226 211T1346 162Q1416 162 1464 210T1513
20
+ 330Q1513 400 1465 449T1346 498Q1275 498 1227 449T1178 330ZM987 330Q987 402 1014 467T1092 584Q1142 634 1207 661T1346 688Q1418 688 1483 661T1599 584Q1650 533 1677 468T1704 330Q1704 257 1678 192T1599 76Q1549 25 1484 -2T1346 -29Q1273 -29 1208 -2T1092
21
+ 76Q1041 126 1014 191T987 330Z" />
22
+ <glyph unicode="&amp;" glyph-name="ampersand" horiz-adv-x="1333" d="M893 244Q822 110 717 40T481 -31Q299 -31 174 96T49 408Q49 529 111 630T307 825Q221 909 187 976T152 1120Q152 1274 257 1379T516 1485Q651 1485 751 1382T852 1141Q852 1045 797 962T633
23
+ 809L840 616L975 969H1233L1026 459L1358 170L1186 -23L893 244ZM705 410L463 639Q380 590 341 535T301 410Q301 330 351 277T477 223Q548 223 605 270T705 410ZM496 961Q561 995 593 1035T625 1126Q625 1176 590 1212T506 1249Q453 1249 420 1215T387 1122Q387
24
+ 1079 412 1042T496 961Z" />
25
+ <glyph unicode="&apos;" glyph-name="quotesingle" horiz-adv-x="334" d="M86 1436H250V879H86V1436Z" />
26
+ <glyph unicode="(" glyph-name="parenleft" horiz-adv-x="606" d="M526 1485V1208Q435 1149 398 1064T360 809V233Q360 65 397 -21T526 -166V-442Q312 -367 203 -214T94 168V874Q94 1102 203 1256T526 1485Z" />
27
+ <glyph unicode=")" glyph-name="parenright" horiz-adv-x="606" d="M80 1485Q295 1410 403 1256T512 874V168Q512 -60 404 -213T80 -442V-166Q171 -107 208 -21T246 233V809Q246 978 209 1063T80 1208V1485Z" />
28
+ <glyph unicode="*" glyph-name="asterisk" horiz-adv-x="1024" d="M510 907L332 655L186 756L381 1004L94 1083L147 1253L424 1161V1456H596V1161L868 1253L930 1083L641 1006L831 756L688 651L510 907Z" />
29
+ <glyph unicode="+" glyph-name="plus" horiz-adv-x="1706" d="M768 1221H938V694H1452V528H938V0H768V528H254V694H768V1221Z" />
30
+ <glyph unicode="," glyph-name="comma" horiz-adv-x="596" d="M426 274V14Q426 -127 365 -193T170 -262V-115Q216 -109 235 -86T254 -10V0H170V274H426Z" />
31
+ <glyph unicode="-" glyph-name="hyphen" horiz-adv-x="696" d="M606 668V432H90V668H606Z" />
32
+ <glyph unicode="." glyph-name="period" horiz-adv-x="596" d="M426 0H170V274H426V0Z" />
33
+ <glyph unicode="/" glyph-name="slash" horiz-adv-x="569" d="M94 -190H-45L432 1456H569L94 -190Z" />
34
+ <glyph unicode="0" glyph-name="zero" horiz-adv-x="1190" d="M371 948V510Q371 368 425 300T594 231Q709 231 764 301T819 518V969Q819 1031 814 1062T795 1116Q764 1168 713 1196T596 1225Q484 1225 428 1156T371 948ZM86 946Q86 1082 107 1155T176 1290Q251
35
+ 1389 355 1437T596 1485Q724 1485 831 1435T1018 1286Q1063 1230 1083 1150T1104 942V510Q1104 374 1083 300T1014 164Q939 66 836 19T594 -29Q466 -29 359 21T172 170Q127 226 107 305T86 512V946Z" />
36
+ <glyph unicode="1" glyph-name="one" horiz-adv-x="1190" d="M778 0H504V1241H250V1456H778V0Z" />
37
+ <glyph unicode="2" glyph-name="two" horiz-adv-x="1190" d="M1069 0H109V272L637 766Q712 836 750 904T788 1034Q788 1116 736 1169T600 1223Q512 1223 464 1166T416 1006V981H129V985Q129 1210 260 1346T606 1483Q805 1483 940 1352T1075 1032Q1075 928 1022
38
+ 829T858 631L451 262H1069V0Z" />
39
+ <glyph unicode="3" glyph-name="three" horiz-adv-x="1190" d="M115 467H387V457Q387 355 442 293T586 231Q684 231 745 300T807 481Q807 594 739 651T537 709Q531 709 517 708T496 707V948Q503 948 516 947T535 946Q626 946 668 982T711 1096Q711 1160 678 1195T586
40
+ 1231Q533 1231 504 1195T471 1092H219Q219 1269 324 1377T602 1485Q755 1485 862 1378T969 1122Q969 1033 934 967T825 850Q950 794 1011 697T1073 457Q1073 362 1043 283T950 131Q875 45 793 8T594 -29Q369 -29 242 101T115 461V467Z" />
41
+ <glyph unicode="4" glyph-name="four" horiz-adv-x="1190" d="M727 463V1071L340 463H727ZM977 0H727V221H88V463L717 1456H977V463H1100V221H977V0Z" />
42
+ <glyph unicode="5" glyph-name="five" horiz-adv-x="1190" d="M961 1456V1204H461L416 954Q461 980 511 993T616 1006Q817 1006 958 856T1100 494Q1100 398 1067 311T969 150Q892 60 794 15T580 -31Q373 -31 231 103T70 453H344Q356 355 421 294T578 233Q678 233
43
+ 744 307T811 496Q811 609 744 678T567 748Q501 748 454 722T377 643L135 698L274 1456H961Z" />
44
+ <glyph unicode="6" glyph-name="six" horiz-adv-x="1190" d="M356 494Q356 385 426 309T594 233Q698 233 764 303T831 485Q831 596 766 666T598 737Q498 737 427 665T356 494ZM604 1456H901L571 958Q610 967 635 970T682 973Q861 973 985 831T1110 483Q1110 398
45
+ 1077 309T985 152Q906 59 813 16T594 -27Q489 -27 396 11T231 121Q159 193 121 282T82 467Q82 575 124 684T287 975L604 1456Z" />
46
+ <glyph unicode="7" glyph-name="seven" horiz-adv-x="1190" d="M518 0H227L770 1200H201V1456H1034V1186L518 0Z" />
47
+ <glyph unicode="8" glyph-name="eight" horiz-adv-x="1190" d="M459 1090Q459 1027 496 988T594 948Q658 948 694 987T731 1094Q731 1158 694 1198T596 1239Q536 1239 498 1198T459 1090ZM393 432Q393 343 450 283T590 223Q679 223 737 283T795 434Q795 531 739
48
+ 588T588 645Q499 645 446 587T393 432ZM340 813Q262 861 219 936T176 1100Q176 1258 297 1371T590 1485Q771 1485 892 1374T1014 1098Q1014 1006 971 934T844 813Q964 752 1022 661T1081 444Q1081 236 944 104T588 -29Q383 -29 246 106T109 444Q109 563 165 652T340
49
+ 813Z" />
50
+ <glyph unicode="9" glyph-name="nine" horiz-adv-x="1190" d="M836 961Q836 1070 766 1146T598 1223Q495 1223 428 1152T360 969Q360 859 426 788T594 717Q694 717 765 789T836 961ZM588 0H291L621 496Q582 488 557 485T510 481Q331 481 207 624T82 973Q82 1057
51
+ 115 1145T207 1303Q286 1396 380 1439T598 1483Q703 1483 796 1445T961 1335Q1032 1264 1071 1173T1110 987Q1110 879 1068 770T905 479L588 0Z" />
52
+ <glyph unicode=":" glyph-name="colon" horiz-adv-x="627" d="M440 778H184V1053H440V778ZM440 0H184V274H440V0Z" />
53
+ <glyph unicode=";" glyph-name="semicolon" horiz-adv-x="627" d="M440 274V14Q440 -127 379 -193T185 -262L184 -115Q232 -109 251 -86T270 -10V0H184V274H440ZM440 778H184V1053H440V778Z" />
54
+ <glyph unicode="&lt;" glyph-name="less" horiz-adv-x="1706" d="M1442 1176V991L508 610L1442 229V47L264 530V690L1442 1176Z" />
55
+ <glyph unicode="=" glyph-name="equal" horiz-adv-x="1706" d="M254 487H1452V322H254V487ZM254 901H1452V733H254V901Z" />
56
+ <glyph unicode="&gt;" glyph-name="greater" horiz-adv-x="1706" d="M264 1176L1442 690V530L264 47V229L1198 610L264 991V1176Z" />
57
+ <glyph unicode="?" glyph-name="question" horiz-adv-x="1042" d="M387 397Q387 492 418 573T522 748Q536 766 585 814T662 899Q680 923 688 952T696 1020Q696 1117 646 1172T506 1227Q427 1227 379 1169T330 1012H62Q63 1221 192 1353T522 1485Q723 1485 854
58
+ 1358T985 1036Q985 866 825 722Q803 702 793 692Q712 617 679 551T643 398L387 397ZM387 0V274H643V0H387Z" />
59
+ <glyph unicode="@" glyph-name="at" horiz-adv-x="2048" d="M1174 283Q1119 196 1046 156T870 115Q718 115 638 201T557 451Q557 684 695 846T1028 1008Q1117 1008 1177 974T1276 866L1331 973H1485L1337 387Q1336 382 1335 375Q1329 347 1329 338Q1329 300 1355
60
+ 277T1425 254Q1476 254 1532 284T1638 369Q1710 445 1748 546T1786 762Q1786 1015 1599 1173T1110 1331Q972 1331 854 1300T639 1206Q458 1093 360 915T262 520Q262 208 471 21T1030 -166Q1196 -166 1353 -117T1645 25L1712 -74Q1563 -187 1394 -244T1038 -301Q846
61
+ -301 687 -253T406 -111Q251 7 175 164T98 522Q98 687 150 835T303 1108Q450 1287 656 1380T1116 1473Q1282 1473 1431 1428T1686 1300Q1818 1198 1884 1065T1950 764Q1950 602 1885 462T1700 225Q1631 170 1550 142T1382 113Q1276 113 1225 153T1174 279V283ZM1233
62
+ 707Q1219 791 1172 837T1049 883Q922 883 832 755T741 444Q741 346 786 293T915 240Q1005 240 1078 306T1178 479L1233 707Z" />
63
+ <glyph unicode="A" glyph-name="A" horiz-adv-x="1233" d="M778 575L606 1044L430 575H778ZM332 305L219 0H-76L489 1456H735L1292 0H987L872 305H332Z" />
64
+ <glyph unicode="B" glyph-name="B" horiz-adv-x="1053" d="M401 870H434Q552 870 610 912T668 1040Q668 1122 613 1161T442 1200H401V870ZM401 256H487Q617 256 678 299T739 434Q739 533 675 584T487 635H401V256ZM127 0V1456H440Q535 1456 591 1449T690 1423Q810
65
+ 1374 874 1282T938 1067Q938 965 900 893T788 784Q896 752 958 661T1020 444Q1020 342 982 253T877 104Q810 48 727 24T492 0H127Z" />
66
+ <glyph unicode="C" glyph-name="C" horiz-adv-x="1540" d="M1489 1024H1141Q1079 1108 994 1150T799 1192Q711 1192 632 1159T492 1063Q427 997 392 911T356 733Q356 533 484 398T799 262Q906 262 991 302T1130 418H1479Q1377 195 1207 83T801 -29Q637 -29 499
67
+ 34T250 221Q157 324 109 455T61 737Q61 889 119 1025T289 1274Q395 1378 524 1431T803 1485Q1042 1485 1211 1371T1489 1024Z" />
68
+ <glyph unicode="D" glyph-name="D" horiz-adv-x="1403" d="M598 250Q835 250 947 366T1059 729Q1059 956 937 1082T594 1208H408V250H598ZM616 0H121V1456H608Q806 1456 925 1416T1141 1282Q1244 1182 1297 1040T1350 721Q1350 523 1276 367T1061 109Q981 50 882
69
+ 25T616 0Z" />
70
+ <glyph unicode="E" glyph-name="E" horiz-adv-x="1024" d="M907 0H121V1456H907V1200H403V868H907V616H403V256H907V0Z" />
71
+ <glyph unicode="F" glyph-name="F" horiz-adv-x="985" d="M121 0V1456H907V1200H403V868H907V616H403V0H121Z" />
72
+ <glyph unicode="G" glyph-name="G" horiz-adv-x="1612" d="M1554 774Q1554 766 1555 750T1556 725Q1556 631 1539 551T1487 399Q1384 194 1207 83T805 -29Q640 -29 500 34T248 221Q155 325 106 457T57 737Q57 889 116 1025T289 1274Q397 1381 529 1433T823 1485Q1058
73
+ 1485 1229 1370T1493 1034H1147Q1084 1113 999 1152T807 1192Q620 1192 490 1057T360 729Q360 533 491 399T815 264Q948 264 1056 336T1217 530H645V774H1554Z" />
74
+ <glyph unicode="H" glyph-name="H" horiz-adv-x="1280" d="M406 592V0H121V1456H406V866H874V1456H1159V0H874V592H406Z" />
75
+ <glyph unicode="I" glyph-name="I" horiz-adv-x="530" d="M123 0V1456H408V0H123Z" />
76
+ <glyph unicode="J" glyph-name="J" horiz-adv-x="924" d="M805 498Q805 351 790 276T739 145Q686 61 598 16T397 -29Q204 -29 102 79T0 393H283V389Q283 327 312 293T395 258Q463 258 491 316T520 520V1456H805V498Z" />
77
+ <glyph unicode="K" glyph-name="K" horiz-adv-x="1139" d="M410 723L850 1456H1167L700 733L1167 0H850L410 723ZM406 0H121V1456H406V0Z" />
78
+ <glyph unicode="L" glyph-name="L" horiz-adv-x="901" d="M860 0H121V1456H403V256H860V0Z" />
79
+ <glyph unicode="M" glyph-name="M" horiz-adv-x="1735" d="M403 0H121V1456H498L868 397L1237 1456H1614V0H1333L1343 1057L975 0H760L391 1057L403 0Z" />
80
+ <glyph unicode="N" glyph-name="N" horiz-adv-x="1395" d="M401 0H121V1456H391L993 526V1456H1272V0H1008L401 958V0Z" />
81
+ <glyph unicode="O" glyph-name="O" horiz-adv-x="1612" d="M356 741Q356 647 387 566T479 418Q546 345 631 306T807 266Q998 266 1127 402T1257 741Q1257 927 1127 1058T813 1190Q622 1190 489 1059T356 741ZM57 731Q57 851 89 957T184 1157Q292 1314 455 1399T811
82
+ 1485Q956 1485 1090 1429T1331 1268Q1440 1159 1497 1023T1554 737Q1554 581 1501 444T1343 201Q1238 90 1099 31T807 -29Q644 -29 507 29T264 201Q162 309 110 443T57 731Z" />
83
+ <glyph unicode="P" glyph-name="P" horiz-adv-x="1053" d="M406 805H481Q600 805 663 856T727 1004Q727 1103 666 1151T479 1200H406V805ZM406 0H121V1456H483Q621 1456 700 1441T829 1393Q919 1332 970 1232T1022 1018Q1022 809 884 684T512 559H406V0Z" />
84
+ <glyph unicode="Q" glyph-name="Q" horiz-adv-x="1612" d="M1155 444Q1207 500 1233 571T1260 729Q1260 927 1129 1062T805 1198Q618 1198 486 1061T354 733Q354 715 357 697T367 657Q415 673 461 680T553 688Q713 688 860 629T1155 444ZM439 465Q506 370 602
85
+ 319T813 268Q856 268 900 277T991 305Q864 389 749 430T524 471Q503 471 482 470T439 465ZM1192 80Q1108 25 1009 -3T799 -31Q675 -31 559 11T340 133Q202 243 130 398T57 737Q57 888 116 1025T289 1274Q394 1378 525 1431T807 1485Q962 1485 1095 1432T1335 1272Q1449
86
+ 1161 1506 1023T1563 721Q1563 578 1519 460T1384 246Q1423 227 1465 218T1554 209H1583V-23Q1577 -23 1565 -24T1546 -25Q1459 -25 1371 1T1192 80Z" />
87
+ <glyph unicode="R" glyph-name="R" horiz-adv-x="1165" d="M406 748H469Q642 748 731 810T821 993Q821 1109 746 1164T512 1219H406V748ZM406 0H121V1456H467Q632 1456 712 1445T850 1407Q974 1349 1039 1245T1104 1001Q1104 832 1011 715T758 565L1122 0H782L406 676V0Z" />
88
+ <glyph unicode="S" glyph-name="S" horiz-adv-x="981" d="M33 452L293 453V432Q293 340 341 285T469 229Q555 229 605 280T655 420Q655 561 453 622Q427 630 412 635Q242 688 160 785T78 1032Q78 1237 191 1361T494 1485Q671 1485 776 1375T893 1065H635V1077Q635
89
+ 1147 593 1190T483 1233Q413 1233 373 1189T332 1069Q332 1037 340 1013T367 968Q408 923 543 885Q603 869 635 858Q785 807 856 712T928 469Q928 244 803 108T471 -29Q276 -29 156 103T33 452Z" />
90
+ <glyph unicode="T" glyph-name="T" horiz-adv-x="858" d="M846 1456V1200H571V0H287V1200H12V1456H846Z" />
91
+ <glyph unicode="U" glyph-name="U" horiz-adv-x="1180" d="M121 1456H406V616Q406 419 447 343T590 266Q691 266 732 342T774 616V1456H1059V532Q1059 378 1042 301T985 166Q917 66 821 19T590 -29Q455 -29 359 18T195 166Q155 224 138 296T121 532V1456Z" />
92
+ <glyph unicode="V" glyph-name="V" horiz-adv-x="1161" d="M682 0H479L-43 1456H262L580 485L899 1456H1202L682 0Z" />
93
+ <glyph unicode="W" glyph-name="W" horiz-adv-x="1726" d="M-31 1456H260L500 512L764 1456H961L1225 512L1464 1456H1755L1333 0H1106L862 909L616 0H391L-31 1456Z" />
94
+ <glyph unicode="X" glyph-name="X" horiz-adv-x="1200" d="M600 512L305 0H-16L451 735L-4 1456H317L600 950L881 1456H1202L750 735L1214 0H893L600 512Z" />
95
+ <glyph unicode="Y" glyph-name="Y" horiz-adv-x="1010" d="M643 524V0H358V524L-59 1456H254L506 829L756 1456H1067L643 524Z" />
96
+ <glyph unicode="Z" glyph-name="Z" horiz-adv-x="973" d="M942 0H29V252L604 1186H70V1456H928V1223L342 270H942V0Z" />
97
+ <glyph unicode="[" glyph-name="bracketleft" horiz-adv-x="606" d="M371 1229V-182H559V-410H115V1456H559V1229H371Z" />
98
+ <glyph unicode="\" glyph-name="backslash" horiz-adv-x="569" d="M475 -190L0 1456H137L612 -190H475Z" />
99
+ <glyph unicode="]" glyph-name="bracketright" horiz-adv-x="606" d="M238 1229H47V1456H494V-410H47V-182H238V1229Z" />
100
+ <glyph unicode="^" glyph-name="asciicircum" horiz-adv-x="2048" d="M915 1460H1133L1628 899H1421L1024 1296L625 899H418L915 1460Z" />
101
+ <glyph unicode="_" glyph-name="underscore" horiz-adv-x="1024" d="M0 -311H1024V-483H0V-311Z" />
102
+ <glyph unicode="`" glyph-name="grave" horiz-adv-x="1024" d="M659 1243H528L233 1591H455L659 1243Z" />
103
+ <glyph unicode="a" glyph-name="a" horiz-adv-x="1319" d="M309 559Q309 420 401 327T627 233Q748 233 840 327T932 547Q932 681 840 777T623 874Q493 874 401 783T309 559ZM961 0V135Q915 53 832 14T618 -25Q374 -25 211 141T47 555Q47 671 88 775T205 958Q287
104
+ 1045 387 1086T612 1128Q732 1128 818 1088T958 967V1100H1208V0H961Z" />
105
+ <glyph unicode="b" glyph-name="b" horiz-adv-x="1319" d="M358 545Q358 411 447 318T662 225Q805 225 899 317T993 549Q993 682 900 778T674 874Q540 874 449 780T358 545ZM348 1012Q419 1071 502 1098T692 1126Q802 1126 899 1089T1071 981Q1160 899 1208 788T1257
106
+ 553Q1257 421 1204 304T1051 100Q978 37 886 4T690 -29Q592 -29 508 0T348 90V0H96V1456H348V1012Z" />
107
+ <glyph unicode="c" glyph-name="c" horiz-adv-x="1241" d="M905 709Q859 795 788 838T618 881Q488 881 401 787T313 551Q313 411 402 318T627 225Q731 225 800 269T903 403H1176Q1126 201 981 86T629 -29Q507 -29 403 14T215 143Q137 223 93 330T49 549Q49 665
108
+ 89 766T207 948Q293 1039 401 1086T633 1133Q835 1133 983 1018T1178 709H905Z" />
109
+ <glyph unicode="d" glyph-name="d" horiz-adv-x="1319" d="M958 545Q958 686 869 780T645 874Q513 874 420 778T326 549Q326 410 420 318T657 225Q783 225 870 318T958 545ZM969 1012V1456H1221V0H969V90Q893 30 809 1T627 -29Q523 -29 431 4T266 100Q166 186
110
+ 113 303T59 553Q59 675 108 787T248 981Q323 1052 420 1089T627 1126Q733 1126 815 1099T969 1012Z" />
111
+ <glyph unicode="e" glyph-name="e" horiz-adv-x="1241" d="M920 672Q887 782 810 839T614 897Q512 897 431 835T322 672H920ZM313 469Q326 350 407 282T618 213Q704 213 772 249T881 350H1157Q1087 170 948 71T625 -29Q502 -29 399 14T213 143Q135 224 92 330T49
112
+ 549Q49 664 88 765T205 948Q289 1037 395 1085T614 1133Q757 1133 881 1068T1092 885Q1145 814 1170 726T1196 524Q1196 515 1195 497T1194 469H313Z" />
113
+ <glyph unicode="f" glyph-name="f" horiz-adv-x="606" d="M596 1100V872H412V0H164V872H33V1100H156V1130Q156 1304 252 1389T543 1475Q551 1475 568 1474T596 1473V1243H578Q491 1243 454 1215T416 1120V1100H596Z" />
114
+ <glyph unicode="g" glyph-name="g" horiz-adv-x="1319" d="M985 1100H1214V182Q1214 -104 1062 -267T643 -430Q444 -430 310 -337T113 -59H360Q400 -133 474 -175T639 -217Q792 -217 887 -118T983 145V156Q909 79 814 40T606 0Q496 0 398 38T223 147Q141 225 94
115
+ 333T47 553Q47 803 205 965T606 1128Q717 1128 810 1089T985 969V1100ZM301 569Q301 425 397 328T635 231Q764 231 862 329T961 557Q961 698 864 797T633 897Q495 897 398 802T301 569Z" />
116
+ <glyph unicode="h" glyph-name="h" horiz-adv-x="1194" d="M365 1456V975Q421 1050 493 1086T659 1122Q865 1122 975 996T1085 631V0H829V485Q829 711 779 791T602 872Q474 872 418 782T362 471V0H115V1456H365Z" />
117
+ <glyph unicode="i" glyph-name="i" horiz-adv-x="479" d="M365 1212H115V1456H365V1212ZM115 0V1100H365V0H115Z" />
118
+ <glyph unicode="j" glyph-name="j" horiz-adv-x="502" d="M367 1100V39Q367 -200 300 -278T51 -356Q24 -356 10 -356T-16 -354V-106H-8Q68 -106 93 -75T119 90V1100H367ZM367 1212H119V1456H367V1212Z" />
119
+ <glyph unicode="k" glyph-name="k" horiz-adv-x="1014" d="M360 0H113V1456H360V590L717 1100H1006L625 578L1081 0H760L360 559V0Z" />
120
+ <glyph unicode="l" glyph-name="l" horiz-adv-x="479" d="M115 0V1456H365V0H115Z" />
121
+ <glyph unicode="m" glyph-name="m" horiz-adv-x="1901" d="M365 1100V975Q421 1050 493 1086T659 1122Q792 1122 886 1075T1049 928Q1114 1026 1195 1074T1374 1122Q1576 1122 1684 995T1792 631V0H1540V487Q1540 711 1491 791T1319 872Q1192 872 1138 782T1083
122
+ 471V0H829V487Q829 710 779 791T602 872Q474 872 418 782T362 471V0H115V1100H365Z" />
123
+ <glyph unicode="n" glyph-name="n" horiz-adv-x="1194" d="M365 1100V975Q421 1050 493 1086T659 1122Q778 1122 866 1077T1014 942Q1052 882 1068 806T1085 582V0H829V487Q829 708 778 790T602 872Q474 872 418 782T362 471V0H115V1100H365Z" />
124
+ <glyph unicode="o" glyph-name="o" horiz-adv-x="1247" d="M311 557Q311 404 395 315T623 225Q765 225 849 316T934 563Q934 702 846 791T623 881Q485 881 398 791T311 557ZM47 555Q47 671 89 775T213 961Q296 1044 400 1088T616 1133Q735 1133 835 1094T1020
125
+ 975Q1106 892 1153 784T1200 561Q1200 435 1159 331T1036 143Q954 58 849 15T621 -29Q497 -29 395 15T209 147Q129 233 88 336T47 555Z" />
126
+ <glyph unicode="p" glyph-name="p" horiz-adv-x="1319" d="M358 555Q358 414 449 320T674 225Q806 225 899 321T993 551Q993 690 899 782T662 874Q536 874 447 782T358 555ZM348 88V-356H96V1100H348V1008Q425 1069 509 1098T690 1128Q794 1128 886 1096T1051
127
+ 999Q1150 913 1203 796T1257 547Q1257 424 1209 312T1071 119Q995 47 898 9T692 -29Q587 -29 504 -1T348 88Z" />
128
+ <glyph unicode="q" glyph-name="q" horiz-adv-x="1319" d="M958 555Q958 689 871 781T657 874Q514 874 420 782T326 551Q326 417 419 321T645 225Q779 225 868 319T958 555ZM969 88Q896 28 814 0T627 -29Q519 -29 422 9T248 119Q158 201 109 313T59 547Q59 679
129
+ 112 796T266 999Q339 1063 431 1095T627 1128Q724 1128 808 1099T969 1008V1100H1221V-356H969V88Z" />
130
+ <glyph unicode="r" glyph-name="r" horiz-adv-x="616" d="M627 877Q478 865 419 799T360 561V0H104V1100H344V973Q402 1047 471 1081T627 1116V877Z" />
131
+ <glyph unicode="s" glyph-name="s" horiz-adv-x="834" d="M281 365V350Q281 277 318 232T414 186Q470 186 505 220T541 307Q541 356 515 387T422 451Q384 468 310 498T215 545Q154 595 125 656T96 797Q96 936 193 1032T430 1128Q577 1128 662 1043T756 805H526V811Q526
132
+ 864 499 894T422 924Q379 924 351 895T322 821Q322 749 470 687Q509 671 530 662Q672 598 724 525T776 326Q776 172 672 72T410 -29Q251 -29 154 77T47 364L281 365Z" />
133
+ <glyph unicode="t" glyph-name="t" horiz-adv-x="627" d="M193 0V872H25V1100H193V1456H449V1100H618V872H449V0H193Z" />
134
+ <glyph unicode="u" glyph-name="u" horiz-adv-x="1194" d="M829 0V119Q773 44 701 8T535 -29Q328 -29 217 98T106 463V1100H365V606Q365 383 416 301T592 219Q720 219 775 311T831 623V1100H1083V0H829Z" />
135
+ <glyph unicode="v" glyph-name="v" horiz-adv-x="995" d="M592 0H391L-27 1100H246L502 369L766 1100H1032L592 0Z" />
136
+ <glyph unicode="w" glyph-name="w" horiz-adv-x="1442" d="M719 666L532 0H365L-16 1100H260L438 465L633 1100H821L1006 465L1184 1100H1460L1077 0H909L719 666Z" />
137
+ <glyph unicode="x" glyph-name="x" horiz-adv-x="934" d="M459 350L231 0H-49L324 571L-6 1100H281L471 786L666 1100H965L614 578L969 0H678L459 350Z" />
138
+ <glyph unicode="y" glyph-name="y" horiz-adv-x="1049" d="M-23 1100H248L516 332L811 1100H1079L485 -356H221L375 31L-23 1100Z" />
139
+ <glyph unicode="z" glyph-name="z" horiz-adv-x="862" d="M35 0V236L526 862H76V1100H801V825L344 246H831V0H35Z" />
140
+ <glyph unicode="{" glyph-name="braceleft" horiz-adv-x="1024" d="M874 1477V1298Q866 1298 850 1299T827 1300Q718 1300 680 1259T641 1085V844Q641 689 597 624T438 530Q552 503 596 438T641 217V-23Q641 -155 680 -197T829 -240Q836 -240 851 -239T874 -238V-414H811Q709
141
+ -414 646 -402T539 -365Q482 -331 459 -269T436 -66V182Q436 326 384 385T205 444Q198 444 184 443T162 442V621Q169 621 183 620T205 618Q331 618 383 677T436 879V1126Q436 1271 459 1332T539 1427Q583 1454 648 1465T829 1477H874Z" />
142
+ <glyph unicode="|" glyph-name="bar" horiz-adv-x="1024" d="M424 1565H602V-483H424V1565Z" />
143
+ <glyph unicode="}" glyph-name="braceright" horiz-adv-x="1024" d="M152 1477H197Q312 1477 376 1466T485 1427Q542 1394 565 1332T588 1126V879Q588 735 640 677T819 618Q825 618 840 619T862 621V442Q855 442 841 443T819 444Q693 444 641 385T588 182V-66Q588
144
+ -209 565 -270T485 -365Q442 -391 377 -402T197 -414H152V-238Q160 -238 175 -239T197 -240Q306 -240 344 -198T383 -23V217Q383 370 428 436T588 530Q473 558 428 623T383 844V1085Q383 1217 345 1258T199 1300Q192 1300 176 1299T152 1298V1477Z" />
145
+ <glyph unicode="~" glyph-name="asciitilde" horiz-adv-x="1706" d="M1530 784V600Q1427 529 1333 494T1149 459Q1105 459 1057 467T958 494Q933 502 882 520Q670 594 563 594Q481 594 389 556T178 434V621Q284 693 380 728T565 764Q627 764 690 752T859 704Q872
146
+ 700 901 689Q1065 631 1151 631Q1236 631 1328 668T1530 784Z" />
147
+ <glyph unicode="&#xa0;" glyph-name="uni00A0" horiz-adv-x="1190" />
148
+ </font>
149
+ </defs>
150
+ </svg>
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ <h1>Test File</h1>
@@ -0,0 +1 @@
1
+ // Test File
Binary file
Binary file
@@ -0,0 +1 @@
1
+ /* Test File */
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'pathname'
5
+
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+ require 'wand'
9
+
10
+ FilePath = Pathname(File.dirname(__FILE__)).join('files')
11
+
12
+ class Test::Unit::TestCase
13
+ end
@@ -0,0 +1,48 @@
1
+ require 'helper'
2
+
3
+ class TestWand < Test::Unit::TestCase
4
+ context "Wand" do
5
+ setup do
6
+ Wand.executable = `which file`.chomp
7
+ end
8
+
9
+ {
10
+ 'AVGARDD.svg' => 'image/svg+xml',
11
+ 'compressed.zip' => 'application/zip',
12
+ 'favicon.ico' => 'image/vnd.microsoft.icon',
13
+ 'index.html' => 'text/html',
14
+ 'jquery.js' => 'application/javascript',
15
+ 'ol_tiny.jpg' => 'image/jpeg',
16
+ 'ol_tiny.png' => 'image/png',
17
+ 'styles.css' => 'text/css',
18
+ }.each_pair do |name, type|
19
+ should "use mime type gem if it returns type #{name}" do
20
+ assert_equal type, Wand.wave(FilePath.join(name).expand_path.to_s)
21
+ end
22
+ end
23
+
24
+ {
25
+ 'example.m4r' => 'audio/mp4',
26
+ 'AVGARDD.eot' => 'application/octet-stream',
27
+ 'AVGARDD.ttf' => 'application/octet-stream',
28
+ 'AVGARDD.woff' => 'application/octet-stream',
29
+ }.each_pair do |name, type|
30
+ should "fall back to unix file command when mime type returns nothing for #{name}" do
31
+ assert_equal type, Wand.wave(FilePath.join(name).expand_path.to_s)
32
+ end
33
+ end
34
+
35
+ should "return nil when mime type and file fail" do
36
+ assert_nil Wand.wave('AVGARDD.eot')
37
+ end
38
+
39
+ should "detect executable" do
40
+ assert_equal '/usr/bin/file', Wand.executable
41
+ end
42
+
43
+ should "allow setting the executable" do
44
+ Wand.executable = '/usr/local/bin/file'
45
+ assert_equal '/usr/local/bin/file', Wand.executable
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wand
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - John Nunemaker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-06 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mime-types
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: shoulda
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: yard
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: Mime-Type gem with fallback to unix file command
46
+ email: nunemaker@gmail.com
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - LICENSE
53
+ - README.rdoc
54
+ files:
55
+ - .document
56
+ - .gitignore
57
+ - LICENSE
58
+ - README.rdoc
59
+ - Rakefile
60
+ - lib/wand.rb
61
+ - test/files/AVGARDD.eot
62
+ - test/files/AVGARDD.svg
63
+ - test/files/AVGARDD.ttf
64
+ - test/files/AVGARDD.woff
65
+ - test/files/compressed.zip
66
+ - test/files/example.m4r
67
+ - test/files/favicon.ico
68
+ - test/files/index.html
69
+ - test/files/jquery.js
70
+ - test/files/ol_tiny.jpg
71
+ - test/files/ol_tiny.png
72
+ - test/files/styles.css
73
+ - test/helper.rb
74
+ - test/test_wand.rb
75
+ has_rdoc: true
76
+ homepage: http://github.com/jnunemaker/wand
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options:
81
+ - --charset=UTF-8
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ version:
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: "0"
95
+ version:
96
+ requirements: []
97
+
98
+ rubyforge_project:
99
+ rubygems_version: 1.3.5
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: Mime-Type gem with fallback to unix file command
103
+ test_files:
104
+ - test/helper.rb
105
+ - test/test_wand.rb