spreadsheet_architect 2.1.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (243) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +17 -2
  3. data/README.md +149 -129
  4. data/lib/spreadsheet_architect/class_methods/csv.rb +2 -2
  5. data/lib/spreadsheet_architect/class_methods/ods.rb +2 -2
  6. data/lib/spreadsheet_architect/class_methods/xlsx.rb +26 -30
  7. data/lib/spreadsheet_architect/exceptions.rb +32 -30
  8. data/lib/spreadsheet_architect/utils/xlsx.rb +46 -25
  9. data/lib/spreadsheet_architect/utils.rb +116 -121
  10. data/lib/spreadsheet_architect/version.rb +1 -1
  11. data/lib/spreadsheet_architect.rb +5 -1
  12. data/test/dummy_app/app/models/active_model_object.rb +1 -0
  13. data/test/dummy_app/app/models/custom_post.rb +1 -0
  14. data/test/dummy_app/app/models/legacy_plain_ruby_object.rb +14 -0
  15. data/test/dummy_app/app/models/plain_ruby_object.rb +2 -9
  16. data/test/dummy_app/app/models/post.rb +3 -0
  17. data/test/dummy_app/config/routes.rb +4 -5
  18. data/test/dummy_app/db/test.sqlite3 +0 -0
  19. data/test/dummy_app/log/test.log +26911 -21739
  20. data/test/dummy_app/tmp/2.0.1/integration/alt_xlsx.xlsx +0 -0
  21. data/test/dummy_app/tmp/2.0.1/integration/csv.csv +6 -0
  22. data/test/dummy_app/tmp/2.0.1/integration/ods.ods +0 -0
  23. data/test/dummy_app/tmp/2.0.1/integration/xlsx.xlsx +0 -0
  24. data/test/dummy_app/tmp/2.0.1/kitchen_sink.ods +0 -0
  25. data/test/dummy_app/tmp/2.0.1/kitchen_sink.xlsx +0 -0
  26. data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/data.csv +3 -0
  27. data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/data.ods +0 -0
  28. data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/data.xlsx +0 -0
  29. data/test/dummy_app/tmp/{empty_sa.csv → 2.0.1/models/ActiveModelObject/empty.csv} +0 -0
  30. data/test/dummy_app/tmp/{ods/empty_model.ods → 2.0.1/models/ActiveModelObject/empty.ods} +0 -0
  31. data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/empty.xlsx +0 -0
  32. data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/instances.csv +6 -0
  33. data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/instances.ods +0 -0
  34. data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/instances.xlsx +0 -0
  35. data/test/dummy_app/tmp/2.0.1/models/CustomPost/data.csv +3 -0
  36. data/test/dummy_app/tmp/2.0.1/models/CustomPost/data.ods +0 -0
  37. data/test/dummy_app/tmp/2.0.1/models/CustomPost/data.xlsx +0 -0
  38. data/test/dummy_app/tmp/2.0.1/models/CustomPost/empty.csv +1 -0
  39. data/test/dummy_app/tmp/2.0.1/models/CustomPost/empty.ods +0 -0
  40. data/test/dummy_app/tmp/2.0.1/models/CustomPost/empty.xlsx +0 -0
  41. data/test/dummy_app/tmp/2.0.1/models/CustomPost/instances.csv +6 -0
  42. data/test/dummy_app/tmp/2.0.1/models/CustomPost/instances.ods +0 -0
  43. data/test/dummy_app/tmp/2.0.1/models/CustomPost/instances.xlsx +0 -0
  44. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/data.csv +3 -0
  45. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/data.ods +0 -0
  46. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/data.xlsx +0 -0
  47. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/empty.csv +1 -0
  48. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/empty.ods +0 -0
  49. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/empty.xlsx +0 -0
  50. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/instances.csv +6 -0
  51. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/instances.ods +0 -0
  52. data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/instances.xlsx +0 -0
  53. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/data.csv +3 -0
  54. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/data.ods +0 -0
  55. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/data.xlsx +0 -0
  56. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/empty.csv +0 -0
  57. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/empty.ods +0 -0
  58. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/empty.xlsx +0 -0
  59. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/instances.csv +6 -0
  60. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/instances.ods +0 -0
  61. data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/instances.xlsx +0 -0
  62. data/test/dummy_app/tmp/2.0.1/models/Post/data.csv +3 -0
  63. data/test/dummy_app/tmp/2.0.1/models/Post/data.ods +0 -0
  64. data/test/dummy_app/tmp/2.0.1/models/Post/data.xlsx +0 -0
  65. data/test/dummy_app/tmp/2.0.1/models/Post/empty.csv +0 -0
  66. data/test/dummy_app/tmp/2.0.1/models/Post/empty.ods +0 -0
  67. data/test/dummy_app/tmp/2.0.1/models/Post/empty.xlsx +0 -0
  68. data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/data.csv +3 -0
  69. data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/data.ods +0 -0
  70. data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/data.xlsx +0 -0
  71. data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/empty.csv +0 -0
  72. data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/empty.ods +0 -0
  73. data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/empty.xlsx +0 -0
  74. data/test/dummy_app/tmp/2.0.1/multi_sheet.ods +0 -0
  75. data/test/dummy_app/tmp/2.0.1/multi_sheet.xlsx +0 -0
  76. data/test/dummy_app/tmp/3.0.0.pre/integration/alt_xlsx.xlsx +0 -0
  77. data/test/dummy_app/tmp/3.0.0.pre/integration/csv.csv +6 -0
  78. data/test/dummy_app/tmp/3.0.0.pre/integration/ods.ods +0 -0
  79. data/test/dummy_app/tmp/3.0.0.pre/integration/xlsx.xlsx +0 -0
  80. data/test/dummy_app/tmp/3.0.0.pre/kitchen_sink.ods +0 -0
  81. data/test/dummy_app/tmp/3.0.0.pre/kitchen_sink.xlsx +0 -0
  82. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/data.csv +3 -0
  83. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/data.ods +0 -0
  84. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/data.xlsx +0 -0
  85. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/empty.csv +0 -0
  86. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/empty.ods +0 -0
  87. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/empty.xlsx +0 -0
  88. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/instances.csv +6 -0
  89. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/instances.ods +0 -0
  90. data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/instances.xlsx +0 -0
  91. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/data.csv +3 -0
  92. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/data.ods +0 -0
  93. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/data.xlsx +0 -0
  94. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/empty.csv +1 -0
  95. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/empty.ods +0 -0
  96. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/empty.xlsx +0 -0
  97. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/instances.csv +6 -0
  98. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/instances.ods +0 -0
  99. data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/instances.xlsx +0 -0
  100. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/data.csv +3 -0
  101. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/data.ods +0 -0
  102. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/data.xlsx +0 -0
  103. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/empty.csv +0 -0
  104. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/empty.ods +0 -0
  105. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/empty.xlsx +0 -0
  106. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/instances.csv +6 -0
  107. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/instances.ods +0 -0
  108. data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/instances.xlsx +0 -0
  109. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/data.csv +3 -0
  110. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/data.ods +0 -0
  111. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/data.xlsx +0 -0
  112. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/empty.csv +1 -0
  113. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/empty.ods +0 -0
  114. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/empty.xlsx +0 -0
  115. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/instances.csv +6 -0
  116. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/instances.ods +0 -0
  117. data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/instances.xlsx +0 -0
  118. data/test/dummy_app/tmp/3.0.0.pre/models/Post/data.csv +3 -0
  119. data/test/dummy_app/tmp/3.0.0.pre/models/Post/data.ods +0 -0
  120. data/test/dummy_app/tmp/3.0.0.pre/models/Post/data.xlsx +0 -0
  121. data/test/dummy_app/tmp/3.0.0.pre/models/Post/empty.csv +0 -0
  122. data/test/dummy_app/tmp/3.0.0.pre/models/Post/empty.ods +0 -0
  123. data/test/dummy_app/tmp/3.0.0.pre/models/Post/empty.xlsx +0 -0
  124. data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/data.csv +3 -0
  125. data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/data.ods +0 -0
  126. data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/data.xlsx +0 -0
  127. data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/empty.csv +0 -0
  128. data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/empty.ods +0 -0
  129. data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/empty.xlsx +0 -0
  130. data/test/dummy_app/tmp/3.0.0.pre/multi_sheet.ods +0 -0
  131. data/test/dummy_app/tmp/3.0.0.pre/multi_sheet.xlsx +0 -0
  132. data/test/dummy_app/tmp/axlsx-master/integration/alt_xlsx.xlsx +0 -0
  133. data/test/dummy_app/tmp/axlsx-master/integration/csv.csv +6 -0
  134. data/test/dummy_app/tmp/axlsx-master/integration/ods.ods +0 -0
  135. data/test/dummy_app/tmp/axlsx-master/integration/xlsx.xlsx +0 -0
  136. data/test/dummy_app/tmp/axlsx-master/kitchen_sink.ods +0 -0
  137. data/test/dummy_app/tmp/axlsx-master/kitchen_sink.xlsx +0 -0
  138. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/data.csv +3 -0
  139. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/data.ods +0 -0
  140. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/data.xlsx +0 -0
  141. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/empty.csv +0 -0
  142. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/empty.ods +0 -0
  143. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/empty.xlsx +0 -0
  144. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/instances.csv +6 -0
  145. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/instances.ods +0 -0
  146. data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/instances.xlsx +0 -0
  147. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/data.csv +3 -0
  148. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/data.ods +0 -0
  149. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/data.xlsx +0 -0
  150. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/empty.csv +0 -0
  151. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/empty.ods +0 -0
  152. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/empty.xlsx +0 -0
  153. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/instances.csv +6 -0
  154. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/instances.ods +0 -0
  155. data/test/dummy_app/tmp/axlsx-master/models/CustomPost/instances.xlsx +0 -0
  156. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/data.csv +3 -0
  157. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/data.ods +0 -0
  158. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/data.xlsx +0 -0
  159. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/empty.csv +1 -0
  160. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/empty.ods +0 -0
  161. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/empty.xlsx +0 -0
  162. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/instances.csv +6 -0
  163. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/instances.ods +0 -0
  164. data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/instances.xlsx +0 -0
  165. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/data.csv +3 -0
  166. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/data.ods +0 -0
  167. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/data.xlsx +0 -0
  168. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/empty.csv +1 -0
  169. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/empty.ods +0 -0
  170. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/empty.xlsx +0 -0
  171. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/instances.csv +6 -0
  172. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/instances.ods +0 -0
  173. data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/instances.xlsx +0 -0
  174. data/test/dummy_app/tmp/axlsx-master/models/Post/data.csv +3 -0
  175. data/test/dummy_app/tmp/axlsx-master/models/Post/data.ods +0 -0
  176. data/test/dummy_app/tmp/axlsx-master/models/Post/data.xlsx +0 -0
  177. data/test/dummy_app/tmp/axlsx-master/models/Post/empty.csv +0 -0
  178. data/test/dummy_app/tmp/axlsx-master/models/Post/empty.ods +0 -0
  179. data/test/dummy_app/tmp/axlsx-master/models/Post/empty.xlsx +0 -0
  180. data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/data.csv +3 -0
  181. data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/data.ods +0 -0
  182. data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/data.xlsx +0 -0
  183. data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/empty.csv +0 -0
  184. data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/empty.ods +0 -0
  185. data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/empty.xlsx +0 -0
  186. data/test/dummy_app/tmp/axlsx-master/multi_sheet.ods +0 -0
  187. data/test/dummy_app/tmp/axlsx-master/multi_sheet.xlsx +0 -0
  188. data/test/integration/application_test.rb +8 -11
  189. data/test/models/all_models_test.rb +107 -0
  190. data/test/test_helper.rb +13 -4
  191. data/test/unit/exceptions_test.rb +168 -0
  192. data/test/unit/formats_test.rb +15 -0
  193. data/test/unit/general_test.rb +15 -0
  194. data/test/unit/kitchen_sink_test.rb +87 -0
  195. data/test/unit/multi_sheet_test.rb +29 -0
  196. data/test/unit/utils_test.rb +179 -0
  197. data/test/unit/xlsx_utils_test.rb +143 -0
  198. metadata +409 -116
  199. data/lib/generators/spreadsheet_architect/add_project_defaults_generator.rb +0 -20
  200. data/test/dummy_app/app/models/bad_plain_ruby_object.rb +0 -3
  201. data/test/dummy_app/app/views/reports/sample.html.erb +0 -1
  202. data/test/dummy_app/log/development.log +0 -28
  203. data/test/dummy_app/tmp/active_model_object/csv.csv +0 -21
  204. data/test/dummy_app/tmp/active_model_object/ods.ods +0 -0
  205. data/test/dummy_app/tmp/active_model_object/xlsx.xlsx +0 -0
  206. data/test/dummy_app/tmp/custom_posts/csv.csv +0 -6
  207. data/test/dummy_app/tmp/custom_posts/empty.xlsx +0 -0
  208. data/test/dummy_app/tmp/custom_posts/ods.ods +0 -0
  209. data/test/dummy_app/tmp/custom_posts/xlsx.xlsx +0 -0
  210. data/test/dummy_app/tmp/empty_model.csv +0 -1
  211. data/test/dummy_app/tmp/empty_model.xlsx +0 -0
  212. data/test/dummy_app/tmp/empty_sa.xlsx +0 -0
  213. data/test/dummy_app/tmp/extreme.xlsx +0 -0
  214. data/test/dummy_app/tmp/integration_tests/alt_xlsx.xlsx +0 -0
  215. data/test/dummy_app/tmp/integration_tests/csv.csv +0 -6
  216. data/test/dummy_app/tmp/integration_tests/ods.ods +0 -0
  217. data/test/dummy_app/tmp/integration_tests/xlsx.xlsx +0 -0
  218. data/test/dummy_app/tmp/model.csv +0 -6
  219. data/test/dummy_app/tmp/model.xlsx +0 -0
  220. data/test/dummy_app/tmp/ods/empty_sa.ods +0 -0
  221. data/test/dummy_app/tmp/ods/model.ods +0 -0
  222. data/test/dummy_app/tmp/ods/model_options.ods +0 -0
  223. data/test/dummy_app/tmp/ods/sa.ods +0 -0
  224. data/test/dummy_app/tmp/options.csv +0 -6
  225. data/test/dummy_app/tmp/plain_ruby_object/csv.csv +0 -4
  226. data/test/dummy_app/tmp/plain_ruby_object/ods.ods +0 -0
  227. data/test/dummy_app/tmp/plain_ruby_object/xlsx.xlsx +0 -0
  228. data/test/dummy_app/tmp/posts/csv.csv +0 -6
  229. data/test/dummy_app/tmp/posts/empty.xlsx +0 -0
  230. data/test/dummy_app/tmp/posts/ods.ods +0 -0
  231. data/test/dummy_app/tmp/posts/xlsx.xlsx +0 -0
  232. data/test/dummy_app/tmp/sa.csv +0 -4
  233. data/test/dummy_app/tmp/sa.xlsx +0 -0
  234. data/test/models/active_model_object_test.rb +0 -51
  235. data/test/models/bad_plain_ruby_object_test.rb +0 -28
  236. data/test/models/csv_test.rb +0 -59
  237. data/test/models/custom_post_test.rb +0 -51
  238. data/test/models/ods_test.rb +0 -65
  239. data/test/models/plain_ruby_object_test.rb +0 -51
  240. data/test/models/post_test.rb +0 -44
  241. data/test/models/spreadsheet_architect_utils_test.rb +0 -73
  242. data/test/models/xlsx_test.rb +0 -98
  243. data/test/spreadsheet_architect_test.rb +0 -11
@@ -1,20 +0,0 @@
1
- require 'rails/generators'
2
-
3
- module SpreadsheetArchitect
4
- class AddDefaultOptionsGenerator < Rails::Generators::Base
5
-
6
- def add_default_options
7
- create_file "config/initializers/spreadsheet_architect.rb", <<eos
8
- SpreadsheetArchitect.default_options = {
9
- headers: true,
10
- header_style: {background_color: "AAAAAA", color: "FFFFFF", align: :center, bold: false, font_name: 'Arial', font_size: 10, italic: false, underline: false},
11
- row_style: {background_color: nil, color: "000000", align: :left, bold: false, font_name: 'Arial', font_size: 10, italic: false, underline: false},
12
- column_styles: [],
13
- range_styles: [],
14
- borders: []
15
- }
16
- eos
17
- end
18
-
19
- end
20
- end
@@ -1,3 +0,0 @@
1
- class BadPlainRubyObject
2
- include SpreadsheetArchitect
3
- end
@@ -1 +0,0 @@
1
- <h1>Hello World!</h1>
@@ -1,28 +0,0 @@
1
-  (0.6ms) SELECT sqlite_version(*)
2
-  (4.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
3
-  (1.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
4
-  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
5
- Migrating to AddPosts (20170103234524)
6
-  (0.1ms) begin transaction
7
-  (0.6ms) CREATE TABLE "posts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "content" text, "age" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
8
- ActiveRecord::SchemaMigration Create (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20170103234524"]]
9
-  (0.9ms) commit transaction
10
- ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
11
-  (0.1ms) begin transaction
12
- ActiveRecord::InternalMetadata Create (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2018-06-20 05:00:54.439886"], ["updated_at", "2018-06-20 05:00:54.439886"]]
13
-  (0.8ms) commit transaction
14
-  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
15
-  (0.1ms) SELECT sqlite_version(*)
16
-  (2.0ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
17
-  (1.0ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
18
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
19
- Migrating to AddPosts (20170103234524)
20
-  (0.1ms) begin transaction
21
-  (0.5ms) CREATE TABLE "posts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "content" text, "age" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
22
- ActiveRecord::SchemaMigration Create (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20170103234524"]]
23
-  (1.1ms) commit transaction
24
- ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
25
-  (0.1ms) begin transaction
26
- ActiveRecord::InternalMetadata Create (0.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2018-06-20 05:04:49.783707"], ["updated_at", "2018-06-20 05:04:49.783707"]]
27
-  (0.7ms) commit transaction
28
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
@@ -1,21 +0,0 @@
1
- Name,Content,Created At
2
- asd,asd,2018-07-06 07:28:41 -0700
3
- asd,asd,2018-07-06 07:28:41 -0700
4
- asd,asd,2018-07-06 07:28:41 -0700
5
- asd,asd,2018-07-06 07:28:41 -0700
6
- asd,asd,2018-07-06 07:28:41 -0700
7
- asd,asd,2018-07-06 07:28:41 -0700
8
- asd,asd,2018-07-06 07:28:41 -0700
9
- asd,asd,2018-07-06 07:28:41 -0700
10
- asd,asd,2018-07-06 07:28:41 -0700
11
- asd,asd,2018-07-06 07:28:41 -0700
12
- asd,asd,2018-07-06 07:28:41 -0700
13
- asd,asd,2018-07-06 07:28:41 -0700
14
- asd,asd,2018-07-06 07:28:41 -0700
15
- asd,asd,2018-07-06 07:28:41 -0700
16
- asd,asd,2018-07-06 07:28:41 -0700
17
- asd,asd,2018-07-06 07:28:41 -0700
18
- asd,asd,2018-07-06 07:28:41 -0700
19
- asd,asd,2018-07-06 07:28:41 -0700
20
- asd,asd,2018-07-06 07:28:41 -0700
21
- asd,asd,2018-07-06 07:28:41 -0700
@@ -1,6 +0,0 @@
1
- Name,The Content,Created At,Created At Date,asd
2
- foo 0,bar 0,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
3
- foo 1,bar 1,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
4
- foo 2,bar 2,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
5
- foo 3,bar 3,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
6
- foo 4,bar 4,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
@@ -1 +0,0 @@
1
- Name,Content,Age
Binary file
Binary file
Binary file
@@ -1,6 +0,0 @@
1
- Name,Content,Age
2
- foo 0,bar 0,0
3
- foo 1,bar 1,1
4
- foo 2,bar 2,2
5
- foo 3,bar 3,3
6
- foo 4,bar 4,4
@@ -1,6 +0,0 @@
1
- Name,Content,Age
2
- foo 0,bar 0,0
3
- foo 1,bar 1,1
4
- foo 2,bar 2,2
5
- foo 3,bar 3,3
6
- foo 4,bar 4,4
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +0,0 @@
1
- Name,Content,Age
2
- foo 0,bar 0,0
3
- foo 1,bar 1,1
4
- foo 2,bar 2,2
5
- foo 3,bar 3,3
6
- foo 4,bar 4,4
@@ -1,4 +0,0 @@
1
- Title,Content,Object ID
2
- My Title,The content...,47296580280720
3
- My Title,The content...,47296580280700
4
- My Title,The content...,47296580280680
@@ -1,6 +0,0 @@
1
- Name,Content,Age
2
- foo 0,bar 0,0
3
- foo 1,bar 1,1
4
- foo 2,bar 2,2
5
- foo 3,bar 3,3
6
- foo 4,bar 4,4
Binary file
Binary file
Binary file
@@ -1,4 +0,0 @@
1
- test1,test2,test3
2
- row1
3
- row2 c1,row2 c2
4
- the,data
Binary file
@@ -1,51 +0,0 @@
1
- require "test_helper"
2
-
3
- class ActiveModelObjectTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- @path = Rails.root.join('tmp/active_model_object')
7
- FileUtils.mkdir_p(@path)
8
- end
9
-
10
- def test_csv
11
- assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
12
- ActiveModelObject.to_csv
13
- end
14
-
15
- instances = 20.times.map{|_| ActiveModelObject.new(name: :asd, content: :asd, created_at: Time.now)}
16
- data = ActiveModelObject.to_csv(instances: instances)
17
-
18
- File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
19
- f.write data
20
- end
21
- end
22
-
23
- def test_ods
24
- assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
25
- ActiveModelObject.to_ods
26
- end
27
-
28
- instances = 20.times.map{|_| ActiveModelObject.new(name: :asd, content: :asd, created_at: Time.now)}
29
- data = ActiveModelObject.to_ods(instances: instances)
30
-
31
- File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
32
- f.write data
33
- end
34
- end
35
-
36
- def test_xlsx
37
- assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
38
- ActiveModelObject.to_xlsx
39
- end
40
-
41
- instances = 20.times.map{|_| ActiveModelObject.new(name: :asd, content: :asd, created_at: Time.now)}
42
- data = ActiveModelObject.to_xlsx(instances: instances)
43
-
44
- File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
45
- f.write data
46
- end
47
- end
48
-
49
- def teardown
50
- end
51
- end
@@ -1,28 +0,0 @@
1
- require "test_helper"
2
-
3
- class BadPlainRubyObjectTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_csv
9
- assert_raise SpreadsheetArchitect::Exceptions::SpreadsheetColumnsNotDefinedError do
10
- BadPlainRubyObject.to_csv(instances: [])
11
- end
12
- end
13
-
14
- def test_ods
15
- assert_raise SpreadsheetArchitect::Exceptions::SpreadsheetColumnsNotDefinedError do
16
- BadPlainRubyObject.to_ods(instances: [])
17
- end
18
- end
19
-
20
- def test_xlsx
21
- assert_raise SpreadsheetArchitect::Exceptions::SpreadsheetColumnsNotDefinedError do
22
- BadPlainRubyObject.to_xlsx(instances: [])
23
- end
24
- end
25
-
26
- def teardown
27
- end
28
- end
@@ -1,59 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CsvTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- @headers = ['test1', 'test2','test3']
7
- @data = [
8
- ['row1'],
9
- ['row2 c1', 'row2 c2'],
10
- ['the','data']
11
- ]
12
- @options = {
13
- headers: true,
14
- header_style: {background_color: 'AAAAAA', color: 'FFFFFF', align: :center, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
15
- row_style: {background_color: nil, color: '000000', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
16
- sheet_name: 'My Project Export',
17
- column_styles: [],
18
- range_styles: [],
19
- merges: [],
20
- borders: [],
21
- column_types: []
22
- }
23
- end
24
-
25
- def test_empty_model
26
- Post.delete_all
27
- File.open(Rails.root.join('tmp/empty_model.csv'),'w+b') do |f|
28
- f.write Post.to_csv
29
- end
30
- end
31
-
32
- def test_empty_sa
33
- File.open(Rails.root.join('tmp/empty_sa.csv'),'w+b') do |f|
34
- f.write SpreadsheetArchitect.to_csv(data: [])
35
- end
36
- end
37
-
38
- def test_sa
39
- File.open(Rails.root.join('tmp/sa.csv'),'w+b') do |f|
40
- f.write SpreadsheetArchitect.to_csv(headers: @headers, data: @data)
41
- end
42
- end
43
-
44
- def test_model
45
- File.open(Rails.root.join('tmp/model.csv'),'w+b') do |f|
46
- f.write Post.to_csv
47
- end
48
- end
49
-
50
- def test_options
51
- File.open(Rails.root.join('tmp/options.csv'),'w+b') do |f|
52
- f.write Post.to_csv(@options)
53
- end
54
- end
55
-
56
- def teardown
57
- end
58
-
59
- end
@@ -1,51 +0,0 @@
1
- require "test_helper"
2
-
3
- class CustomPostTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- @path = File.join(Rails.root, 'tmp/custom_posts')
7
- FileUtils.mkdir_p(@path)
8
- end
9
-
10
- def test_csv
11
- data = CustomPost.to_csv
12
-
13
- File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
14
- f.write data
15
- end
16
- end
17
-
18
- def test_ods
19
- data = CustomPost.to_ods
20
-
21
- File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
22
- f.write data
23
- end
24
- end
25
-
26
- def test_xlsx
27
- data = CustomPost.all.to_xlsx
28
-
29
- File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
30
- f.write data
31
- end
32
- end
33
-
34
- def test_empty
35
- Post.destroy_all
36
-
37
- File.open(File.join(@path, 'empty.xlsx'), 'w+b') do |f|
38
- f.write Post.to_xlsx
39
- end
40
- end
41
-
42
- def test_constants_dont_change
43
- x = CustomPost::SPREADSHEET_OPTIONS.to_s
44
- SpreadsheetArchitect.to_xlsx(headers: [[1]], data: [[1]], header_style: {b: false}, row_style: {background_color: '000000'})
45
- assert_equal(x, CustomPost::SPREADSHEET_OPTIONS.to_s)
46
- end
47
-
48
-
49
- def teardown
50
- end
51
- end
@@ -1,65 +0,0 @@
1
- require 'test_helper'
2
-
3
- class OdsTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- FileUtils.mkdir_p(Rails.root.join('tmp/ods'))
7
-
8
- 10.times.each do
9
- CustomPost.create(name: SecureRandom.hex, content: SecureRandom.hex, age: 2)
10
- end
11
-
12
- @headers = ['test1', 'test2','test3']
13
- @data = [
14
- ['row1','test1'],
15
- ['row2 c1', nil, '123'],
16
- ['the',Date.today,Time.now]
17
- ]
18
- @options = {
19
- headers: true,
20
- header_style: {background_color: 'AAAAAA', color: 'FFFFFF', align: :center, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
21
- row_style: {background_color: nil, color: '000000', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
22
- sheet_name: 'My Project Export',
23
- column_styles: [],
24
- range_styles: [],
25
- merges: [],
26
- borders: [],
27
- column_types: [:string, :date, :date]
28
- }
29
- end
30
-
31
- def test_empty_model
32
- CustomPost.delete_all
33
- File.open(Rails.root.join('tmp/ods/empty_model.ods'),'w+b') do |f|
34
- f.write CustomPost.to_ods
35
- end
36
- end
37
-
38
- def test_empty_sa
39
- File.open(Rails.root.join('tmp/ods/empty_sa.ods'),'w+b') do |f|
40
- f.write SpreadsheetArchitect.to_ods(data: [])
41
- end
42
- end
43
-
44
- def test_sa
45
- File.open(Rails.root.join('tmp/ods/sa.ods'),'w+b') do |f|
46
- f.write SpreadsheetArchitect.to_ods(headers: @headers, data: @data)
47
- end
48
- end
49
-
50
- def test_model
51
- File.open(Rails.root.join('tmp/ods/model.ods'),'w+b') do |f|
52
- f.write CustomPost.to_ods
53
- end
54
- end
55
-
56
- def test_options
57
- File.open(Rails.root.join('tmp/ods/model_options.ods'),'w+b') do |f|
58
- f.write CustomPost.to_ods(@options)
59
- end
60
- end
61
-
62
- def teardown
63
- end
64
-
65
- end
@@ -1,51 +0,0 @@
1
- require "test_helper"
2
-
3
- class PlainRubyObjectTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- @path = Rails.root.join('tmp/plain_ruby_object')
7
- FileUtils.mkdir_p(@path)
8
- end
9
-
10
- def test_csv
11
- assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
12
- PlainRubyObject.to_csv
13
- end
14
-
15
- instances = 3.times.map{|_| PlainRubyObject.new}
16
- data = PlainRubyObject.to_csv(instances: instances)
17
-
18
- File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
19
- f.write data
20
- end
21
- end
22
-
23
- def test_ods
24
- assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
25
- PlainRubyObject.to_ods
26
- end
27
-
28
- instances = 3.times.map{|_| PlainRubyObject.new}
29
- data = PlainRubyObject.to_ods(instances: instances)
30
-
31
- File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
32
- f.write data
33
- end
34
- end
35
-
36
- def test_xlsx
37
- assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
38
- PlainRubyObject.to_xlsx
39
- end
40
-
41
- instances = 3.times.map{|_| PlainRubyObject.new}
42
- data = PlainRubyObject.to_xlsx(instances: instances)
43
-
44
- File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
45
- f.write data
46
- end
47
- end
48
-
49
- def teardown
50
- end
51
- end
@@ -1,44 +0,0 @@
1
- require "test_helper"
2
-
3
- class PostTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- @path = Rails.root.join('tmp/posts')
7
- FileUtils.mkdir_p(@path)
8
- end
9
-
10
- def test_csv
11
- data = Post.to_csv
12
-
13
- File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
14
- f.write data
15
- end
16
- end
17
-
18
- def test_ods
19
- data = Post.to_ods
20
-
21
- File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
22
- f.write data
23
- end
24
- end
25
-
26
- def test_xlsx
27
- data = Post.all.to_xlsx
28
-
29
- File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
30
- f.write data
31
- end
32
- end
33
-
34
- def test_empty
35
- Post.destroy_all
36
-
37
- File.open(File.join(@path, 'empty.xlsx'), 'w+b') do |f|
38
- f.write Post.to_xlsx
39
- end
40
- end
41
-
42
- def teardown
43
- end
44
- end
@@ -1,73 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SpreadsheetArchitectUtilsTest < ActiveSupport::TestCase
4
-
5
- def setup
6
- @headers = ['test1', 'test2','test3']
7
- @data = [
8
- ['row1'],
9
- ['row2 c1', 'row2 c2'],
10
- ['the','data']
11
- ]
12
- @options = {
13
- headers: true,
14
- header_style: {background_color: 'AAAAAA', color: 'FFFFFF', align: :center, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
15
- row_style: {background_color: nil, color: '000000', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
16
- sheet_name: 'My Project Export',
17
- column_styles: [],
18
- range_styles: [],
19
- merges: [],
20
- borders: [],
21
- column_types: [],
22
- data: []
23
- }
24
- end
25
-
26
- def test_constants_dont_change
27
- x = SpreadsheetArchitect.default_options.to_s
28
- SpreadsheetArchitect.to_xlsx(headers: [[1]], data: [[1]], header_style: {b: false}, row_style: {background_color: '000000'})
29
- assert_equal(x, SpreadsheetArchitect.default_options.to_s)
30
- end
31
-
32
- def test_str_humanize
33
- assert_equal(SpreadsheetArchitect::Utils.str_humanize('my_project_export'), 'My Project Export')
34
- assert_equal(SpreadsheetArchitect::Utils.str_humanize('My Project Export'), 'My Project Export')
35
- assert_equal(SpreadsheetArchitect::Utils.str_humanize('TBS report'), 'TBS Report')
36
- end
37
-
38
- def test_get_type
39
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type('string'), :string)
40
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(123.01), :float)
41
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(BigDecimal('123.01')), :float)
42
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(10), :integer)
43
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(:test), :string)
44
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(Time.now.to_date), :date)
45
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(DateTime.now), :time)
46
- assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(Time.now), :time)
47
- end
48
-
49
- def test_get_cell_data
50
- SpreadsheetArchitect::Utils.get_cell_data(@options, SpreadsheetArchitect)
51
-
52
- SpreadsheetArchitect::Utils.get_cell_data(@options, Post)
53
- end
54
-
55
- def test_get_options
56
- SpreadsheetArchitect::Utils.get_options(@options, SpreadsheetArchitect)
57
-
58
- SpreadsheetArchitect::Utils.get_options(@options, Post)
59
- end
60
-
61
- def test_convert_styles_to_axlsx
62
- xlsx_styles = SpreadsheetArchitect::Utils::XLSX.convert_styles_to_axlsx({background_color: '333333', color: '000000', align: true, bold: true, font_size: 14, italic: true, underline: true, test: true})
63
- assert_equal(xlsx_styles, {bg_color: '333333', fg_color: '000000', alignment: {horizontal: true}, b: true, sz: 14, i: true, u: true, test: true})
64
- end
65
-
66
- def test_convert_styles_to_ods
67
- ods_styles = SpreadsheetArchitect::Utils.convert_styles_to_ods({background_color: '333333', color: '000000', align: true, bold: true, font_size: 14, italic: true, underline: true, test: true})
68
- assert_equal(ods_styles, {'cell' => {'background-color' => '#333333'}, 'text' => {'color' => '#000000', 'align' => true, 'font-weight' => 'bold', 'font-size' => 14, 'font-style' => 'italic', 'text-underline-type' => 'single', 'text-underline-style' => 'solid'}})
69
- end
70
-
71
- def teardown
72
- end
73
- end