apex 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67fa319a7be6930bdb57ed1225ec9a85ac34e58c
4
- data.tar.gz: c2145e383269e800c13a603ad9b4169684cf5a45
3
+ metadata.gz: ce45f0aec4d74e65e47922ac190a3fef79f56eab
4
+ data.tar.gz: 6579046109fa9cbaacf4373092d810baec911fc6
5
5
  SHA512:
6
- metadata.gz: 556f7b5edc3cadf511de37be894a3f575d2e9a63efa9294b54e0f8989d7c8c372682890110779e63e252b7c06f04bc6cf9a44335de6a9ab9717a8f22b89de236
7
- data.tar.gz: 494d533192637b923e3e62f58c735c1b64214402467c38cc208cbde1325888c691af1be6ed42e5bb0265a250773d8abdc149eae28eb12187e6f5976c1b4ab247
6
+ metadata.gz: 9c38ee0ee8204bbcb7dc262dd41ffc62c49d4f91845eeee5890cc755f3ebacc12535561aee3a1708307abbd728b742cae5156cc63138afd481772d01815c36d1
7
+ data.tar.gz: 0befa085c338f2df86f5fcf12e147562a433482ef9840cbc1f6c92f421bad17d61d50be494f2a542ccbdcaea4bb0d76214ebbb8281e7555aa0c8e1fd644536f6
data/README.md CHANGED
@@ -11,7 +11,7 @@ what you think [on Twitter](http://twitter.com/jamonholmgren).
11
11
 
12
12
  ```ruby
13
13
  # In Gemfile:
14
- gem 'apex', :git => 'https://github.com/clearsightstudio/apex.git
14
+ gem 'apex', :git => 'https://github.com/clearsightstudio/apex.git'
15
15
 
16
16
  # In Terminal:
17
17
  bundle install
@@ -0,0 +1,698 @@
1
+ module Apex
2
+
3
+ class MimeTypes
4
+ def self.for(extension)
5
+ lookup = full_list[extension]
6
+ lookup.nil? ? 'text/html' : lookup
7
+ end
8
+
9
+ def self.full_list
10
+ {
11
+ '.x3d' => 'application/vnd.hzn-3d-crossword',
12
+ '.3gp' => 'video/3gpp',
13
+ '.3g2' => 'video/3gpp2',
14
+ '.mseq' => 'application/vnd.mseq',
15
+ '.pwn' => 'application/vnd.3m.post-it-notes',
16
+ '.plb' => 'application/vnd.3gpp.pic-bw-large',
17
+ '.psb' => 'application/vnd.3gpp.pic-bw-small',
18
+ '.pvb' => 'application/vnd.3gpp.pic-bw-var',
19
+ '.tcap' => 'application/vnd.3gpp2.tcap',
20
+ '.7z' => 'application/x-7z-compressed',
21
+ '.abw' => 'application/x-abiword',
22
+ '.ace' => 'application/x-ace-compressed',
23
+ '.acc' => 'application/vnd.americandynamics.acc',
24
+ '.acu' => 'application/vnd.acucobol',
25
+ '.atc' => 'application/vnd.acucorp',
26
+ '.adp' => 'audio/adpcm',
27
+ '.aab' => 'application/x-authorware-bin',
28
+ '.aam' => 'application/x-authorware-map',
29
+ '.aas' => 'application/x-authorware-seg',
30
+ '.air' => 'application/vnd.adobe.air-application-installer-package+zip',
31
+ '.swf' => 'application/x-shockwave-flash',
32
+ '.fxp' => 'application/vnd.adobe.fxp',
33
+ '.pdf' => 'application/pdf',
34
+ '.ppd' => 'application/vnd.cups-ppd',
35
+ '.dir' => 'application/x-director',
36
+ '.xdp' => 'application/vnd.adobe.xdp+xml',
37
+ '.xfdf' => 'application/vnd.adobe.xfdf',
38
+ '.aac' => 'audio/x-aac',
39
+ '.ahead' => 'application/vnd.ahead.space',
40
+ '.azf' => 'application/vnd.airzip.filesecure.azf',
41
+ '.azs' => 'application/vnd.airzip.filesecure.azs',
42
+ '.azw' => 'application/vnd.amazon.ebook',
43
+ '.ami' => 'application/vnd.amiga.ami',
44
+ '.apk' => 'application/vnd.android.package-archive',
45
+ '.cii' => 'application/vnd.anser-web-certificate-issue-initiation',
46
+ '.fti' => 'application/vnd.anser-web-funds-transfer-initiation',
47
+ '.atx' => 'application/vnd.antix.game-component',
48
+ '.mpkg' => 'application/vnd.apple.installer+xml',
49
+ '.aw' => 'application/applixware',
50
+ '.les' => 'application/vnd.hhe.lesson-player',
51
+ '.swi' => 'application/vnd.aristanetworks.swi',
52
+ '.s' => 'text/x-asm',
53
+ '.atomcat' => 'application/atomcat+xml',
54
+ '.atomsvc' => 'application/atomsvc+xml',
55
+ '.atom' => 'application/atom+xml',
56
+ '.ac' => 'application/pkix-attr-cert',
57
+ '.aif' => 'audio/x-aiff',
58
+ '.avi' => 'video/x-msvideo',
59
+ '.aep' => 'application/vnd.audiograph',
60
+ '.dxf' => 'image/vnd.dxf',
61
+ '.dwf' => 'model/vnd.dwf',
62
+ '.par' => 'text/plain-bas',
63
+ '.bcpio' => 'application/x-bcpio',
64
+ '.bin' => 'application/octet-stream',
65
+ '.bmp' => 'image/bmp',
66
+ '.torrent' => 'application/x-bittorrent',
67
+ '.cod' => 'application/vnd.rim.cod',
68
+ '.mpm' => 'application/vnd.blueice.multipass',
69
+ '.bmi' => 'application/vnd.bmi',
70
+ '.sh' => 'application/x-sh',
71
+ '.btif' => 'image/prs.btif',
72
+ '.rep' => 'application/vnd.businessobjects',
73
+ '.bz' => 'application/x-bzip',
74
+ '.bz2' => 'application/x-bzip2',
75
+ '.csh' => 'application/x-csh',
76
+ '.c' => 'text/x-c',
77
+ '.cdxml' => 'application/vnd.chemdraw+xml',
78
+ '.css' => 'text/css',
79
+ '.cdx' => 'chemical/x-cdx',
80
+ '.cml' => 'chemical/x-cml',
81
+ '.csml' => 'chemical/x-csml',
82
+ '.cdbcmsg' => 'application/vnd.contact.cmsg',
83
+ '.cla' => 'application/vnd.claymore',
84
+ '.c4g' => 'application/vnd.clonk.c4group',
85
+ '.sub' => 'image/vnd.dvb.subtitle',
86
+ '.cdmia' => 'application/cdmi-capability',
87
+ '.cdmic' => 'application/cdmi-container',
88
+ '.cdmid' => 'application/cdmi-domain',
89
+ '.cdmio' => 'application/cdmi-object',
90
+ '.cdmiq' => 'application/cdmi-queue',
91
+ '.c11amc' => 'application/vnd.cluetrust.cartomobile-config',
92
+ '.c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg',
93
+ '.ras' => 'image/x-cmu-raster',
94
+ '.dae' => 'model/vnd.collada+xml',
95
+ '.csv' => 'text/csv',
96
+ '.cpt' => 'application/mac-compactpro',
97
+ '.wmlc' => 'application/vnd.wap.wmlc',
98
+ '.cgm' => 'image/cgm',
99
+ '.ice' => 'x-conference/x-cooltalk',
100
+ '.cmx' => 'image/x-cmx',
101
+ '.xar' => 'application/vnd.xara',
102
+ '.cmc' => 'application/vnd.cosmocaller',
103
+ '.cpio' => 'application/x-cpio',
104
+ '.clkx' => 'application/vnd.crick.clicker',
105
+ '.clkk' => 'application/vnd.crick.clicker.keyboard',
106
+ '.clkp' => 'application/vnd.crick.clicker.palette',
107
+ '.clkt' => 'application/vnd.crick.clicker.template',
108
+ '.clkw' => 'application/vnd.crick.clicker.wordbank',
109
+ '.wbs' => 'application/vnd.criticaltools.wbs+xml',
110
+ '.cryptonote' => 'application/vnd.rig.cryptonote',
111
+ '.cif' => 'chemical/x-cif',
112
+ '.cmdf' => 'chemical/x-cmdf',
113
+ '.cu' => 'application/cu-seeme',
114
+ '.cww' => 'application/prs.cww',
115
+ '.curl' => 'text/vnd.curl',
116
+ '.dcurl' => 'text/vnd.curl.dcurl',
117
+ '.mcurl' => 'text/vnd.curl.mcurl',
118
+ '.scurl' => 'text/vnd.curl.scurl',
119
+ '.car' => 'application/vnd.curl.car',
120
+ '.pcurl' => 'application/vnd.curl.pcurl',
121
+ '.cmp' => 'application/vnd.yellowriver-custom-menu',
122
+ '.dssc' => 'application/dssc+der',
123
+ '.xdssc' => 'application/dssc+xml',
124
+ '.deb' => 'application/x-debian-package',
125
+ '.uva' => 'audio/vnd.dece.audio',
126
+ '.uvi' => 'image/vnd.dece.graphic',
127
+ '.uvh' => 'video/vnd.dece.hd',
128
+ '.uvm' => 'video/vnd.dece.mobile',
129
+ '.uvu' => 'video/vnd.uvvu.mp4',
130
+ '.uvp' => 'video/vnd.dece.pd',
131
+ '.uvs' => 'video/vnd.dece.sd',
132
+ '.uvv' => 'video/vnd.dece.video',
133
+ '.dvi' => 'application/x-dvi',
134
+ '.seed' => 'application/vnd.fdsn.seed',
135
+ '.dtb' => 'application/x-dtbook+xml',
136
+ '.res' => 'application/x-dtbresource+xml',
137
+ '.ait' => 'application/vnd.dvb.ait',
138
+ '.svc' => 'application/vnd.dvb.service',
139
+ '.eol' => 'audio/vnd.digital-winds',
140
+ '.djvu' => 'image/vnd.djvu',
141
+ '.dtd' => 'application/xml-dtd',
142
+ '.mlp' => 'application/vnd.dolby.mlp',
143
+ '.wad' => 'application/x-doom',
144
+ '.dpg' => 'application/vnd.dpgraph',
145
+ '.dra' => 'audio/vnd.dra',
146
+ '.dfac' => 'application/vnd.dreamfactory',
147
+ '.dts' => 'audio/vnd.dts',
148
+ '.dtshd' => 'audio/vnd.dts.hd',
149
+ '.dwg' => 'image/vnd.dwg',
150
+ '.geo' => 'application/vnd.dynageo',
151
+ '.es' => 'application/ecmascript',
152
+ '.mag' => 'application/vnd.ecowin.chart',
153
+ '.mmr' => 'image/vnd.fujixerox.edmics-mmr',
154
+ '.rlc' => 'image/vnd.fujixerox.edmics-rlc',
155
+ '.exi' => 'application/exi',
156
+ '.mgz' => 'application/vnd.proteus.magazine',
157
+ '.epub' => 'application/epub+zip',
158
+ '.eml' => 'message/rfc822',
159
+ '.nml' => 'application/vnd.enliven',
160
+ '.xpr' => 'application/vnd.is-xpr',
161
+ '.xif' => 'image/vnd.xiff',
162
+ '.xfdl' => 'application/vnd.xfdl',
163
+ '.emma' => 'application/emma+xml',
164
+ '.ez2' => 'application/vnd.ezpix-album',
165
+ '.ez3' => 'application/vnd.ezpix-package',
166
+ '.fst' => 'image/vnd.fst',
167
+ '.fvt' => 'video/vnd.fvt',
168
+ '.fbs' => 'image/vnd.fastbidsheet',
169
+ '.fe_launch' => 'application/vnd.denovo.fcselayout-link',
170
+ '.f4v' => 'video/x-f4v',
171
+ '.flv' => 'video/x-flv',
172
+ '.fpx' => 'image/vnd.fpx',
173
+ '.npx' => 'image/vnd.net-fpx',
174
+ '.flx' => 'text/vnd.fmi.flexstor',
175
+ '.fli' => 'video/x-fli',
176
+ '.ftc' => 'application/vnd.fluxtime.clip',
177
+ '.fdf' => 'application/vnd.fdf',
178
+ '.f' => 'text/x-fortran',
179
+ '.mif' => 'application/vnd.mif',
180
+ '.fm' => 'application/vnd.framemaker',
181
+ '.fh' => 'image/x-freehand',
182
+ '.fsc' => 'application/vnd.fsc.weblaunch',
183
+ '.fnc' => 'application/vnd.frogans.fnc',
184
+ '.ltf' => 'application/vnd.frogans.ltf',
185
+ '.ddd' => 'application/vnd.fujixerox.ddd',
186
+ '.xdw' => 'application/vnd.fujixerox.docuworks',
187
+ '.xbd' => 'application/vnd.fujixerox.docuworks.binder',
188
+ '.oas' => 'application/vnd.fujitsu.oasys',
189
+ '.oa2' => 'application/vnd.fujitsu.oasys2',
190
+ '.oa3' => 'application/vnd.fujitsu.oasys3',
191
+ '.fg5' => 'application/vnd.fujitsu.oasysgp',
192
+ '.bh2' => 'application/vnd.fujitsu.oasysprs',
193
+ '.spl' => 'application/x-futuresplash',
194
+ '.fzs' => 'application/vnd.fuzzysheet',
195
+ '.g3' => 'image/g3fax',
196
+ '.gmx' => 'application/vnd.gmx',
197
+ '.gtw' => 'model/vnd.gtw',
198
+ '.txd' => 'application/vnd.genomatix.tuxedo',
199
+ '.ggb' => 'application/vnd.geogebra.file',
200
+ '.ggt' => 'application/vnd.geogebra.tool',
201
+ '.gdl' => 'model/vnd.gdl',
202
+ '.gex' => 'application/vnd.geometry-explorer',
203
+ '.gxt' => 'application/vnd.geonext',
204
+ '.g2w' => 'application/vnd.geoplan',
205
+ '.g3w' => 'application/vnd.geospace',
206
+ '.gsf' => 'application/x-font-ghostscript',
207
+ '.bdf' => 'application/x-font-bdf',
208
+ '.gtar' => 'application/x-gtar',
209
+ '.texinfo' => 'application/x-texinfo',
210
+ '.gnumeric' => 'application/x-gnumeric',
211
+ '.kml' => 'application/vnd.google-earth.kml+xml',
212
+ '.kmz' => 'application/vnd.google-earth.kmz',
213
+ '.gqf' => 'application/vnd.grafeq',
214
+ '.gif' => 'image/gif',
215
+ '.gv' => 'text/vnd.graphviz',
216
+ '.gac' => 'application/vnd.groove-account',
217
+ '.ghf' => 'application/vnd.groove-help',
218
+ '.gim' => 'application/vnd.groove-identity-message',
219
+ '.grv' => 'application/vnd.groove-injector',
220
+ '.gtm' => 'application/vnd.groove-tool-message',
221
+ '.tpl' => 'application/vnd.groove-tool-template',
222
+ '.vcg' => 'application/vnd.groove-vcard',
223
+ '.h261' => 'video/h261',
224
+ '.h263' => 'video/h263',
225
+ '.h264' => 'video/h264',
226
+ '.hpid' => 'application/vnd.hp-hpid',
227
+ '.hps' => 'application/vnd.hp-hps',
228
+ '.hdf' => 'application/x-hdf',
229
+ '.rip' => 'audio/vnd.rip',
230
+ '.hbci' => 'application/vnd.hbci',
231
+ '.jlt' => 'application/vnd.hp-jlyt',
232
+ '.pcl' => 'application/vnd.hp-pcl',
233
+ '.hpgl' => 'application/vnd.hp-hpgl',
234
+ '.hvs' => 'application/vnd.yamaha.hv-script',
235
+ '.hvd' => 'application/vnd.yamaha.hv-dic',
236
+ '.hvp' => 'application/vnd.yamaha.hv-voice',
237
+ '.sfd-hdstx' => 'application/vnd.hydrostatix.sof-data',
238
+ '.stk' => 'application/hyperstudio',
239
+ '.hal' => 'application/vnd.hal+xml',
240
+ '.html' => 'text/html',
241
+ '.irm' => 'application/vnd.ibm.rights-management',
242
+ '.sc' => 'application/vnd.ibm.secure-container',
243
+ '.ics' => 'text/calendar',
244
+ '.icc' => 'application/vnd.iccprofile',
245
+ '.ico' => 'image/x-icon',
246
+ '.igl' => 'application/vnd.igloader',
247
+ '.ief' => 'image/ief',
248
+ '.ivp' => 'application/vnd.immervision-ivp',
249
+ '.ivu' => 'application/vnd.immervision-ivu',
250
+ '.rif' => 'application/reginfo+xml',
251
+ '.3dml' => 'text/vnd.in3d.3dml',
252
+ '.spot' => 'text/vnd.in3d.spot',
253
+ '.igs' => 'model/iges',
254
+ '.i2g' => 'application/vnd.intergeo',
255
+ '.cdy' => 'application/vnd.cinderella',
256
+ '.xpw' => 'application/vnd.intercon.formnet',
257
+ '.fcs' => 'application/vnd.isac.fcs',
258
+ '.ipfix' => 'application/ipfix',
259
+ '.cer' => 'application/pkix-cert',
260
+ '.pki' => 'application/pkixcmp',
261
+ '.crl' => 'application/pkix-crl',
262
+ '.pkipath' => 'application/pkix-pkipath',
263
+ '.igm' => 'application/vnd.insors.igm',
264
+ '.rcprofile' => 'application/vnd.ipunplugged.rcprofile',
265
+ '.irp' => 'application/vnd.irepository.package+xml',
266
+ '.jad' => 'text/vnd.sun.j2me.app-descriptor',
267
+ '.jar' => 'application/java-archive',
268
+ '.class' => 'application/java-vm',
269
+ '.jnlp' => 'application/x-java-jnlp-file',
270
+ '.ser' => 'application/java-serialized-object',
271
+ 'java"' => '"text/x-java-source',
272
+ '.js' => 'application/javascript',
273
+ '.json' => 'application/json',
274
+ '.joda' => 'application/vnd.joost.joda-archive',
275
+ '.jpm' => 'video/jpm',
276
+ '.jpeg' => 'image/jpeg',
277
+ '.jpg' => 'image/jpeg',
278
+ '.jpgv' => 'video/jpeg',
279
+ '.ktz' => 'application/vnd.kahootz',
280
+ '.mmd' => 'application/vnd.chipnuts.karaoke-mmd',
281
+ '.karbon' => 'application/vnd.kde.karbon',
282
+ '.chrt' => 'application/vnd.kde.kchart',
283
+ '.kfo' => 'application/vnd.kde.kformula',
284
+ '.flw' => 'application/vnd.kde.kivio',
285
+ '.kon' => 'application/vnd.kde.kontour',
286
+ '.kpr' => 'application/vnd.kde.kpresenter',
287
+ '.ksp' => 'application/vnd.kde.kspread',
288
+ '.kwd' => 'application/vnd.kde.kword',
289
+ '.htke' => 'application/vnd.kenameaapp',
290
+ '.kia' => 'application/vnd.kidspiration',
291
+ '.kne' => 'application/vnd.kinar',
292
+ '.sse' => 'application/vnd.kodak-descriptor',
293
+ '.lasxml' => 'application/vnd.las.las+xml',
294
+ '.latex' => 'application/x-latex',
295
+ '.lbd' => 'application/vnd.llamagraphics.life-balance.desktop',
296
+ '.lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml',
297
+ '.jam' => 'application/vnd.jam',
298
+ '0.123' => 'application/vnd.lotus-1-2-3',
299
+ '.apr' => 'application/vnd.lotus-approach',
300
+ '.pre' => 'application/vnd.lotus-freelance',
301
+ '.nsf' => 'application/vnd.lotus-notes',
302
+ '.org' => 'application/vnd.lotus-organizer',
303
+ '.scm' => 'application/vnd.lotus-screencam',
304
+ '.lwp' => 'application/vnd.lotus-wordpro',
305
+ '.lvp' => 'audio/vnd.lucent.voice',
306
+ '.m3u' => 'audio/x-mpegurl',
307
+ '.m4v' => 'video/x-m4v',
308
+ '.hqx' => 'application/mac-binhex40',
309
+ '.portpkg' => 'application/vnd.macports.portpkg',
310
+ '.mgp' => 'application/vnd.osgeo.mapguide.package',
311
+ '.mrc' => 'application/marc',
312
+ '.mrcx' => 'application/marcxml+xml',
313
+ '.mxf' => 'application/mxf',
314
+ '.nbp' => 'application/vnd.wolfram.player',
315
+ '.ma' => 'application/mathematica',
316
+ '.mathml' => 'application/mathml+xml',
317
+ '.mbox' => 'application/mbox',
318
+ '.mc1' => 'application/vnd.medcalcdata',
319
+ '.mscml' => 'application/mediaservercontrol+xml',
320
+ '.cdkey' => 'application/vnd.mediastation.cdkey',
321
+ '.mwf' => 'application/vnd.mfer',
322
+ '.mfm' => 'application/vnd.mfmp',
323
+ '.msh' => 'model/mesh',
324
+ '.mads' => 'application/mads+xml',
325
+ '.mets' => 'application/mets+xml',
326
+ '.mods' => 'application/mods+xml',
327
+ '.meta4' => 'application/metalink4+xml',
328
+ '.potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12',
329
+ '.docm' => 'application/vnd.ms-word.document.macroenabled.12',
330
+ '.dotm' => 'application/vnd.ms-word.template.macroenabled.12',
331
+ '.mcd' => 'application/vnd.mcd',
332
+ '.flo' => 'application/vnd.micrografx.flo',
333
+ '.igx' => 'application/vnd.micrografx.igx',
334
+ '.es3' => 'application/vnd.eszigno3+xml',
335
+ '.mdb' => 'application/x-msaccess',
336
+ '.asf' => 'video/x-ms-asf',
337
+ '.exe' => 'application/x-msdownload',
338
+ '.cil' => 'application/vnd.ms-artgalry',
339
+ '.cab' => 'application/vnd.ms-cab-compressed',
340
+ '.ims' => 'application/vnd.ms-ims',
341
+ '.application' => 'application/x-ms-application',
342
+ '.clp' => 'application/x-msclip',
343
+ '.mdi' => 'image/vnd.ms-modi',
344
+ '.eot' => 'application/vnd.ms-fontobject',
345
+ '.xls' => 'application/vnd.ms-excel',
346
+ '.xlam' => 'application/vnd.ms-excel.addin.macroenabled.12',
347
+ '.xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
348
+ '.xltm' => 'application/vnd.ms-excel.template.macroenabled.12',
349
+ '.xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12',
350
+ '.chm' => 'application/vnd.ms-htmlhelp',
351
+ '.crd' => 'application/x-mscardfile',
352
+ '.lrm' => 'application/vnd.ms-lrm',
353
+ '.mvb' => 'application/x-msmediaview',
354
+ '.mny' => 'application/x-msmoney',
355
+ '.pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
356
+ '.sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
357
+ '.ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
358
+ '.potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
359
+ '.xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
360
+ '.xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
361
+ '.docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
362
+ '.dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
363
+ '.obd' => 'application/x-msbinder',
364
+ '.thmx' => 'application/vnd.ms-officetheme',
365
+ '.onetoc' => 'application/onenote',
366
+ '.pya' => 'audio/vnd.ms-playready.media.pya',
367
+ '.pyv' => 'video/vnd.ms-playready.media.pyv',
368
+ '.ppt' => 'application/vnd.ms-powerpoint',
369
+ '.ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12',
370
+ '.sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12',
371
+ '.pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
372
+ '.ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
373
+ '.mpp' => 'application/vnd.ms-project',
374
+ '.pub' => 'application/x-mspublisher',
375
+ '.scd' => 'application/x-msschedule',
376
+ '.xap' => 'application/x-silverlight-app',
377
+ '.stl' => 'application/vnd.ms-pki.stl',
378
+ '.cat' => 'application/vnd.ms-pki.seccat',
379
+ '.vsd' => 'application/vnd.visio',
380
+ '.wm' => 'video/x-ms-wm',
381
+ '.wma' => 'audio/x-ms-wma',
382
+ '.wax' => 'audio/x-ms-wax',
383
+ '.wmx' => 'video/x-ms-wmx',
384
+ '.wmd' => 'application/x-ms-wmd',
385
+ '.wpl' => 'application/vnd.ms-wpl',
386
+ '.wmz' => 'application/x-ms-wmz',
387
+ '.wmv' => 'video/x-ms-wmv',
388
+ '.wvx' => 'video/x-ms-wvx',
389
+ '.wmf' => 'application/x-msmetafile',
390
+ '.trm' => 'application/x-msterminal',
391
+ '.doc' => 'application/msword',
392
+ '.wri' => 'application/x-mswrite',
393
+ '.wps' => 'application/vnd.ms-works',
394
+ '.xbap' => 'application/x-ms-xbap',
395
+ '.xps' => 'application/vnd.ms-xpsdocument',
396
+ '.mid' => 'audio/midi',
397
+ '.mpy' => 'application/vnd.ibm.minipay',
398
+ '.afp' => 'application/vnd.ibm.modcap',
399
+ '.rms' => 'application/vnd.jcp.javame.midlet-rms',
400
+ '.tmo' => 'application/vnd.tmobile-livetv',
401
+ '.prc' => 'application/x-mobipocket-ebook',
402
+ '.mbk' => 'application/vnd.mobius.mbk',
403
+ '.dis' => 'application/vnd.mobius.dis',
404
+ '.plc' => 'application/vnd.mobius.plc',
405
+ '.mqy' => 'application/vnd.mobius.mqy',
406
+ '.msl' => 'application/vnd.mobius.msl',
407
+ '.txf' => 'application/vnd.mobius.txf',
408
+ '.daf' => 'application/vnd.mobius.daf',
409
+ '.fly' => 'text/vnd.fly',
410
+ '.mpc' => 'application/vnd.mophun.certificate',
411
+ '.mpn' => 'application/vnd.mophun.application',
412
+ '.mj2' => 'video/mj2',
413
+ '.mpga' => 'audio/mpeg',
414
+ '.mxu' => 'video/vnd.mpegurl',
415
+ '.mpeg' => 'video/mpeg',
416
+ '.m21' => 'application/mp21',
417
+ '.mp4a' => 'audio/mp4',
418
+ '.mp4' => 'video/mp4',
419
+ '.mp4' => 'application/mp4',
420
+ '.m3u8' => 'application/vnd.apple.mpegurl',
421
+ '.mus' => 'application/vnd.musician',
422
+ '.msty' => 'application/vnd.muvee.style',
423
+ '.mxml' => 'application/xv+xml',
424
+ '.ngdat' => 'application/vnd.nokia.n-gage.data',
425
+ '.n-gage' => 'application/vnd.nokia.n-gage.symbian.install',
426
+ '.ncx' => 'application/x-dtbncx+xml',
427
+ '.nc' => 'application/x-netcdf',
428
+ '.nlu' => 'application/vnd.neurolanguage.nlu',
429
+ '.dna' => 'application/vnd.dna',
430
+ '.nnd' => 'application/vnd.noblenet-directory',
431
+ '.nns' => 'application/vnd.noblenet-sealer',
432
+ '.nnw' => 'application/vnd.noblenet-web',
433
+ '.rpst' => 'application/vnd.nokia.radio-preset',
434
+ '.rpss' => 'application/vnd.nokia.radio-presets',
435
+ '.n3' => 'text/n3',
436
+ '.edm' => 'application/vnd.novadigm.edm',
437
+ '.edx' => 'application/vnd.novadigm.edx',
438
+ '.ext' => 'application/vnd.novadigm.ext',
439
+ '.gph' => 'application/vnd.flographit',
440
+ '.ecelp4800' => 'audio/vnd.nuera.ecelp4800',
441
+ '.ecelp7470' => 'audio/vnd.nuera.ecelp7470',
442
+ '.ecelp9600' => 'audio/vnd.nuera.ecelp9600',
443
+ '.oda' => 'application/oda',
444
+ '.ogx' => 'application/ogg',
445
+ '.oga' => 'audio/ogg',
446
+ '.ogv' => 'video/ogg',
447
+ '.dd2' => 'application/vnd.oma.dd2+xml',
448
+ '.oth' => 'application/vnd.oasis.opendocument.text-web',
449
+ '.opf' => 'application/oebps-package+xml',
450
+ '.qbo' => 'application/vnd.intu.qbo',
451
+ '.oxt' => 'application/vnd.openofficeorg.extension',
452
+ '.osf' => 'application/vnd.yamaha.openscoreformat',
453
+ '.weba' => 'audio/webm',
454
+ '.webm' => 'video/webm',
455
+ '.odc' => 'application/vnd.oasis.opendocument.chart',
456
+ '.otc' => 'application/vnd.oasis.opendocument.chart-template',
457
+ '.odb' => 'application/vnd.oasis.opendocument.database',
458
+ '.odf' => 'application/vnd.oasis.opendocument.formula',
459
+ '.odft' => 'application/vnd.oasis.opendocument.formula-template',
460
+ '.odg' => 'application/vnd.oasis.opendocument.graphics',
461
+ '.otg' => 'application/vnd.oasis.opendocument.graphics-template',
462
+ '.odi' => 'application/vnd.oasis.opendocument.image',
463
+ '.oti' => 'application/vnd.oasis.opendocument.image-template',
464
+ '.odp' => 'application/vnd.oasis.opendocument.presentation',
465
+ '.otp' => 'application/vnd.oasis.opendocument.presentation-template',
466
+ '.ods' => 'application/vnd.oasis.opendocument.spreadsheet',
467
+ '.ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
468
+ '.odt' => 'application/vnd.oasis.opendocument.text',
469
+ '.odm' => 'application/vnd.oasis.opendocument.text-master',
470
+ '.ott' => 'application/vnd.oasis.opendocument.text-template',
471
+ '.ktx' => 'image/ktx',
472
+ '.sxc' => 'application/vnd.sun.xml.calc',
473
+ '.stc' => 'application/vnd.sun.xml.calc.template',
474
+ '.sxd' => 'application/vnd.sun.xml.draw',
475
+ '.std' => 'application/vnd.sun.xml.draw.template',
476
+ '.sxi' => 'application/vnd.sun.xml.impress',
477
+ '.sti' => 'application/vnd.sun.xml.impress.template',
478
+ '.sxm' => 'application/vnd.sun.xml.math',
479
+ '.sxw' => 'application/vnd.sun.xml.writer',
480
+ '.sxg' => 'application/vnd.sun.xml.writer.global',
481
+ '.stw' => 'application/vnd.sun.xml.writer.template',
482
+ '.otf' => 'application/x-font-otf',
483
+ '.osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml',
484
+ '.dp' => 'application/vnd.osgi.dp',
485
+ '.pdb' => 'application/vnd.palm',
486
+ '.p' => 'text/x-pascal',
487
+ '.paw' => 'application/vnd.pawaafile',
488
+ '.pclxl' => 'application/vnd.hp-pclxl',
489
+ '.efif' => 'application/vnd.picsel',
490
+ '.pcx' => 'image/x-pcx',
491
+ '.psd' => 'image/vnd.adobe.photoshop',
492
+ '.prf' => 'application/pics-rules',
493
+ '.pic' => 'image/x-pict',
494
+ '.chat' => 'application/x-chat',
495
+ '.p10' => 'application/pkcs10',
496
+ '.p12' => 'application/x-pkcs12',
497
+ '.p7m' => 'application/pkcs7-mime',
498
+ '.p7s' => 'application/pkcs7-signature',
499
+ '.p7r' => 'application/x-pkcs7-certreqresp',
500
+ '.p7b' => 'application/x-pkcs7-certificates',
501
+ '.p8' => 'application/pkcs8',
502
+ '.plf' => 'application/vnd.pocketlearn',
503
+ '.pnm' => 'image/x-portable-anymap',
504
+ '.pbm' => 'image/x-portable-bitmap',
505
+ '.pcf' => 'application/x-font-pcf',
506
+ '.pfr' => 'application/font-tdpfr',
507
+ '.pgn' => 'application/x-chess-pgn',
508
+ '.pgm' => 'image/x-portable-graymap',
509
+ '.png' => 'image/png',
510
+ '.ppm' => 'image/x-portable-pixmap',
511
+ '.pskcxml' => 'application/pskc+xml',
512
+ '.pml' => 'application/vnd.ctc-posml',
513
+ '.ai' => 'application/postscript',
514
+ '.pfa' => 'application/x-font-type1',
515
+ '.pbd' => 'application/vnd.powerbuilder6',
516
+ '.pgp' => 'application/pgp-signature',
517
+ '.box' => 'application/vnd.previewsystems.box',
518
+ '.ptid' => 'application/vnd.pvi.ptid1',
519
+ '.pls' => 'application/pls+xml',
520
+ '.str' => 'application/vnd.pg.format',
521
+ '.ei6' => 'application/vnd.pg.osasli',
522
+ '.dsc' => 'text/prs.lines.tag',
523
+ '.psf' => 'application/x-font-linux-psf',
524
+ '.qps' => 'application/vnd.publishare-delta-tree',
525
+ '.wg' => 'application/vnd.pmi.widget',
526
+ '.qxd' => 'application/vnd.quark.quarkxpress',
527
+ '.esf' => 'application/vnd.epson.esf',
528
+ '.msf' => 'application/vnd.epson.msf',
529
+ '.ssf' => 'application/vnd.epson.ssf',
530
+ '.qam' => 'application/vnd.epson.quickanime',
531
+ '.qfx' => 'application/vnd.intu.qfx',
532
+ '.qt' => 'video/quicktime',
533
+ '.rar' => 'application/x-rar-compressed',
534
+ '.ram' => 'audio/x-pn-realaudio',
535
+ '.rmp' => 'audio/x-pn-realaudio-plugin',
536
+ '.rsd' => 'application/rsd+xml',
537
+ '.rm' => 'application/vnd.rn-realmedia',
538
+ '.bed' => 'application/vnd.realvnc.bed',
539
+ '.mxl' => 'application/vnd.recordare.musicxml',
540
+ '.musicxml' => 'application/vnd.recordare.musicxml+xml',
541
+ '.rnc' => 'application/relax-ng-compact-syntax',
542
+ '.rdz' => 'application/vnd.data-vision.rdz',
543
+ '.rdf' => 'application/rdf+xml',
544
+ '.rp9' => 'application/vnd.cloanto.rp9',
545
+ '.jisp' => 'application/vnd.jisp',
546
+ '.rtf' => 'application/rtf',
547
+ '.rtx' => 'text/richtext',
548
+ '.link66' => 'application/vnd.route66.link66+xml',
549
+ '.rss' => 'application/rss+xml',
550
+ '.shf' => 'application/shf+xml',
551
+ '.st' => 'application/vnd.sailingtracker.track',
552
+ '.svg' => 'image/svg+xml',
553
+ '.sus' => 'application/vnd.sus-calendar',
554
+ '.sru' => 'application/sru+xml',
555
+ '.setpay' => 'application/set-payment-initiation',
556
+ '.setreg' => 'application/set-registration-initiation',
557
+ '.sema' => 'application/vnd.sema',
558
+ '.semd' => 'application/vnd.semd',
559
+ '.semf' => 'application/vnd.semf',
560
+ '.see' => 'application/vnd.seemail',
561
+ '.snf' => 'application/x-font-snf',
562
+ '.spq' => 'application/scvp-vp-request',
563
+ '.spp' => 'application/scvp-vp-response',
564
+ '.scq' => 'application/scvp-cv-request',
565
+ '.scs' => 'application/scvp-cv-response',
566
+ '.sdp' => 'application/sdp',
567
+ '.etx' => 'text/x-setext',
568
+ '.movie' => 'video/x-sgi-movie',
569
+ '.ifm' => 'application/vnd.shana.informed.formdata',
570
+ '.itp' => 'application/vnd.shana.informed.formtemplate',
571
+ '.iif' => 'application/vnd.shana.informed.interchange',
572
+ '.ipk' => 'application/vnd.shana.informed.package',
573
+ '.tfi' => 'application/thraud+xml',
574
+ '.shar' => 'application/x-shar',
575
+ '.rgb' => 'image/x-rgb',
576
+ '.slt' => 'application/vnd.epson.salt',
577
+ '.aso' => 'application/vnd.accpac.simply.aso',
578
+ '.imp' => 'application/vnd.accpac.simply.imp',
579
+ '.twd' => 'application/vnd.simtech-mindmapper',
580
+ '.csp' => 'application/vnd.commonspace',
581
+ '.saf' => 'application/vnd.yamaha.smaf-audio',
582
+ '.mmf' => 'application/vnd.smaf',
583
+ '.spf' => 'application/vnd.yamaha.smaf-phrase',
584
+ '.teacher' => 'application/vnd.smart.teacher',
585
+ '.svd' => 'application/vnd.svd',
586
+ '.rq' => 'application/sparql-query',
587
+ '.srx' => 'application/sparql-results+xml',
588
+ '.gram' => 'application/srgs',
589
+ '.grxml' => 'application/srgs+xml',
590
+ '.ssml' => 'application/ssml+xml',
591
+ '.skp' => 'application/vnd.koan',
592
+ '.sgml' => 'text/sgml',
593
+ '.sdc' => 'application/vnd.stardivision.calc',
594
+ '.sda' => 'application/vnd.stardivision.draw',
595
+ '.sdd' => 'application/vnd.stardivision.impress',
596
+ '.smf' => 'application/vnd.stardivision.math',
597
+ '.sdw' => 'application/vnd.stardivision.writer',
598
+ '.sgl' => 'application/vnd.stardivision.writer-global',
599
+ '.sm' => 'application/vnd.stepmania.stepchart',
600
+ '.sit' => 'application/x-stuffit',
601
+ '.sitx' => 'application/x-stuffitx',
602
+ '.sdkm' => 'application/vnd.solent.sdkm+xml',
603
+ '.xo' => 'application/vnd.olpc-sugar',
604
+ '.au' => 'audio/basic',
605
+ '.wqd' => 'application/vnd.wqd',
606
+ '.sis' => 'application/vnd.symbian.install',
607
+ '.smi' => 'application/smil+xml',
608
+ '.xsm' => 'application/vnd.syncml+xml',
609
+ '.bdm' => 'application/vnd.syncml.dm+wbxml',
610
+ '.xdm' => 'application/vnd.syncml.dm+xml',
611
+ '.sv4cpio' => 'application/x-sv4cpio',
612
+ '.sv4crc' => 'application/x-sv4crc',
613
+ '.sbml' => 'application/sbml+xml',
614
+ '.tsv' => 'text/tab-separated-values',
615
+ '.tiff' => 'image/tiff',
616
+ '.tao' => 'application/vnd.tao.intent-module-archive',
617
+ '.tar' => 'application/x-tar',
618
+ '.tcl' => 'application/x-tcl',
619
+ '.tex' => 'application/x-tex',
620
+ '.tfm' => 'application/x-tex-tfm',
621
+ '.tei' => 'application/tei+xml',
622
+ '.txt' => 'text/plain',
623
+ '.dxp' => 'application/vnd.spotfire.dxp',
624
+ '.sfs' => 'application/vnd.spotfire.sfs',
625
+ '.tsd' => 'application/timestamped-data',
626
+ '.tpt' => 'application/vnd.trid.tpt',
627
+ '.mxs' => 'application/vnd.triscape.mxs',
628
+ '.t' => 'text/troff',
629
+ '.tra' => 'application/vnd.trueapp',
630
+ '.ttf' => 'application/x-font-ttf',
631
+ '.ttl' => 'text/turtle',
632
+ '.umj' => 'application/vnd.umajin',
633
+ '.uoml' => 'application/vnd.uoml+xml',
634
+ '.unityweb' => 'application/vnd.unity',
635
+ '.ufd' => 'application/vnd.ufdl',
636
+ '.uri' => 'text/uri-list',
637
+ '.utz' => 'application/vnd.uiq.theme',
638
+ '.ustar' => 'application/x-ustar',
639
+ '.uu' => 'text/x-uuencode',
640
+ '.vcs' => 'text/x-vcalendar',
641
+ '.vcf' => 'text/x-vcard',
642
+ '.vcd' => 'application/x-cdlink',
643
+ '.vsf' => 'application/vnd.vsf',
644
+ '.wrl' => 'model/vrml',
645
+ '.vcx' => 'application/vnd.vcx',
646
+ '.mts' => 'model/vnd.mts',
647
+ '.vtu' => 'model/vnd.vtu',
648
+ '.vis' => 'application/vnd.visionary',
649
+ '.viv' => 'video/vnd.vivo',
650
+ '.vxml' => 'application/voicexml+xml',
651
+ '.src' => 'application/x-wais-source',
652
+ '.wbxml' => 'application/vnd.wap.wbxml',
653
+ '.wbmp' => 'image/vnd.wap.wbmp',
654
+ '.wav' => 'audio/x-wav',
655
+ '.davmount' => 'application/davmount+xml',
656
+ '.woff' => 'application/x-font-woff',
657
+ '.wspolicy' => 'application/wspolicy+xml',
658
+ '.webp' => 'image/webp',
659
+ '.wtb' => 'application/vnd.webturbo',
660
+ '.wgt' => 'application/widget',
661
+ '.hlp' => 'application/winhlp',
662
+ '.wml' => 'text/vnd.wap.wml',
663
+ '.wmls' => 'text/vnd.wap.wmlscript',
664
+ '.wmlsc' => 'application/vnd.wap.wmlscriptc',
665
+ '.wpd' => 'application/vnd.wordperfect',
666
+ '.stf' => 'application/vnd.wt.stf',
667
+ '.wsdl' => 'application/wsdl+xml',
668
+ '.xbm' => 'image/x-xbitmap',
669
+ '.xpm' => 'image/x-xpixmap',
670
+ '.xwd' => 'image/x-xwindowdump',
671
+ '.der' => 'application/x-x509-ca-cert',
672
+ '.fig' => 'application/x-xfig',
673
+ '.xhtml' => 'application/xhtml+xml',
674
+ '.xml' => 'application/xml',
675
+ '.xdf' => 'application/xcap-diff+xml',
676
+ '.xenc' => 'application/xenc+xml',
677
+ '.xer' => 'application/patch-ops-error+xml',
678
+ '.rl' => 'application/resource-lists+xml',
679
+ '.rs' => 'application/rls-services+xml',
680
+ '.rld' => 'application/resource-lists-diff+xml',
681
+ '.xslt' => 'application/xslt+xml',
682
+ '.xop' => 'application/xop+xml',
683
+ '.xpi' => 'application/x-xpinstall',
684
+ '.xspf' => 'application/xspf+xml',
685
+ '.xul' => 'application/vnd.mozilla.xul+xml',
686
+ '.xyz' => 'chemical/x-xyz',
687
+ '.yaml' => 'text/yaml',
688
+ '.yang' => 'application/yang',
689
+ '.yin' => 'application/yin+xml',
690
+ '.zir' => 'application/vnd.zul',
691
+ '.zip' => 'application/zip',
692
+ '.zmm' => 'application/vnd.handheld-entertainment+xml',
693
+ '.zaz' => 'application/vnd.zzazz.deck+xml'
694
+ }
695
+ end
696
+
697
+ end
698
+ end
@@ -2,6 +2,8 @@ module Apex
2
2
  class Server
3
3
  include DelegateInterface
4
4
 
5
+ attr_accessor :port
6
+
5
7
  def on_launch
6
8
  start_server
7
9
  end
@@ -26,13 +28,14 @@ module Apex
26
28
  end
27
29
 
28
30
  def add_app_handlers
31
+ verb_to_request_class = {:post => GCDWebServerURLEncodedFormRequest}
29
32
  [ :get, :post, :put, :patch, :delete ].each do |verb|
30
33
  self.server.addDefaultHandlerForMethod(verb.to_s.upcase,
31
- requestClass: GCDWebServerRequest,
34
+ requestClass: (verb_to_request_class[verb] ? verb_to_request_class[verb] : GCDWebServerRequest),
32
35
  processBlock: -> (raw_request) {
33
36
  layout = false
34
37
  request = Request.new(raw_request)
35
- if (routes_verb = self.routes[verb]) &&
38
+ if (routes_verb = self.routes[verb]) &&
36
39
  (request_path = routes_verb[request.path]) &&
37
40
  (response_block = request_path[:handler])
38
41
 
@@ -59,8 +62,18 @@ module Apex
59
62
  end
60
63
 
61
64
  else
62
- response = "<h1>404 not found</h1>"
63
- GCDWebServerDataResponse.responseWithHTML(apply_layout(response, layout))
65
+ file = NSBundle.mainBundle.pathForResource("assets", ofType: nil) + request.raw.path
66
+ if File.exists?(file)
67
+ ext = File.extname(file)
68
+ if MimeTypes.full_list.keys.include?(ext)
69
+ response = File.read(file)
70
+ GCDWebServerDataResponse.responseWithData(response.to_data, contentType: MimeTypes.for(ext))
71
+ else
72
+ GCDWebServerDataResponse.responseWithHTML(apply_layout("<h1>404 not found</h1>", layout))
73
+ end
74
+ else
75
+ GCDWebServerDataResponse.responseWithHTML(apply_layout("<h1>404 not found</h1>", layout))
76
+ end
64
77
  end
65
78
  }
66
79
  )
@@ -77,7 +90,15 @@ module Apex
77
90
  end
78
91
 
79
92
  def start
80
- server.startWithPort self.class.port, bonjourName: nil
93
+ server.startWithPort port, bonjourName: nil
94
+ end
95
+
96
+ def stop
97
+ server.stop
98
+ end
99
+
100
+ def port
101
+ @port ? @port : self.class.port
81
102
  end
82
103
 
83
104
  # Class methods *************************
@@ -124,4 +145,4 @@ module Apex
124
145
  end
125
146
 
126
147
  end
127
- end
148
+ end
@@ -1,3 +1,3 @@
1
1
  module Apex
2
- VERSION = "0.0.3" unless defined?(Apex::VERSION)
2
+ VERSION = "0.1.0" unless defined?(Apex::VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamon Holmgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-17 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: motion-cocoapods
@@ -49,6 +49,7 @@ files:
49
49
  - lib/apex.rb
50
50
  - lib/apex/apex.rb
51
51
  - lib/apex/cocoa/delegate_interface.rb
52
+ - lib/apex/mime_types.rb
52
53
  - lib/apex/request.rb
53
54
  - lib/apex/response.rb
54
55
  - lib/apex/server.rb
@@ -74,11 +75,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
75
  version: '0'
75
76
  requirements: []
76
77
  rubyforge_project:
77
- rubygems_version: 2.2.2
78
+ rubygems_version: 2.4.6
78
79
  signing_key:
79
80
  specification_version: 4
80
81
  summary: Apex is a RubyMotion web framework for OS X. It uses GCDWebServer under the
81
82
  hood and provides a Sinatra-like router and DSL.
82
83
  test_files:
83
84
  - spec/unit/request_get_spec.rb
84
- has_rdoc: