kinetic_sdk 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +7 -0
  2. data/GettingStarted.md +64 -0
  3. data/README.md +383 -0
  4. data/bin/console +12 -0
  5. data/bin/setup +8 -0
  6. data/gems/kontena-websocket-client-0.1.1/Gemfile +4 -0
  7. data/gems/kontena-websocket-client-0.1.1/LICENSE +190 -0
  8. data/gems/kontena-websocket-client-0.1.1/README.md +138 -0
  9. data/gems/kontena-websocket-client-0.1.1/Rakefile +6 -0
  10. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb +45 -0
  11. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark-em.rb +66 -0
  12. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark.rb +161 -0
  13. data/gems/kontena-websocket-client-0.1.1/benchmark/benchmark.sh +17 -0
  14. data/gems/kontena-websocket-client-0.1.1/benchmark/websocket-echo-server.go +207 -0
  15. data/gems/kontena-websocket-client-0.1.1/examples/websocket-echo-client.rb +80 -0
  16. data/gems/kontena-websocket-client-0.1.1/kontena-websocket-client.gemspec +24 -0
  17. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/client/connection.rb +119 -0
  18. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/client/version.rb +13 -0
  19. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/client.rb +848 -0
  20. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/error.rb +81 -0
  21. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/logging.rb +55 -0
  22. data/gems/kontena-websocket-client-0.1.1/lib/kontena/websocket/openssl_patch.rb +10 -0
  23. data/gems/kontena-websocket-client-0.1.1/lib/kontena-websocket-client.rb +15 -0
  24. data/gems/mime-types-3.1/Code-of-Conduct.rdoc +74 -0
  25. data/gems/mime-types-3.1/Contributing.rdoc +130 -0
  26. data/gems/mime-types-3.1/History.rdoc +658 -0
  27. data/gems/mime-types-3.1/Licence.rdoc +25 -0
  28. data/gems/mime-types-3.1/Manifest.txt +31 -0
  29. data/gems/mime-types-3.1/README.rdoc +202 -0
  30. data/gems/mime-types-3.1/Rakefile +254 -0
  31. data/gems/mime-types-3.1/lib/mime/type/columnar.rb +55 -0
  32. data/gems/mime-types-3.1/lib/mime/type.rb +573 -0
  33. data/gems/mime-types-3.1/lib/mime/types/_columnar.rb +135 -0
  34. data/gems/mime-types-3.1/lib/mime/types/cache.rb +56 -0
  35. data/gems/mime-types-3.1/lib/mime/types/columnar.rb +1 -0
  36. data/gems/mime-types-3.1/lib/mime/types/container.rb +30 -0
  37. data/gems/mime-types-3.1/lib/mime/types/deprecations.rb +32 -0
  38. data/gems/mime-types-3.1/lib/mime/types/full.rb +17 -0
  39. data/gems/mime-types-3.1/lib/mime/types/loader.rb +148 -0
  40. data/gems/mime-types-3.1/lib/mime/types/logger.rb +37 -0
  41. data/gems/mime-types-3.1/lib/mime/types/registry.rb +81 -0
  42. data/gems/mime-types-3.1/lib/mime/types.rb +228 -0
  43. data/gems/mime-types-3.1/lib/mime-types.rb +1 -0
  44. data/gems/mime-types-3.1/test/bad-fixtures/malformed +9 -0
  45. data/gems/mime-types-3.1/test/fixture/json.json +1 -0
  46. data/gems/mime-types-3.1/test/fixture/old-data +9 -0
  47. data/gems/mime-types-3.1/test/fixture/yaml.yaml +55 -0
  48. data/gems/mime-types-3.1/test/minitest_helper.rb +13 -0
  49. data/gems/mime-types-3.1/test/test_mime_type.rb +603 -0
  50. data/gems/mime-types-3.1/test/test_mime_types.rb +161 -0
  51. data/gems/mime-types-3.1/test/test_mime_types_cache.rb +109 -0
  52. data/gems/mime-types-3.1/test/test_mime_types_class.rb +155 -0
  53. data/gems/mime-types-3.1/test/test_mime_types_lazy.rb +43 -0
  54. data/gems/mime-types-3.1/test/test_mime_types_loader.rb +32 -0
  55. data/gems/mime-types-data-3.2016.0521/Code-of-Conduct.md +75 -0
  56. data/gems/mime-types-data-3.2016.0521/Contributing.md +157 -0
  57. data/gems/mime-types-data-3.2016.0521/History.md +351 -0
  58. data/gems/mime-types-data-3.2016.0521/Licence.md +25 -0
  59. data/gems/mime-types-data-3.2016.0521/Manifest.txt +18 -0
  60. data/gems/mime-types-data-3.2016.0521/README.md +61 -0
  61. data/gems/mime-types-data-3.2016.0521/Rakefile +80 -0
  62. data/gems/mime-types-data-3.2016.0521/data/mime-types.json +1 -0
  63. data/gems/mime-types-data-3.2016.0521/data/mime.content_type.column +1964 -0
  64. data/gems/mime-types-data-3.2016.0521/data/mime.docs.column +1964 -0
  65. data/gems/mime-types-data-3.2016.0521/data/mime.encoding.column +1964 -0
  66. data/gems/mime-types-data-3.2016.0521/data/mime.flags.column +1964 -0
  67. data/gems/mime-types-data-3.2016.0521/data/mime.friendly.column +1964 -0
  68. data/gems/mime-types-data-3.2016.0521/data/mime.pext.column +1964 -0
  69. data/gems/mime-types-data-3.2016.0521/data/mime.use_instead.column +1964 -0
  70. data/gems/mime-types-data-3.2016.0521/data/mime.xrefs.column +1964 -0
  71. data/gems/mime-types-data-3.2016.0521/lib/mime/types/data.rb +21 -0
  72. data/gems/mime-types-data-3.2016.0521/lib/mime-types-data.rb +3 -0
  73. data/gems/multipart-post-2.0.0/Gemfile +14 -0
  74. data/gems/multipart-post-2.0.0/History.txt +60 -0
  75. data/gems/multipart-post-2.0.0/Manifest.txt +9 -0
  76. data/gems/multipart-post-2.0.0/README.md +77 -0
  77. data/gems/multipart-post-2.0.0/Rakefile +9 -0
  78. data/gems/multipart-post-2.0.0/lib/composite_io.rb +108 -0
  79. data/gems/multipart-post-2.0.0/lib/multipart_post.rb +9 -0
  80. data/gems/multipart-post-2.0.0/lib/multipartable.rb +29 -0
  81. data/gems/multipart-post-2.0.0/lib/net/http/post/multipart.rb +27 -0
  82. data/gems/multipart-post-2.0.0/lib/parts.rb +96 -0
  83. data/gems/multipart-post-2.0.0/multipart-post.gemspec +22 -0
  84. data/gems/multipart-post-2.0.0/test/multibyte.txt +1 -0
  85. data/gems/multipart-post-2.0.0/test/net/http/post/test_multipart.rb +110 -0
  86. data/gems/multipart-post-2.0.0/test/test_composite_io.rb +115 -0
  87. data/gems/multipart-post-2.0.0/test/test_parts.rb +86 -0
  88. data/gems/parallel-1.12.1/MIT-LICENSE.txt +20 -0
  89. data/gems/parallel-1.12.1/lib/parallel/processor_count.rb +93 -0
  90. data/gems/parallel-1.12.1/lib/parallel/version.rb +3 -0
  91. data/gems/parallel-1.12.1/lib/parallel.rb +500 -0
  92. data/gems/ruby-progressbar-1.9.0/LICENSE.txt +19 -0
  93. data/gems/ruby-progressbar-1.9.0/README.md +38 -0
  94. data/gems/ruby-progressbar-1.9.0/Rakefile +2 -0
  95. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/base.rb +183 -0
  96. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/calculators/length.rb +99 -0
  97. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/calculators/running_average.rb +9 -0
  98. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/bar.rb +96 -0
  99. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/percentage.rb +29 -0
  100. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/rate.rb +43 -0
  101. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/time.rb +107 -0
  102. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components/title.rb +13 -0
  103. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/components.rb +5 -0
  104. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/errors/invalid_progress_error.rb +4 -0
  105. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format/formatter.rb +27 -0
  106. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format/molecule.rb +59 -0
  107. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format/string.rb +36 -0
  108. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/format.rb +3 -0
  109. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/output.rb +68 -0
  110. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/outputs/non_tty.rb +47 -0
  111. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/outputs/null.rb +33 -0
  112. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/outputs/tty.rb +32 -0
  113. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/progress.rb +118 -0
  114. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements/enumerator.rb +25 -0
  115. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/refinements.rb +1 -0
  116. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/throttle.rb +25 -0
  117. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/time.rb +30 -0
  118. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/timer.rb +72 -0
  119. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar/version.rb +3 -0
  120. data/gems/ruby-progressbar-1.9.0/lib/ruby-progressbar.rb +18 -0
  121. data/gems/slugify-1.0.7/README +18 -0
  122. data/gems/slugify-1.0.7/lib/slugify.rb +1012 -0
  123. data/gems/slugify-1.0.7/lib/slugify_string.rb +11 -0
  124. data/gems/slugify-1.0.7/tests/slugify_test.rb +116 -0
  125. data/gems/slugify-1.0.7/tests/string_slugify_test.rb +23 -0
  126. data/gems/websocket-driver-0.6.5/CHANGELOG.md +123 -0
  127. data/gems/websocket-driver-0.6.5/LICENSE.md +22 -0
  128. data/gems/websocket-driver-0.6.5/README.md +369 -0
  129. data/gems/websocket-driver-0.6.5/examples/tcp_server.rb +28 -0
  130. data/gems/websocket-driver-0.6.5/ext/websocket-driver/Makefile +264 -0
  131. data/gems/websocket-driver-0.6.5/ext/websocket-driver/WebsocketMaskService.java +55 -0
  132. data/gems/websocket-driver-0.6.5/ext/websocket-driver/extconf.rb +4 -0
  133. data/gems/websocket-driver-0.6.5/ext/websocket-driver/websocket_mask.bundle +0 -0
  134. data/gems/websocket-driver-0.6.5/ext/websocket-driver/websocket_mask.c +41 -0
  135. data/gems/websocket-driver-0.6.5/ext/websocket-driver/websocket_mask.o +0 -0
  136. data/gems/websocket-driver-0.6.5/lib/websocket/driver/client.rb +140 -0
  137. data/gems/websocket-driver-0.6.5/lib/websocket/driver/draft75.rb +102 -0
  138. data/gems/websocket-driver-0.6.5/lib/websocket/driver/draft76.rb +96 -0
  139. data/gems/websocket-driver-0.6.5/lib/websocket/driver/event_emitter.rb +54 -0
  140. data/gems/websocket-driver-0.6.5/lib/websocket/driver/headers.rb +45 -0
  141. data/gems/websocket-driver-0.6.5/lib/websocket/driver/hybi/frame.rb +20 -0
  142. data/gems/websocket-driver-0.6.5/lib/websocket/driver/hybi/message.rb +31 -0
  143. data/gems/websocket-driver-0.6.5/lib/websocket/driver/hybi.rb +406 -0
  144. data/gems/websocket-driver-0.6.5/lib/websocket/driver/proxy.rb +68 -0
  145. data/gems/websocket-driver-0.6.5/lib/websocket/driver/server.rb +80 -0
  146. data/gems/websocket-driver-0.6.5/lib/websocket/driver/stream_reader.rb +55 -0
  147. data/gems/websocket-driver-0.6.5/lib/websocket/driver.rb +199 -0
  148. data/gems/websocket-driver-0.6.5/lib/websocket/http/headers.rb +112 -0
  149. data/gems/websocket-driver-0.6.5/lib/websocket/http/request.rb +45 -0
  150. data/gems/websocket-driver-0.6.5/lib/websocket/http/response.rb +29 -0
  151. data/gems/websocket-driver-0.6.5/lib/websocket/http.rb +15 -0
  152. data/gems/websocket-driver-0.6.5/lib/websocket/mask.rb +14 -0
  153. data/gems/websocket-driver-0.6.5/lib/websocket/websocket_mask.rb +2 -0
  154. data/gems/websocket-driver-0.6.5/lib/websocket_mask.bundle +0 -0
  155. data/gems/websocket-driver-0.6.5-java/CHANGELOG.md +123 -0
  156. data/gems/websocket-driver-0.6.5-java/LICENSE.md +22 -0
  157. data/gems/websocket-driver-0.6.5-java/README.md +369 -0
  158. data/gems/websocket-driver-0.6.5-java/examples/tcp_server.rb +28 -0
  159. data/gems/websocket-driver-0.6.5-java/ext/websocket-driver/WebsocketMaskService.java +55 -0
  160. data/gems/websocket-driver-0.6.5-java/ext/websocket-driver/extconf.rb +4 -0
  161. data/gems/websocket-driver-0.6.5-java/ext/websocket-driver/websocket_mask.c +41 -0
  162. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/client.rb +140 -0
  163. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/draft75.rb +102 -0
  164. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/draft76.rb +96 -0
  165. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/event_emitter.rb +54 -0
  166. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/headers.rb +45 -0
  167. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/hybi/frame.rb +20 -0
  168. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/hybi/message.rb +31 -0
  169. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/hybi.rb +406 -0
  170. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/proxy.rb +68 -0
  171. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/server.rb +80 -0
  172. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver/stream_reader.rb +55 -0
  173. data/gems/websocket-driver-0.6.5-java/lib/websocket/driver.rb +199 -0
  174. data/gems/websocket-driver-0.6.5-java/lib/websocket/http/headers.rb +112 -0
  175. data/gems/websocket-driver-0.6.5-java/lib/websocket/http/request.rb +45 -0
  176. data/gems/websocket-driver-0.6.5-java/lib/websocket/http/response.rb +29 -0
  177. data/gems/websocket-driver-0.6.5-java/lib/websocket/http.rb +15 -0
  178. data/gems/websocket-driver-0.6.5-java/lib/websocket/mask.rb +14 -0
  179. data/gems/websocket-driver-0.6.5-java/lib/websocket/websocket_mask.rb +2 -0
  180. data/gems/websocket-driver-0.6.5-java/lib/websocket_mask.jar +0 -0
  181. data/gems/websocket-extensions-0.1.3/CHANGELOG.md +15 -0
  182. data/gems/websocket-extensions-0.1.3/LICENSE.md +20 -0
  183. data/gems/websocket-extensions-0.1.3/README.md +313 -0
  184. data/gems/websocket-extensions-0.1.3/lib/websocket/extensions/parser.rb +111 -0
  185. data/gems/websocket-extensions-0.1.3/lib/websocket/extensions.rb +181 -0
  186. data/lib/kinetic-sdk.rb +1 -0
  187. data/lib/kinetic_sdk/bridgehub/bridgehub-sdk.rb +80 -0
  188. data/lib/kinetic_sdk/bridgehub/lib/access_keys.rb +67 -0
  189. data/lib/kinetic_sdk/bridgehub/lib/bridge.rb +69 -0
  190. data/lib/kinetic_sdk/discussions/discussions-sdk.rb +165 -0
  191. data/lib/kinetic_sdk/discussions/lib/discussions.rb +107 -0
  192. data/lib/kinetic_sdk/discussions/lib/invitations.rb +120 -0
  193. data/lib/kinetic_sdk/discussions/lib/messages.rb +190 -0
  194. data/lib/kinetic_sdk/discussions/lib/meta.rb +14 -0
  195. data/lib/kinetic_sdk/discussions/lib/participants.rb +64 -0
  196. data/lib/kinetic_sdk/discussions/lib/related_items.rb +54 -0
  197. data/lib/kinetic_sdk/discussions/lib/websockets.rb +96 -0
  198. data/lib/kinetic_sdk/filehub/filehub-sdk.rb +80 -0
  199. data/lib/kinetic_sdk/filehub/lib/access_keys.rb +67 -0
  200. data/lib/kinetic_sdk/filehub/lib/filestores.rb +67 -0
  201. data/lib/kinetic_sdk/request_ce/lib/attribute_definitions.rb +153 -0
  202. data/lib/kinetic_sdk/request_ce/lib/bridges.rb +66 -0
  203. data/lib/kinetic_sdk/request_ce/lib/categories.rb +34 -0
  204. data/lib/kinetic_sdk/request_ce/lib/datastore_form.rb +110 -0
  205. data/lib/kinetic_sdk/request_ce/lib/datastore_submissions.rb +157 -0
  206. data/lib/kinetic_sdk/request_ce/lib/form.rb +99 -0
  207. data/lib/kinetic_sdk/request_ce/lib/form_types.rb +51 -0
  208. data/lib/kinetic_sdk/request_ce/lib/jwt.rb +55 -0
  209. data/lib/kinetic_sdk/request_ce/lib/kapp.rb +93 -0
  210. data/lib/kinetic_sdk/request_ce/lib/meta.rb +14 -0
  211. data/lib/kinetic_sdk/request_ce/lib/oauth.rb +37 -0
  212. data/lib/kinetic_sdk/request_ce/lib/security_policy_definitions.rb +157 -0
  213. data/lib/kinetic_sdk/request_ce/lib/space.rb +89 -0
  214. data/lib/kinetic_sdk/request_ce/lib/submissions.rb +215 -0
  215. data/lib/kinetic_sdk/request_ce/lib/system_api.rb +69 -0
  216. data/lib/kinetic_sdk/request_ce/lib/teams.rb +113 -0
  217. data/lib/kinetic_sdk/request_ce/lib/users.rb +245 -0
  218. data/lib/kinetic_sdk/request_ce/lib/webhook_jobs.rb +142 -0
  219. data/lib/kinetic_sdk/request_ce/lib/webhooks.rb +192 -0
  220. data/lib/kinetic_sdk/request_ce/request-ce-sdk.rb +153 -0
  221. data/lib/kinetic_sdk/task/lib/access_keys.rb +94 -0
  222. data/lib/kinetic_sdk/task/lib/categories.rb +190 -0
  223. data/lib/kinetic_sdk/task/lib/config.rb +202 -0
  224. data/lib/kinetic_sdk/task/lib/engine.rb +42 -0
  225. data/lib/kinetic_sdk/task/lib/environment.rb +14 -0
  226. data/lib/kinetic_sdk/task/lib/errors.rb +165 -0
  227. data/lib/kinetic_sdk/task/lib/groups.rb +112 -0
  228. data/lib/kinetic_sdk/task/lib/handlers.rb +105 -0
  229. data/lib/kinetic_sdk/task/lib/health.rb +28 -0
  230. data/lib/kinetic_sdk/task/lib/license.rb +52 -0
  231. data/lib/kinetic_sdk/task/lib/policy_rules.rb +166 -0
  232. data/lib/kinetic_sdk/task/lib/setup.rb +56 -0
  233. data/lib/kinetic_sdk/task/lib/sources.rb +134 -0
  234. data/lib/kinetic_sdk/task/lib/tasks.rb +17 -0
  235. data/lib/kinetic_sdk/task/lib/trees.rb +274 -0
  236. data/lib/kinetic_sdk/task/lib/users.rb +75 -0
  237. data/lib/kinetic_sdk/task/task-sdk.rb +92 -0
  238. data/lib/kinetic_sdk/utils/kinetic-http-headers.rb +150 -0
  239. data/lib/kinetic_sdk/utils/kinetic-http-response.rb +75 -0
  240. data/lib/kinetic_sdk/utils/kinetic-http.rb +552 -0
  241. data/lib/kinetic_sdk/utils/logger.rb +70 -0
  242. data/lib/kinetic_sdk/utils/random.rb +30 -0
  243. data/lib/kinetic_sdk/version.rb +7 -0
  244. data/lib/kinetic_sdk.rb +57 -0
  245. metadata +414 -0
@@ -0,0 +1,31 @@
1
+ Code-of-Conduct.rdoc
2
+ Contributing.rdoc
3
+ History.rdoc
4
+ Licence.rdoc
5
+ Manifest.txt
6
+ README.rdoc
7
+ Rakefile
8
+ lib/mime-types.rb
9
+ lib/mime/type.rb
10
+ lib/mime/type/columnar.rb
11
+ lib/mime/types.rb
12
+ lib/mime/types/_columnar.rb
13
+ lib/mime/types/cache.rb
14
+ lib/mime/types/columnar.rb
15
+ lib/mime/types/container.rb
16
+ lib/mime/types/deprecations.rb
17
+ lib/mime/types/full.rb
18
+ lib/mime/types/loader.rb
19
+ lib/mime/types/logger.rb
20
+ lib/mime/types/registry.rb
21
+ test/bad-fixtures/malformed
22
+ test/fixture/json.json
23
+ test/fixture/old-data
24
+ test/fixture/yaml.yaml
25
+ test/minitest_helper.rb
26
+ test/test_mime_type.rb
27
+ test/test_mime_types.rb
28
+ test/test_mime_types_cache.rb
29
+ test/test_mime_types_class.rb
30
+ test/test_mime_types_lazy.rb
31
+ test/test_mime_types_loader.rb
@@ -0,0 +1,202 @@
1
+ = mime-types for Ruby
2
+
3
+ home :: https://github.com/mime-types/ruby-mime-types/
4
+ code :: https://github.com/mime-types/ruby-mime-types/
5
+ bugs :: https://github.com/mime-types/ruby-mime-types/issues
6
+ rdoc :: http://rdoc.info/gems/mime-types/
7
+ continuous integration :: {<img src="https://travis-ci.org/mime-types/ruby-mime-types.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/mime-types/ruby-mime-types]
8
+ test coverage :: {<img src="https://coveralls.io/repos/mime-types/ruby-mime-types/badge.svg?branch=master&service=github" alt="Coverage Status" />}[https://coveralls.io/github/mime-types/ruby-mime-types?branch=master]
9
+
10
+ == Description
11
+
12
+ The mime-types library provides a library and registry for information about
13
+ MIME content type definitions. It can be used to determine defined filename
14
+ extensions for MIME types, or to use filename extensions to look up the likely
15
+ MIME type definitions.
16
+
17
+ Version 3.0 is a major release that requires Ruby 2.0 compatibility and removes
18
+ deprecated functions. The columnar registry format introduced in 2.6 has been
19
+ made the primary format; the registry data has been extracted from this library
20
+ and put into {mime-types-data}[https://github.com/mime-types/mime-types-data].
21
+ Additionally, mime-types is now licensed exclusively under the MIT licence and
22
+ there is a code of conduct in effect. There are a number of other smaller
23
+ changes described in the History file.
24
+
25
+ === About MIME Media Types
26
+
27
+ MIME content types are used in MIME-compliant communications, as in e-mail or
28
+ HTTP traffic, to indicate the type of content which is transmitted. The
29
+ mime-types library provides the ability for detailed information about MIME
30
+ entities (provided as an enumerable collection of MIME::Type objects) to be
31
+ determined and used. There are many types defined by RFCs and vendors, so the
32
+ list is long but by definition incomplete; don't hesitate to add additional
33
+ type definitions. MIME type definitions found in mime-types are from RFCs, W3C
34
+ recommendations, the {IANA Media Types
35
+ registry}[https://www.iana.org/assignments/media-types/media-types.xhtml], and
36
+ user contributions. It conforms to RFCs 2045 and 2231.
37
+
38
+ === mime-types 1.x End of Life
39
+
40
+ mime-types 1.x is no longer supported as of 2015-10-27.
41
+
42
+ === mime-types 2.x End of Life
43
+
44
+ mime-types 2.x is supported as 2.99.x receiving quarterly updates of the IANA
45
+ registry and security updates for two years. It will reach full end of life on
46
+ 2017-11-21.
47
+
48
+ === mime-types 3.x
49
+
50
+ Users are encouraged to upgrade to mime-types 3.x as soon as is practical.
51
+ mime-types 3.x requires Ruby 2.0 compatibility and a simpler licensing scheme.
52
+
53
+ == Synopsis
54
+
55
+ MIME types are used in MIME entities, as in email or HTTP traffic. It is useful
56
+ at times to have information available about MIME types (or, inversely, about
57
+ files). A MIME::Type stores the known information about one MIME type.
58
+
59
+ require 'mime/types'
60
+
61
+ plaintext = MIME::Types['text/plain'] # => [ text/plain ]
62
+ text = plaintext.first
63
+ puts text.media_type # => 'text'
64
+ puts text.sub_type # => 'plain'
65
+
66
+ puts text.extensions.join(' ') # => 'txt asc c cc h hh cpp hpp dat hlp'
67
+ puts text.preferred_extension # => 'txt'
68
+ puts text.friendly # => 'Text Document'
69
+ puts text.i18n_key # => 'text.plain'
70
+
71
+ puts text.encoding # => quoted-printable
72
+ puts text.default_encoding # => quoted-printable
73
+ puts text.binary? # => false
74
+ puts text.ascii? # => true
75
+ puts text.obsolete? # => false
76
+ puts text.registered? # => true
77
+ puts text.complete? # => true
78
+
79
+ puts text # => 'text/plain'
80
+
81
+ puts text == 'text/plain' # => true
82
+ puts 'text/plain' == text # => true
83
+ puts text == 'text/x-plain' # => false
84
+ puts 'text/x-plain' == text # => false
85
+
86
+ puts MIME::Type.simplified('x-appl/x-zip') # => 'x-appl/x-zip'
87
+ puts MIME::Type.i18n_key('x-appl/x-zip') # => 'x-appl.x-zip'
88
+
89
+ puts text.like?('text/x-plain') # => true
90
+ puts text.like?(MIME::Type.new('x-text/x-plain')) # => true
91
+
92
+ puts text.xrefs.inspect # => { "rfc" => [ "rfc2046", "rfc3676", "rfc5147" ] }
93
+ puts text.xref_urls # => [ "http://www.iana.org/go/rfc2046",
94
+ # "http://www.iana.org/go/rfc3676",
95
+ # "http://www.iana.org/go/rfc5147" ]
96
+
97
+ xtext = MIME::Type.new('x-text/x-plain')
98
+ puts xtext.media_type # => 'text'
99
+ puts xtext.raw_media_type # => 'x-text'
100
+ puts xtext.sub_type # => 'plain'
101
+ puts xtext.raw_sub_type # => 'x-plain'
102
+ puts xtext.complete? # => false
103
+
104
+ puts MIME::Types.any? { |type| type.content_type == 'text/plain' } # => true
105
+ puts MIME::Types.all?(&:registered?) # => false
106
+
107
+ # Various string representations of MIME types
108
+ qcelp = MIME::Types['audio/QCELP'].first # => audio/QCELP
109
+ puts qcelp.content_type # => 'audio/QCELP'
110
+ puts qcelp.simplified # => 'audio/qcelp'
111
+
112
+ xwingz = MIME::Types['application/x-Wingz'].first # => application/x-Wingz
113
+ puts xwingz.content_type # => 'application/x-Wingz'
114
+ puts xwingz.simplified # => 'application/x-wingz'
115
+
116
+ === Columnar Store
117
+
118
+ mime-types uses as its primary registry storage format a columnar storage
119
+ format reducing the default memory footprint. This is done by selectively
120
+ loading the data on a per-attribute basis. When the registry is first loaded
121
+ from the columnar store, only the canonical MIME content type and known
122
+ extensions and the MIME type will be connected to its loading registry. When
123
+ other data about the type is required (including +preferred_extension+,
124
+ <tt>obsolete?</tt>, and <tt>registered?</tt>) that data is loaded from its own
125
+ column file for all types in the registry.
126
+
127
+ The load of any column data is performed with a Mutex to ensure that types are
128
+ updated safely in a multithreaded environment. Benchmarks show that while
129
+ columnar data loading is slower than the JSON store, it cuts the memory use by
130
+ a third over the JSON store.
131
+
132
+ If you prefer to load all the data at once, this can be specified in your
133
+ application Gemfile as:
134
+
135
+ gem 'mime-types', require: 'mime/types/full'
136
+
137
+ Projects that do not use Bundler should +require+ the same:
138
+
139
+ require 'mime/types/full'
140
+
141
+ Libraries that use mime-types are discouraged from choosing the JSON store.
142
+
143
+ For applications and clients that used mime-types 2.6 when the columnar store
144
+ was introduced, the require used previously will still work through at least
145
+ {version
146
+ 4}[https://github.com/mime-types/ruby-mime-types/pull/96#issuecomment-100725400]
147
+ and possibly beyond; it is effectively an empty operation. You are recommended
148
+ to change your Gemfile as soon as is practical.
149
+
150
+ require 'mime/types/columnar'
151
+
152
+ Note that MIME::Type::Columnar and MIME::Types::Columnar are considered private
153
+ variant implementations of MIME::Type and MIME::Types and the specific
154
+ implementation should not be relied upon by consumers of the mime-types
155
+ library. Instead, depend on the public implementations (MIME::Type and
156
+ MIME::Types) only.
157
+
158
+ === Cached Storage
159
+
160
+ mime-types supports a cache of MIME types using <tt>Marshal.dump</tt>. The
161
+ cache is invalidated for each version of the mime-types-data gem so that data
162
+ version 3.2015.1201 will not be reused with data version 3.2016.0101. If the
163
+ environment variable +RUBY_MIME_TYPES_CACHE+ is set to a cache file, mime-types
164
+ will attempt to load the MIME type registry from the cache file. If it cannot,
165
+ it will load the types normally and then saves the registry to the cache file.
166
+
167
+ The caching works with both full stores and columnar stores. Only the data that
168
+ has been loaded prior to saving the cache will be stored.
169
+
170
+ == mime-types Modified Semantic Versioning
171
+
172
+ The mime-types library has one version number, but this single version number
173
+ tracks both API changes and registry data changes; this is not wholly
174
+ compatible with all aspects of {Semantic Versioning}[http://semver.org/];
175
+ removing a MIME type from the registry *could* be considered a breaking change
176
+ under some interpretations of semantic versioning (as lookups for that
177
+ particular type would no longer work by default).
178
+
179
+ mime-types uses a modified semantic versioning scheme. Given the version
180
+ MAJOR.MINOR:
181
+
182
+ 1. If an incompatible API (code) change is made, the MAJOR version will be
183
+ incremented, MINOR will be set to zero, and PATCH will be reset to the
184
+ implied zero.
185
+
186
+ 2. If an API (code) feature is added that does not break compatibilty, the
187
+ MINOR version will be incremented and PATCH will be reset to the implied zero.
188
+
189
+ 3. If there is a bugfix to a feature added in the most recent MAJOR.MINOR
190
+ release, the implied PATCH value will be incremented resulting in
191
+ MAJOR.MINOR.PATCH.
192
+
193
+ In practical terms, there will be fewer releases of mime-types focussing on
194
+ features because of the existence of the [mime-types-data][] gem, and if
195
+ features are marked deprecated in the course of mime-types 3.x, they will not
196
+ be removed until mime-types 4.x or possibly later.
197
+
198
+ :include: Code-of-Conduct.rdoc
199
+
200
+ :include: Contributing.rdoc
201
+
202
+ :include: Licence.rdoc
@@ -0,0 +1,254 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require 'rake/clean'
6
+
7
+ Hoe.plugin :doofus
8
+ Hoe.plugin :gemspec2
9
+ Hoe.plugin :git
10
+ Hoe.plugin :minitest
11
+ Hoe.plugin :travis
12
+ Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS']
13
+
14
+ spec = Hoe.spec 'mime-types' do
15
+ developer('Austin Ziegler', 'halostatue@gmail.com')
16
+ self.need_tar = true
17
+
18
+ require_ruby_version '>= 2.0'
19
+
20
+ self.history_file = 'History.rdoc'
21
+ self.readme_file = 'README.rdoc'
22
+
23
+ license 'MIT'
24
+
25
+ extra_deps << ['mime-types-data', '~> 3.2015']
26
+
27
+ extra_dev_deps << ['hoe-doofus', '~> 1.0']
28
+ extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
29
+ extra_dev_deps << ['hoe-git', '~> 1.6']
30
+ extra_dev_deps << ['hoe-rubygems', '~> 1.0']
31
+ extra_dev_deps << ['hoe-travis', '~> 1.2']
32
+ extra_dev_deps << ['minitest', '~> 5.4']
33
+ extra_dev_deps << ['minitest-autotest', '~> 1.0']
34
+ extra_dev_deps << ['minitest-focus', '~> 1.0']
35
+ extra_dev_deps << ['minitest-bonus-assertions', '~> 2.0']
36
+ extra_dev_deps << ['minitest-hooks', '~> 1.4']
37
+ extra_dev_deps << ['rake', '~> 10.0']
38
+ extra_dev_deps << ['fivemat', '~> 1.3' ]
39
+ extra_dev_deps << ['minitest-rg', '~> 5.2']
40
+
41
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
42
+ extra_dev_deps << ['simplecov', '~> 0.7']
43
+ # if ENV['CI'] or ENV['TRAVIS']
44
+ # extra_dev_deps << ['coveralls', '~> 0.8']
45
+ # end
46
+ end
47
+ end
48
+
49
+ namespace :benchmark do
50
+ task :support do
51
+ %w(lib support).each { |path|
52
+ $LOAD_PATH.unshift(File.join(Rake.application.original_dir, path))
53
+ }
54
+ end
55
+
56
+ desc 'Benchmark Load Times'
57
+ task :load, [ :repeats ] => 'benchmark:support' do |_, args|
58
+ require 'benchmarks/load'
59
+ Benchmarks::Load.report(
60
+ File.join(Rake.application.original_dir, 'lib'),
61
+ args.repeats
62
+ )
63
+ end
64
+
65
+ desc 'Allocation counts'
66
+ task :allocations, [ :top_x, :mime_types_only ] => 'benchmark:support' do |_, args|
67
+ require 'benchmarks/load_allocations'
68
+ Benchmarks::LoadAllocations.report(
69
+ top_x: args.top_x,
70
+ mime_types_only: args.mime_types_only
71
+ )
72
+ end
73
+
74
+ desc 'Columnar allocation counts'
75
+ task 'allocations:columnar', [ :top_x, :mime_types_only ] => 'benchmark:support' do |_, args|
76
+ require 'benchmarks/load_allocations'
77
+ Benchmarks::LoadAllocations.report(
78
+ columnar: true,
79
+ top_x: args.top_x,
80
+ mime_types_only: args.mime_types_only
81
+ )
82
+ end
83
+
84
+ desc 'Columnar allocation counts (full load)'
85
+ task 'allocations:columnar:full', [ :top_x, :mime_types_only ] => 'benchmark:support' do |_, args|
86
+ require 'benchmarks/load_allocations'
87
+ Benchmarks::LoadAllocations.report(
88
+ columnar: true,
89
+ top_x: args.top_x,
90
+ mime_types_only: args.mime_types_only,
91
+ full: true
92
+ )
93
+ end
94
+
95
+ desc 'Object counts'
96
+ task objects: 'benchmark:support' do
97
+ require 'benchmarks/object_counts'
98
+ Benchmarks::ObjectCounts.report
99
+ end
100
+
101
+ desc 'Columnar object counts'
102
+ task 'objects:columnar' => 'benchmark:support' do
103
+ require 'benchmarks/object_counts'
104
+ Benchmarks::ObjectCounts.report(columnar: true)
105
+ end
106
+
107
+ desc 'Columnar object counts (full load)'
108
+ task 'objects:columnar:full' => 'benchmark:support' do
109
+ require 'benchmarks/object_counts'
110
+ Benchmarks::ObjectCounts.report(columnar: true, full: true)
111
+ end
112
+ end
113
+
114
+ namespace :profile do
115
+ directory 'tmp/profile'
116
+
117
+ CLEAN.add 'tmp'
118
+
119
+ def ruby_prof(script)
120
+ require 'pathname'
121
+ output = Pathname('tmp/profile').join(script)
122
+ output.mkpath
123
+ script = Pathname('support/profile').join("#{script}.rb")
124
+
125
+ args = [
126
+ '-W0',
127
+ '-Ilib',
128
+ '-S', 'ruby-prof',
129
+ '-R', 'mime/types',
130
+ '-s', 'self',
131
+ '-p', 'multi',
132
+ '-f', "#{output}",
133
+ script.to_s
134
+ ]
135
+ ruby args.join(' ')
136
+ end
137
+
138
+ task full: 'tmp/profile' do
139
+ ruby_prof 'full'
140
+ end
141
+
142
+ task columnar: :support do
143
+ ruby_prof 'columnar'
144
+ end
145
+
146
+ task 'columnar:full' => :support do
147
+ ruby_prof 'columnar_full'
148
+ end
149
+ end
150
+
151
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0')
152
+ namespace :test do
153
+ # Coveralls needs to be disabled for now because it transitively depends on
154
+ # an earlier version of mime-types.
155
+ # if ENV['CI'] or ENV['TRAVIS']
156
+ # task :coveralls do
157
+ # spec.test_prelude = [
158
+ # 'require "psych"',
159
+ # 'require "simplecov"',
160
+ # 'require "coveralls"',
161
+ # 'SimpleCov.formatter = Coveralls::SimpleCov::Formatter',
162
+ # 'SimpleCov.start("test_frameworks") { command_name "Minitest" }',
163
+ # 'gem "minitest"'
164
+ # ].join('; ')
165
+ # Rake::Task['test'].execute
166
+ # end
167
+
168
+ # Rake::Task['travis'].prerequisites.replace(%w(test:coveralls))
169
+ # end
170
+
171
+ desc 'Run test coverage'
172
+ task :coverage do
173
+ spec.test_prelude = [
174
+ 'require "simplecov"',
175
+ 'SimpleCov.start("test_frameworks") { command_name "Minitest" }',
176
+ 'gem "minitest"'
177
+ ].join('; ')
178
+ Rake::Task['test'].execute
179
+ end
180
+ end
181
+ end
182
+
183
+ namespace :convert do
184
+ namespace :docs do
185
+ task :setup do
186
+ gem 'rdoc'
187
+ require 'rdoc/rdoc'
188
+ @doc_converter ||= RDoc::Markup::ToMarkdown.new
189
+ end
190
+
191
+ FileList['*.rdoc'].each do |name|
192
+ rdoc = name
193
+ mark = "#{File.basename(name, '.rdoc')}.md"
194
+
195
+ file mark => [ rdoc, :setup ] do |t|
196
+ puts "#{rdoc} => #{mark}"
197
+ File.open(t.name, 'wb') { |target|
198
+ target.write @doc_converter.convert(IO.read(t.prerequisites.first))
199
+ }
200
+ end
201
+
202
+ CLEAN.add mark
203
+
204
+ task run: [ mark ]
205
+ end
206
+ end
207
+
208
+ desc 'Convert documentation from RDoc to Markdown'
209
+ task docs: 'convert:docs:run'
210
+ end
211
+
212
+ task 'deps:top', [ :number ] do |_, args|
213
+ require 'net/http'
214
+ require 'json'
215
+
216
+ def rubygems_get(gem_name: '', endpoint: '')
217
+ path = File.join('/api/v1/gems/', gem_name, endpoint).chomp('/') + '.json'
218
+ Net::HTTP.start('rubygems.org', use_ssl: true) do |http|
219
+ JSON.parse(http.get(path).body)
220
+ end
221
+ end
222
+
223
+ results = rubygems_get(
224
+ gem_name: 'mime-types',
225
+ endpoint: 'reverse_dependencies'
226
+ )
227
+
228
+ weighted_results = {}
229
+ results.each do |name|
230
+ begin
231
+ weighted_results[name] = rubygems_get(gem_name: name)['downloads']
232
+ rescue => e
233
+ puts "#{name} #{e.message}"
234
+ end
235
+ end
236
+
237
+ weighted_results.sort { |(_k1, v1), (_k2, v2)|
238
+ v2 <=> v1
239
+ }.first(args.number || 50).each_with_index do |(k, v), i|
240
+ puts "#{i}) #{k}: #{v}"
241
+ end
242
+ end
243
+
244
+ task :console do
245
+ arguments = %w(pry)
246
+ arguments.push(*spec.spec.require_paths.map { |dir| "-I#{dir}" })
247
+ arguments.push("-r#{spec.spec.name.gsub('-', File::SEPARATOR)}")
248
+ unless system(*arguments)
249
+ error "Command failed: #{show_command}"
250
+ abort
251
+ end
252
+ end
253
+
254
+ # vim: syntax=ruby
@@ -0,0 +1,55 @@
1
+ require 'mime/type'
2
+
3
+ # A version of MIME::Type that works hand-in-hand with a MIME::Types::Columnar
4
+ # container to load data by columns.
5
+ #
6
+ # When a field is has not yet been loaded, that data will be loaded for all
7
+ # types in the container before forwarding the message to MIME::Type.
8
+ #
9
+ # More information can be found in MIME::Types::Columnar.
10
+ #
11
+ # MIME::Type::Columnar is *not* intended to be created except by
12
+ # MIME::Types::Columnar containers.
13
+ class MIME::Type::Columnar < MIME::Type
14
+ def initialize(container, content_type, extensions) # :nodoc:
15
+ @container = container
16
+ self.content_type = content_type
17
+ self.extensions = extensions
18
+ end
19
+
20
+ def self.column(*methods, file: nil) # :nodoc:
21
+ file = methods.first unless file
22
+
23
+ file_method = :"load_#{file}"
24
+ methods.each do |m|
25
+ define_method m do |*args|
26
+ @container.send(file_method)
27
+ super(*args)
28
+ end
29
+ end
30
+ end
31
+
32
+ column :friendly
33
+ column :encoding, :encoding=
34
+ column :docs, :docs=
35
+ column :preferred_extension, :preferred_extension=
36
+ column :obsolete, :obsolete=, :obsolete?, :registered, :registered=,
37
+ :registered?, :signature, :signature=, :signature?, file: 'flags'
38
+ column :xrefs, :xrefs=, :xref_urls
39
+ column :use_instead, :use_instead=
40
+
41
+ def encode_with(coder) # :nodoc:
42
+ @container.send(:load_friendly)
43
+ @container.send(:load_encoding)
44
+ @container.send(:load_docs)
45
+ @container.send(:load_flags)
46
+ @container.send(:load_use_instead)
47
+ @container.send(:load_xrefs)
48
+ @container.send(:load_preferred_extension)
49
+ super
50
+ end
51
+
52
+ class << self
53
+ undef column
54
+ end
55
+ end