tinkit 0.0.3 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (308) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +13 -0
  4. data/Gemfile.lock +28 -0
  5. data/{LICENSE → LICENSE.txt} +0 -0
  6. data/NOTICE +14 -0
  7. data/Rakefile +50 -65
  8. data/VERSION +1 -0
  9. data/bufs_fixtures/bufs_fixtures.rb +66 -0
  10. data/bufs_fixtures/init_db_load.rb +95 -0
  11. data/bufs_fixtures/model_fixtures/create_model_dir.rb +55 -0
  12. data/bufs_fixtures/model_fixtures/default_data_model.json +1 -0
  13. data/bufs_fixtures/model_fixtures/make_model_json_file.rb +104 -0
  14. data/bufs_fixtures/orig_test_files/Test%_+- .,^^,. -+_%.txt +1 -0
  15. data/bufs_fixtures/orig_test_files/simple text file 2.txt +1 -0
  16. data/bufs_fixtures/orig_test_files/simple text file 3.txt +1 -0
  17. data/bufs_fixtures/orig_test_files/simple text file 4.txt +1 -0
  18. data/bufs_fixtures/orig_test_files/simple_text_file1.txt +1 -0
  19. data/bufs_fixtures/orig_test_files/spec test2 v1.3.pptx +1 -0
  20. data/bufs_fixtures/orig_test_files/spec test2.docx +1 -0
  21. data/bufs_fixtures/orig_test_files/spec_test1.pptx +1 -0
  22. data/bufs_fixtures/orig_test_files/spec_test3.pptx +1 -0
  23. data/bufs_fixtures/orig_test_files/test_modified_time_fresh.txt +1 -0
  24. data/bufs_fixtures/orig_test_files/test_modified_time_stale.txt +1 -0
  25. data/bufs_fixtures/test_files/Test%_+- .,^^,. -+_%.txt +1 -0
  26. data/bufs_fixtures/test_files/simple text file 2.txt +1 -0
  27. data/bufs_fixtures/test_files/simple text file 3.txt +1 -0
  28. data/bufs_fixtures/test_files/simple text file 4.txt +1 -0
  29. data/bufs_fixtures/test_files/simple_text_file1.txt +1 -0
  30. data/bufs_fixtures/test_files/spec test2 v1.3.pptx +1 -0
  31. data/bufs_fixtures/test_files/spec test2.docx +1 -0
  32. data/bufs_fixtures/test_files/spec_test1.pptx +1 -0
  33. data/bufs_fixtures/test_files/spec_test3.pptx +1 -0
  34. data/bufs_fixtures/test_files/test_modified_time_fresh.txt +1 -0
  35. data/bufs_fixtures/test_files/test_modified_time_stale.txt +1 -0
  36. data/examples/edge_cases.rb +43 -0
  37. data/examples/example.rb +7 -4
  38. data/examples/example_env_formatter.rb +146 -0
  39. data/examples/hello_world_get.rb +34 -0
  40. data/examples/hello_world_save.rb +43 -0
  41. data/examples/test_sync.rb +123 -0
  42. data/lib/glue_envs/couchrest/couchrest_attachment_handler.rb +18 -3
  43. data/lib/glue_envs/couchrest/couchrest_files_mgr.rb +1 -1
  44. data/lib/glue_envs/couchrest_glue_env.rb +1 -1
  45. data/lib/glue_envs/filesystem/filesystem_files_mgr.rb +2 -2
  46. data/lib/glue_envs/filesystem_glue_env.rb +1 -1
  47. data/lib/glue_envs/mysql/mysql_files_mgr.rb +1 -0
  48. data/lib/tinkit_base_node.rb +22 -1
  49. data/lib/tinkit_node_factory.rb +111 -15
  50. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/a/.node_data.json +1 -0
  51. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/aa/.node_data.json +1 -0
  52. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/aa/simple_text_file1.txt +1 -0
  53. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/aa/spec_test1.pptx +1 -0
  54. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/aaa/.node_data.json +1 -0
  55. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/ab/.node_data.json +1 -0
  56. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/ac/.node_data.json +1 -0
  57. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/ac/spec_test2_v1.3.pptx +1 -0
  58. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/b/.node_data.json +1 -0
  59. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/b/simple_text_file_2.txt +1 -0
  60. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/b/simple_text_file_3.txt +1 -0
  61. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/ba/.node_data.json +1 -0
  62. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/ba/simple_text_file1.txt +1 -0
  63. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/bb/.node_data.json +1 -0
  64. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/bb/Test___-_._._-___.txt +1 -0
  65. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/bbb/.node_data.json +1 -0
  66. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/bc/.node_data.json +1 -0
  67. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/bcc/.node_data.json +1 -0
  68. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/c/.node_data.json +1 -0
  69. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/cc/.node_data.json +1 -0
  70. data/sandbox_for_specs/sample_data/SampleFileSysUser003/.model/cc/simple_text_file1.txt +1 -0
  71. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ab/borged_files/Test___-_._._-___.txt +1 -0
  72. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ab/borged_files/simple_text_file1.txt +1 -0
  73. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ab/borged_files/simple_text_file_2.txt +1 -0
  74. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ab/borged_files/simple_text_file_3.txt +1 -0
  75. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ab/borged_files/spec_test1.pptx +0 -0
  76. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ab/borged_files/spec_test2_v1.3.pptx +0 -0
  77. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ab/borged_links.html +2 -0
  78. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/borged_files/Test___-_._._-___.txt +1 -0
  79. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/borged_files/simple_text_file1.txt +1 -0
  80. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/borged_files/simple_text_file_2.txt +1 -0
  81. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/borged_files/simple_text_file_3.txt +1 -0
  82. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/borged_files/spec_test1.pptx +0 -0
  83. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/borged_files/spec_test2_v1.3.pptx +0 -0
  84. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/borged_links.html +5 -0
  85. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/links.html +1 -0
  86. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/ac/spec_test2_v1.3.pptx +0 -0
  87. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/borged_files/Test___-_._._-___.txt +1 -0
  88. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/borged_files/simple_text_file1.txt +1 -0
  89. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/borged_files/simple_text_file_2.txt +1 -0
  90. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/borged_files/simple_text_file_3.txt +1 -0
  91. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/borged_files/spec_test1.pptx +0 -0
  92. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/borged_files/spec_test2_v1.3.pptx +0 -0
  93. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/a/borged_links.html +3 -0
  94. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/bbb/borged_files/Test___-_._._-___.txt +1 -0
  95. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/bbb/borged_files/simple_text_file1.txt +1 -0
  96. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/bbb/borged_files/simple_text_file_2.txt +1 -0
  97. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/bbb/borged_files/simple_text_file_3.txt +1 -0
  98. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/bbb/borged_files/spec_test1.pptx +0 -0
  99. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/bbb/borged_files/spec_test2_v1.3.pptx +0 -0
  100. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/bbb/borged_links.html +1 -0
  101. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/borged_files/Test___-_._._-___.txt +1 -0
  102. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/borged_files/simple_text_file1.txt +1 -0
  103. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/borged_files/simple_text_file_2.txt +1 -0
  104. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/borged_files/simple_text_file_3.txt +1 -0
  105. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/borged_files/spec_test1.pptx +0 -0
  106. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/borged_files/spec_test2_v1.3.pptx +0 -0
  107. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/aaa/borged_links.html +3 -0
  108. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/borged_files/Test___-_._._-___.txt +1 -0
  109. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/borged_files/simple_text_file1.txt +1 -0
  110. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/borged_files/simple_text_file_2.txt +1 -0
  111. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/borged_files/simple_text_file_3.txt +1 -0
  112. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/borged_files/spec_test1.pptx +0 -0
  113. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/borged_files/spec_test2_v1.3.pptx +0 -0
  114. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/borged_links.html +3 -0
  115. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/simple_text_file1.txt +1 -0
  116. data/sandbox_for_specs/sample_data/SampleFileSysUser003/aa/spec_test1.pptx +0 -0
  117. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/borged_files/Test___-_._._-___.txt +1 -0
  118. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/borged_files/simple_text_file1.txt +1 -0
  119. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/borged_files/simple_text_file_2.txt +1 -0
  120. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/borged_files/simple_text_file_3.txt +1 -0
  121. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/borged_files/spec_test1.pptx +0 -0
  122. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/borged_files/spec_test2_v1.3.pptx +0 -0
  123. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/borged_links.html +5 -0
  124. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/links.html +2 -0
  125. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/ba/simple_text_file1.txt +1 -0
  126. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/Test___-_._._-___.txt +1 -0
  127. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/borged_files/Test___-_._._-___.txt +1 -0
  128. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/borged_files/simple_text_file1.txt +1 -0
  129. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/borged_files/simple_text_file_2.txt +1 -0
  130. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/borged_files/simple_text_file_3.txt +1 -0
  131. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/borged_files/spec_test1.pptx +0 -0
  132. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/borged_files/spec_test2_v1.3.pptx +0 -0
  133. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bb/borged_links.html +3 -0
  134. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/borged_files/Test___-_._._-___.txt +1 -0
  135. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/borged_files/simple_text_file1.txt +1 -0
  136. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/borged_files/simple_text_file_2.txt +1 -0
  137. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/borged_files/simple_text_file_3.txt +1 -0
  138. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/borged_files/spec_test1.pptx +0 -0
  139. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/borged_files/spec_test2_v1.3.pptx +0 -0
  140. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/borged_links.html +5 -0
  141. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/bcc/links.html +1 -0
  142. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/borged_files/Test___-_._._-___.txt +1 -0
  143. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/borged_files/simple_text_file1.txt +1 -0
  144. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/borged_files/simple_text_file_2.txt +1 -0
  145. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/borged_files/simple_text_file_3.txt +1 -0
  146. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/borged_files/spec_test1.pptx +0 -0
  147. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/borged_files/spec_test2_v1.3.pptx +0 -0
  148. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/bc/borged_links.html +1 -0
  149. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/borged_files/Test___-_._._-___.txt +1 -0
  150. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/borged_files/simple_text_file1.txt +1 -0
  151. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/borged_files/simple_text_file_2.txt +1 -0
  152. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/borged_files/simple_text_file_3.txt +1 -0
  153. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/borged_files/spec_test1.pptx +0 -0
  154. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/borged_files/spec_test2_v1.3.pptx +0 -0
  155. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/borged_links.html +4 -0
  156. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/links.html +2 -0
  157. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/simple_text_file_2.txt +1 -0
  158. data/sandbox_for_specs/sample_data/SampleFileSysUser003/b/simple_text_file_3.txt +1 -0
  159. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/borged_files/Test___-_._._-___.txt +1 -0
  160. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/borged_files/simple_text_file1.txt +1 -0
  161. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/borged_files/simple_text_file_2.txt +1 -0
  162. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/borged_files/simple_text_file_3.txt +1 -0
  163. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/borged_files/spec_test1.pptx +0 -0
  164. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/borged_files/spec_test2_v1.3.pptx +0 -0
  165. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/borged_links.html +1 -0
  166. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/borged_files/Test___-_._._-___.txt +1 -0
  167. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/borged_files/simple_text_file1.txt +1 -0
  168. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/borged_files/simple_text_file_2.txt +1 -0
  169. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/borged_files/simple_text_file_3.txt +1 -0
  170. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/borged_files/spec_test1.pptx +0 -0
  171. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/borged_files/spec_test2_v1.3.pptx +0 -0
  172. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/borged_links.html +5 -0
  173. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/links.html +1 -0
  174. data/sandbox_for_specs/sample_data/SampleFileSysUser003/c/cc/simple_text_file1.txt +1 -0
  175. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/a/.node_data.json +1 -0
  176. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/aa/.node_data.json +1 -0
  177. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/aa/simple_text_file1.txt +1 -0
  178. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/aa/spec_test1.pptx +1 -0
  179. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/aaa/.node_data.json +1 -0
  180. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/ab/.node_data.json +1 -0
  181. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/ac/.node_data.json +1 -0
  182. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/ac/spec_test2_v1.3.pptx +1 -0
  183. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/b/.node_data.json +1 -0
  184. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/b/simple_text_file_2.txt +1 -0
  185. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/b/simple_text_file_3.txt +1 -0
  186. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/ba/.node_data.json +1 -0
  187. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/ba/simple_text_file1.txt +1 -0
  188. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/bb/.node_data.json +1 -0
  189. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/bb/Test___-_._._-___.txt +1 -0
  190. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/bbb/.node_data.json +1 -0
  191. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/bc/.node_data.json +1 -0
  192. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/bcc/.node_data.json +1 -0
  193. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/c/.node_data.json +1 -0
  194. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/cc/.node_data.json +1 -0
  195. data/sandbox_for_specs/sample_data/SampleFileSysUser004/.model/cc/simple_text_file1.txt +1 -0
  196. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ab/borged_files/Test___-_._._-___.txt +1 -0
  197. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ab/borged_files/simple_text_file1.txt +1 -0
  198. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ab/borged_files/simple_text_file_2.txt +1 -0
  199. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ab/borged_files/simple_text_file_3.txt +1 -0
  200. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ab/borged_files/spec_test1.pptx +0 -0
  201. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ab/borged_files/spec_test2_v1.3.pptx +0 -0
  202. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ab/borged_links.html +2 -0
  203. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/borged_files/Test___-_._._-___.txt +1 -0
  204. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/borged_files/simple_text_file1.txt +1 -0
  205. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/borged_files/simple_text_file_2.txt +1 -0
  206. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/borged_files/simple_text_file_3.txt +1 -0
  207. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/borged_files/spec_test1.pptx +0 -0
  208. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/borged_files/spec_test2_v1.3.pptx +0 -0
  209. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/borged_links.html +5 -0
  210. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/links.html +1 -0
  211. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/ac/spec_test2_v1.3.pptx +0 -0
  212. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/borged_files/Test___-_._._-___.txt +1 -0
  213. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/borged_files/simple_text_file1.txt +1 -0
  214. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/borged_files/simple_text_file_2.txt +1 -0
  215. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/borged_files/simple_text_file_3.txt +1 -0
  216. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/borged_files/spec_test1.pptx +0 -0
  217. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/borged_files/spec_test2_v1.3.pptx +0 -0
  218. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/a/borged_links.html +3 -0
  219. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/bbb/borged_files/Test___-_._._-___.txt +1 -0
  220. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/bbb/borged_files/simple_text_file1.txt +1 -0
  221. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/bbb/borged_files/simple_text_file_2.txt +1 -0
  222. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/bbb/borged_files/simple_text_file_3.txt +1 -0
  223. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/bbb/borged_files/spec_test1.pptx +0 -0
  224. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/bbb/borged_files/spec_test2_v1.3.pptx +0 -0
  225. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/bbb/borged_links.html +1 -0
  226. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/borged_files/Test___-_._._-___.txt +1 -0
  227. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/borged_files/simple_text_file1.txt +1 -0
  228. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/borged_files/simple_text_file_2.txt +1 -0
  229. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/borged_files/simple_text_file_3.txt +1 -0
  230. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/borged_files/spec_test1.pptx +0 -0
  231. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/borged_files/spec_test2_v1.3.pptx +0 -0
  232. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/aaa/borged_links.html +3 -0
  233. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/borged_files/Test___-_._._-___.txt +1 -0
  234. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/borged_files/simple_text_file1.txt +1 -0
  235. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/borged_files/simple_text_file_2.txt +1 -0
  236. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/borged_files/simple_text_file_3.txt +1 -0
  237. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/borged_files/spec_test1.pptx +0 -0
  238. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/borged_files/spec_test2_v1.3.pptx +0 -0
  239. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/borged_links.html +3 -0
  240. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/simple_text_file1.txt +1 -0
  241. data/sandbox_for_specs/sample_data/SampleFileSysUser004/aa/spec_test1.pptx +0 -0
  242. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/borged_files/Test___-_._._-___.txt +1 -0
  243. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/borged_files/simple_text_file1.txt +1 -0
  244. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/borged_files/simple_text_file_2.txt +1 -0
  245. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/borged_files/simple_text_file_3.txt +1 -0
  246. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/borged_files/spec_test1.pptx +0 -0
  247. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/borged_files/spec_test2_v1.3.pptx +0 -0
  248. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/borged_links.html +5 -0
  249. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/links.html +2 -0
  250. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/ba/simple_text_file1.txt +1 -0
  251. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/Test___-_._._-___.txt +1 -0
  252. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/borged_files/Test___-_._._-___.txt +1 -0
  253. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/borged_files/simple_text_file1.txt +1 -0
  254. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/borged_files/simple_text_file_2.txt +1 -0
  255. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/borged_files/simple_text_file_3.txt +1 -0
  256. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/borged_files/spec_test1.pptx +0 -0
  257. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/borged_files/spec_test2_v1.3.pptx +0 -0
  258. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bb/borged_links.html +3 -0
  259. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/borged_files/Test___-_._._-___.txt +1 -0
  260. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/borged_files/simple_text_file1.txt +1 -0
  261. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/borged_files/simple_text_file_2.txt +1 -0
  262. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/borged_files/simple_text_file_3.txt +1 -0
  263. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/borged_files/spec_test1.pptx +0 -0
  264. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/borged_files/spec_test2_v1.3.pptx +0 -0
  265. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/borged_links.html +5 -0
  266. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/bcc/links.html +1 -0
  267. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/borged_files/Test___-_._._-___.txt +1 -0
  268. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/borged_files/simple_text_file1.txt +1 -0
  269. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/borged_files/simple_text_file_2.txt +1 -0
  270. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/borged_files/simple_text_file_3.txt +1 -0
  271. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/borged_files/spec_test1.pptx +0 -0
  272. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/borged_files/spec_test2_v1.3.pptx +0 -0
  273. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/bc/borged_links.html +1 -0
  274. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/borged_files/Test___-_._._-___.txt +1 -0
  275. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/borged_files/simple_text_file1.txt +1 -0
  276. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/borged_files/simple_text_file_2.txt +1 -0
  277. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/borged_files/simple_text_file_3.txt +1 -0
  278. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/borged_files/spec_test1.pptx +0 -0
  279. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/borged_files/spec_test2_v1.3.pptx +0 -0
  280. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/borged_links.html +4 -0
  281. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/links.html +2 -0
  282. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/simple_text_file_2.txt +1 -0
  283. data/sandbox_for_specs/sample_data/SampleFileSysUser004/b/simple_text_file_3.txt +1 -0
  284. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/borged_files/Test___-_._._-___.txt +1 -0
  285. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/borged_files/simple_text_file1.txt +1 -0
  286. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/borged_files/simple_text_file_2.txt +1 -0
  287. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/borged_files/simple_text_file_3.txt +1 -0
  288. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/borged_files/spec_test1.pptx +0 -0
  289. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/borged_files/spec_test2_v1.3.pptx +0 -0
  290. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/borged_links.html +1 -0
  291. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/borged_files/Test___-_._._-___.txt +1 -0
  292. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/borged_files/simple_text_file1.txt +1 -0
  293. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/borged_files/simple_text_file_2.txt +1 -0
  294. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/borged_files/simple_text_file_3.txt +1 -0
  295. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/borged_files/spec_test1.pptx +0 -0
  296. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/borged_files/spec_test2_v1.3.pptx +0 -0
  297. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/borged_links.html +5 -0
  298. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/links.html +1 -0
  299. data/sandbox_for_specs/sample_data/SampleFileSysUser004/c/cc/simple_text_file1.txt +1 -0
  300. data/spec/couchdb_running_spec.rb +17 -0
  301. data/spec/couchrest_files_mgr_spec.rb +2 -2
  302. data/spec/filesystem_glue_spec.rb +0 -1
  303. data/spec/tinkit_node_factory_spec.rb +46 -2
  304. data/tinkit-0.0.4.gem +0 -0
  305. data/tinkit.gemspec +439 -0
  306. metadata +497 -46
  307. data/examples/aws_sdb.log +0 -31
  308. data/examples/bufs_hello_world.rb +0 -27
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.3.0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.5.2"
12
+ gem "rcov", ">= 0"
13
+ end
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.2)
5
+ git (1.2.5)
6
+ jeweler (1.5.2)
7
+ bundler (~> 1.0.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rake (0.8.7)
11
+ rcov (0.9.9)
12
+ rspec (2.3.0)
13
+ rspec-core (~> 2.3.0)
14
+ rspec-expectations (~> 2.3.0)
15
+ rspec-mocks (~> 2.3.0)
16
+ rspec-core (2.3.1)
17
+ rspec-expectations (2.3.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.3.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bundler (~> 1.0.0)
26
+ jeweler (~> 1.5.2)
27
+ rcov
28
+ rspec (~> 2.3.0)
File without changes
data/NOTICE ADDED
@@ -0,0 +1,14 @@
1
+ Copyright 2010 David Martin
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
data/Rakefile CHANGED
@@ -1,75 +1,60 @@
1
- #The specs in this rake file deal only with the core
2
- #bufs libraries
3
-
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
4
10
  require 'rake'
5
- require 'spec/rake/spectask'
6
11
 
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "tinkit"
16
+ gem.homepage = "http://github.com/forforf/tinkit"
17
+ gem.license = "Apache v2" #license is Apache v2
18
+ gem.summary = %Q{Tinkit, a portable persistence layer for cloud, file systems, and other persistent stores}
19
+ gem.description = %Q{Tinkit provides a portable persistence layer that adopts to your data, not the other way around.}
20
+ gem.email = "dmarti21@gmail.com"
21
+ gem.authors = ["Dave M"]
22
+
23
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
24
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
25
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
26
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
27
+ #core dependencies
28
+ gem.add_dependency "log4r", "~> 1.1.9"
29
+ gem.add_dependency "mime-types", "~> 1.16"
30
+ #CouchDB interface dependencies
31
+ gem.add_dependency "couchrest", "~> 1.0.2"
32
+ gem.add_dependency "couchrest_extended_document", "~> 1.0.0"
33
+ gem.add_dependency "rest-client", "~> 1.6.1"
34
+ #mysql interface dependencies
7
35
 
8
- #Allows clearing of the task environment
9
- class Rake::Task
10
- def abandon
11
- @actions.clear
12
- end
13
36
  end
14
- #task :default => ['specs_with_rcov']
15
-
16
- #Tests that fail in rake but work standalone
17
- spec_set_0 = ['spec/tk_escape_spec.rb']
18
-
19
- #fixture tests
20
- spec_set_1 = ['spec/couchdb_running_spec.rb',
21
- 'spec/bufs_sample_dataset_spec.rb']
22
-
23
- #data structure tests (currently not working)
24
- spec_set_2 = ['spec/node_element_operations_spec.rb']
37
+ Jeweler::RubygemsDotOrgTasks.new
25
38
 
26
- #model tests for multi-user
27
- spec_set_3 = ['spec/tinkit_node_factory_spec.rb']
28
-
29
- #These tests would share common variable namespaces
30
- #and will clobber each other if ran in a common environment
31
- spec_set_3aa = ['spec/couchrest_attachment_handler_spec.rb']
32
- #'spec/bufs_base_node_spec.rb',
33
- spec_set_3a = [ 'spec/bufs_couchrest_spec.rb']
39
+ require 'rspec/core'
40
+ require 'rspec/core/rake_task'
41
+ RSpec::Core::RakeTask.new(:spec) do |spec|
42
+ spec.pattern = FileList['spec/**/*_spec.rb']
43
+ end
34
44
 
35
- spec_set_3b = ['spec/bufs_filesystem_spec.rb']
45
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
46
+ spec.pattern = 'spec/**/*_spec.rb'
47
+ spec.rcov = true
48
+ end
36
49
 
37
- #Set up rake specs by spec sets"
38
- spec_sets = { "spec_set_0" => spec_set_0,
39
- "spec_set_1" => spec_set_1,
40
- "spec_set_2" => spec_set_2,
41
- "spec_set_3" => spec_set_3,
42
- "spec_set_3a"=> spec_set_3a,
43
- "spec_set_3aa"=>spec_set_3aa,
44
- "spec_set_3b"=> spec_set_3b
45
- }
46
-
50
+ task :default => :spec
47
51
 
48
- #creates spec task spec_set_##
49
- spec_sets.each do |name, set|
50
- desc "Run #{name}"
51
- Spec::Rake::SpecTask.new(name) do |t|
52
- puts "Creating set: #{name}"
53
- t.spec_files = spec_sets[name]
54
- t.rcov = false
55
- end
56
- end
57
-
52
+ require 'rake/rdoctask'
53
+ Rake::RDocTask.new do |rdoc|
54
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
58
55
 
59
- desc "Runs all specs in their environments and continues if error is encountered"
60
- task :spec_sets do
61
- spec_sets.each do |name, set|
62
- puts "Running Test on #{name}"
63
- begin
64
- Rake::Task[name].invoke
65
- rescue => e
66
- puts "Rake Task #{name} Failed"
67
- puts "Error message: #{e.inspect}"
68
- #puts "Trace:\n #{e.backtrace}"
69
- puts "Moving on to next set"
70
- next
71
- end
72
- puts "Clearing Task"
73
- Rake::Task[name].abandon
74
- end
56
+ rdoc.rdoc_dir = 'rdoc'
57
+ rdoc.title = "tinkit #{version}"
58
+ rdoc.rdoc_files.include('README*')
59
+ rdoc.rdoc_files.include('lib/**/*.rb')
75
60
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.6
@@ -0,0 +1,66 @@
1
+ #require helper for cleaner require statements
2
+ helpers_path = File.join(File.expand_path(File.dirname(__FILE__)), '../lib/helpers/')
3
+ require File.join(helpers_path, 'require_helper')
4
+
5
+ #This database has the necessary data for bootstrapping the fixture
6
+ require 'couchrest'
7
+ require 'fileutils'
8
+ require Tinkit.helpers 'mime_types_new'
9
+ require Tinkit.helpers 'log_helper'
10
+
11
+ #Set Logger
12
+ fix_log = TinkitLog.set(File.basename(__FILE__))
13
+ #fix_log.level = DEBUG
14
+ fix_log.debug {"Loading fixtures"} if fix_log.debug?
15
+ fix_db_name = "http://127.0.0.1:5984/bufs_test_fixture_files/"
16
+ fix_log.debug {"Using DB: #{fix_db_name}"} if fix_log.debug?
17
+ FixDB = CouchRest.database!(fix_db_name)
18
+ FixDB.compact!
19
+
20
+ TinkitFixturesDir = File.dirname(__FILE__) + '/'
21
+
22
+ module TinkitFixtures
23
+ class << self
24
+ attr_accessor :test_files
25
+ end
26
+ ProjectLocation = TinkitFixturesDir + '../'
27
+ TestFileLocation = TinkitFixturesDir + 'test_files/'
28
+
29
+ doc_db_name = "http://127.0.0.1:5984/bufs_test_spec/"
30
+ CouchDB = CouchRest.database!(doc_db_name)
31
+ CouchDB.compact!
32
+ doc_db_name_2 = "http://127.0.0.1:5984/bufs_test_spec_2/"
33
+ CouchDB2 = CouchRest.database!(doc_db_name_2)
34
+ CouchDB2.compact!
35
+
36
+ #method to create a File Model
37
+ SpecSandbox = File.join(ProjectLocation, 'sandbox_for_specs')
38
+ SampleFileModelDir = File.join(SpecSandbox, 'sample_model_dir')
39
+
40
+ def self.create_sample_file_model(dir = SampleFileModelDir)
41
+ FileUtils.rm_rf(dir) if File.exist?(dir)
42
+ end
43
+ end
44
+
45
+ TinkitFixtures.test_files = {}
46
+ FixDB.view('test_files/test_files')['rows'].each do |r|
47
+ doc_id = r['value']['_id']
48
+ att_name = r['value']['_attachments'].keys.first
49
+
50
+ file_data = FixDB.fetch_attachment(FixDB.get(doc_id), att_name)
51
+ file_name = TinkitFixtures::TestFileLocation + att_name
52
+ File.open(file_name, 'wb'){|f| f.write(file_data)}
53
+ TinkitFixtures.test_files[doc_id] = file_name
54
+ end
55
+
56
+
57
+ #puts "---------------------------------"
58
+ #puts "- Test Filenames and References -"
59
+ #puts "---------------------------------"
60
+ #TinkitFixtures.test_files.each do |doc, fname|
61
+
62
+ # puts "#{doc.ljust(33)} -> #{fname}"
63
+ #end
64
+ #puts "---------------------------------"
65
+
66
+
@@ -0,0 +1,95 @@
1
+ require 'couchrest'
2
+ require 'fileutils'
3
+ require 'base64'
4
+ require File.dirname(__FILE__) + '/../lib/helpers/mime_types_new'
5
+
6
+
7
+ module InitLoader
8
+ @@test_file_location = File.dirname(__FILE__) + '/test_files/'
9
+ def self.file_path(file_basename)
10
+ File.join(@@test_file_location, file_basename)
11
+ end
12
+
13
+ def self.stored_files
14
+ { 'binary_data_pptx' => self.file_path('spec_test1.pptx'),
15
+ 'binary_data_spaces_in_fname_pptx' => self.file_path('spec test2 v1.3.pptx'),
16
+ 'binary_data2_docx' => self.file_path('spec test2.docx'),
17
+ 'binary_data3_pptx' => self.file_path('spec_test3.pptx'),
18
+ 'fresh_file' => self.file_path('test_modified_time_fresh.txt'),
19
+ 'simple_text_file' => self.file_path('simple_text_file1.txt'),
20
+ 'simple_text_file2' => self.file_path('simple text file 2.txt'),
21
+ 'simple_text_file3' => self.file_path('simple text file 3.txt'),
22
+ 'simple_text_file4' => self.file_path('simple text file 4.txt'),
23
+ 'stale_file' => self.file_path('test_modified_time_stale.txt'),
24
+ 'strange_characters_in_file_name' => self.file_path('Test%_+- .,^^,. -+_%.txt')
25
+ }
26
+ end
27
+
28
+ def self.map_js
29
+ map_js = <<-JS
30
+ function(doc) {
31
+ if (doc['doc_type'] == \"test_file\"){
32
+ emit(null, doc);
33
+ }
34
+ }
35
+ JS
36
+ end
37
+
38
+ def self.view_js
39
+ { 'map' => map_js }
40
+ end
41
+ def self.view_id
42
+ "_design/test_files"
43
+ end
44
+ #view_name = "test_files"
45
+ def self.view_record
46
+ view_record = { "_id" => self.view_id,
47
+ :views => { "test_files" => self.view_js } }
48
+ end
49
+ end
50
+
51
+ newDB = CouchRest.database('http://127.0.0.1:5984/bufs_test_fixture_files/"')
52
+ newDB.delete! if newDB
53
+ NewDB = CouchRest.database!('http://127.0.0.1:5984/bufs_test_fixture_files/"')
54
+ begin
55
+ NewDB.save_doc(InitLoader.view_record)
56
+ rescue RestClient::RequestFailed
57
+ puts "Replacing view"
58
+ cur_rcd = NewDB.get(InitLoader.view_id)
59
+ NewDB.delete_doc(cur_rcd)
60
+ NewDB.save_doc(InitLoader.view_record)
61
+ end
62
+
63
+ InitLoader.stored_files.each do |name, fname|
64
+ bname = File.basename(fname)
65
+ begin
66
+ doc_data = { "_id" => name, "doc_type" => "test_file" }
67
+ content_type = {"content_type" => MimeNew.for_ofc_x(fname)}
68
+ att_data = { "_attachments" => {
69
+ bname => {
70
+ "content_type" => MimeNew.for_ofc_x(bname),
71
+ "data" => Base64.decode64("#{File.open(fname, 'rb'){|f| f.read}}")
72
+ }
73
+ }
74
+ }
75
+
76
+ if doc_data["_id"] == "simple_text_file"
77
+ p doc_data["_id"]
78
+ p File.open(fname, 'r'){|f| f.read}
79
+ #p att_data["_attachments"][bname]["data"]
80
+ end
81
+ #rcd_data = doc_data.merge att_data
82
+ data = File.open(fname, 'r'){|f| f.read}
83
+ NewDB.save_doc(doc_data)
84
+ NewDB.put_attachment(doc_data, bname, data, content_type)
85
+ rescue RestClient::RequestFailed
86
+ puts "Replacing test file"
87
+ cur_rcd = NewDB.get(doc_data['_id'])
88
+ NewDB.delete_doc(cur_rcd)
89
+ #NewDB.save_doc(rcd_data)
90
+ NewDB.save_doc(doc_data)
91
+ NewDB.put_attachment(doc_data, bname, fname, content_type)
92
+
93
+ end
94
+ end
95
+
@@ -0,0 +1,55 @@
1
+ require 'fileutils'
2
+ require 'json'
3
+
4
+ class DataModel
5
+ NodeDataFileName = ".node_data.json"
6
+ DataModelSourceFile = "default_data_model.json"
7
+
8
+
9
+ def initialize(options = {})
10
+ @read_path = options[:read_path] || File.join(Dir.pwd, DataModelSourceFile)
11
+ @write_path = options[:write_path] || File.join(Dir.pwd, "data_model.json")
12
+ FileUtils.mkdir(@read_path) unless File.exists?(@read_path)
13
+ FileUtils.mkdir(@write_path) unless File.exists?(@write_path)
14
+ data_model_json = File.open(@read_path, 'r') {|f| f.read}
15
+ @data_model = JSON.parse(data_model_json)
16
+ make_model(@data_model)
17
+ end
18
+
19
+
20
+ def make_model(data_model)
21
+ data_model.each do |basename, contents|
22
+ model_entry_dir = File.join(@write_path, basename)
23
+ FileUtils.mkdir(model_entry_dir)
24
+ contents.each do |label, content|
25
+ case label
26
+ when "node_data"
27
+ write_node_data(model_entry_dir, content)
28
+ when "attachments"
29
+ write_attachment(model_entry_dir, content)
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ def write_node_data(dir, content)
36
+ path = File.join(dir, NodeDataFileName)
37
+ File.open(path, 'w') { |f| f.write content.to_json }
38
+ end
39
+
40
+ def write_attachment(dir, attachments)
41
+ attachments.each do |attachment_data|
42
+ raise "Unable to write file data, no data provided" unless attachment_data
43
+ raise "Unable to write file data, no file name provided" unless attachment_data["filename"]
44
+ fname = File.join(dir, attachment_data["filename"])
45
+ file_data = attachment_data["data"]
46
+ #file_mod_time = attachment_data["mod_time"]
47
+ File.open(fname, 'w') {|f| f.write attachment_data}
48
+ end
49
+ end
50
+ end
51
+
52
+ read_from = File.join("/home/bufs/bufs/bufs_fixtures/model_fixtures/",DataModel::DataModelSourceFile)
53
+ write_to = "/home/bufs/bufs/sandbox_for_specs/bufs_view_builder_spec/model"
54
+ FileUtils.rm_rf write_to
55
+ DataModel.new(:read_path => read_from, :write_path => write_to)
@@ -0,0 +1 @@
1
+ {"a":{"node_data":{"my_category":"a","parent_categories":["root","aa"],"description":"a description"}},"b":{"node_data":{"my_category":"b","parent_categories":["root"],"description":"b description"}},"aa":{"node_data":{"my_category":"aa","parent_categories":["a"],"description":"aa description"}},"aaa":{"node_data":{"my_category":"aaa","parent_categories":["aa"],"description":"aaa description"}},"ab":{"node_data":{"my_category":"ab","parent_categories":["a","bb","aaa"],"description":"ab description"},"attachments":[{"filename":"ab1.txt","data":"data from ab1.txt"},{"filename":"ab2.txt","data":"data from ab2.txt"}]},"ac":{"node_data":{"my_category":"ac","parent_categories":["a"],"description":"ac description"},"attachments":[{"filename":"ac.txt","data":"data from ac.txt"}]},"ba":{"node_data":{"my_category":"ba","parent_categories":["b","ab"],"description":"ba description"}},"bb":{"node_data":{"my_category":"bb","parent_categories":["b"],"description":"bb description"}},"bbb":{"node_data":{"my_category":"bbb","parent_categories":["bb","aaa"],"description":"bbb description"}},"bc":{"node_data":{"my_category":"bc","parent_categories":["b","bbb"],"description":"bc description"},"attachments":[{"filename":"bc.txt","data":"data from bc.txt"}]},"bcc":{"node_data":{"my_category":"bcc","parent_categories":["bc"],"description":"bcc description"},"attachments":[{"filename":"bcc.txt","data":"data from bcc.txt"}]}}
@@ -0,0 +1,104 @@
1
+ require 'json'
2
+
3
+ DefaultDataModel = {
4
+ :a => {
5
+ :node_data => {
6
+ "my_category" => "a",
7
+ "parent_categories" => ["root","aa"],
8
+ "description" => "a description"
9
+ }
10
+ },
11
+ :b => {
12
+ :node_data => {
13
+ "my_category" => "b",
14
+ "parent_categories" => ["root"],
15
+ "description" => "b description"
16
+ }
17
+ },
18
+ :aa=> {
19
+ :node_data => {
20
+ "my_category" => "aa",
21
+ "parent_categories" => ["a"],
22
+ "description" => "aa description"
23
+ }
24
+ },
25
+ :aaa=> {
26
+ :node_data => {
27
+ "my_category" => "aaa",
28
+ "parent_categories" => ["aa"],
29
+ "description" => "aaa description"
30
+ }
31
+ },
32
+ :ab => {
33
+ :node_data => {
34
+ "my_category" => "ab",
35
+ "parent_categories" => ["a","bb","aaa"],
36
+ "description" => "ab description"
37
+ },
38
+ :attachments => [
39
+ {:filename => "ab1.txt",
40
+ :data => "data from ab1.txt"},
41
+ {:filename => "ab2.txt",
42
+ :data => "data from ab2.txt"}
43
+ ]
44
+ },
45
+ :ac => {
46
+ :node_data => {
47
+ "my_category" => "ac",
48
+ "parent_categories" => ["a"],
49
+ "description" => "ac description"
50
+ },
51
+ :attachments => [
52
+ {:filename => "ac.txt",
53
+ :data => "data from ac.txt"
54
+ }
55
+ ]
56
+ },
57
+ "ba"=> {
58
+ :node_data => {
59
+ "my_category" => "ba",
60
+ "parent_categories" => ["b","ab"],
61
+ "description" => "ba description"
62
+ }
63
+ },
64
+ "bb"=> {
65
+ :node_data => {
66
+ "my_category" => "bb",
67
+ "parent_categories" => ["b"],
68
+ "description" => "bb description"
69
+ }
70
+ },
71
+ "bbb"=> {
72
+ :node_data => {
73
+ "my_category" => "bbb",
74
+ "parent_categories" => ["bb","aaa"],
75
+ "description" => "bbb description"
76
+ }
77
+ },
78
+ "bc"=> {
79
+ :node_data => {
80
+ "my_category" => "bc",
81
+ "parent_categories" => ["b","bbb"],
82
+ "description" => "bc description"
83
+ },
84
+ :attachments => [
85
+ {:filename => "bc.txt",
86
+ :data => "data from bc.txt"}
87
+ ]
88
+ },
89
+ "bcc"=> {
90
+ :node_data => {
91
+ "my_category" => "bcc",
92
+ "parent_categories" => ["bc"],
93
+ "description" => "bcc description"
94
+ },
95
+ :attachments => [
96
+ {:filename => "bcc.txt",
97
+ :data => "data from bcc.txt"}
98
+ ]
99
+ }
100
+
101
+ }
102
+
103
+ model_json = DefaultDataModel.to_json
104
+ File.open('default_data_model.json','w'){|f| f.write(model_json)}